diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2009-04-28 19:41:42 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2009-04-28 19:41:42 (GMT) |
commit | 665f528813749ce6b1ce9afdf104262a65a4a2cd (patch) | |
tree | 5839f00d5537981ae08fad294dc46a7a9a0f4efd /tools | |
parent | 75a7a98214a0a408adff8b90b697682f10a4de77 (diff) | |
download | hdf5-665f528813749ce6b1ce9afdf104262a65a4a2cd.zip hdf5-665f528813749ce6b1ce9afdf104262a65a4a2cd.tar.gz hdf5-665f528813749ce6b1ce9afdf104262a65a4a2cd.tar.bz2 |
[svn-r16875] Merged changes from the trunk into the branch:
svn merge -r16602:16869 https://svn.hdfgroup.uiuc.edu/hdf5/trunk
Tested on: smirom
Diffstat (limited to 'tools')
104 files changed, 4486 insertions, 3139 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in index 5dc816f..113e752 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -350,8 +350,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -457,7 +457,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 3ea702b..958b30f 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -382,8 +382,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -490,7 +490,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index bf70681..b83d6ef 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -398,8 +398,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -511,7 +511,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 181e242..b07c425 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -1,34 +1,36 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * +* the files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +* access to either file, you may request a copy from help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <stdio.h> #include <stdlib.h> #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" + /*------------------------------------------------------------------------- - * Program: h5diffgentest - * - * Purpose: generate files for h5diff testing - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 12, 2003 - * - *------------------------------------------------------------------------- - */ +* Program: h5diffgentest +* +* Purpose: generate files for h5diff testing +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: November 12, 2003 +* +*------------------------------------------------------------------------- +*/ #define FILE1 "h5diff_basic1.h5" #define FILE2 "h5diff_basic2.h5" @@ -49,27 +51,27 @@ #define MY_LINKCLASS 187 /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(UNUSED const char * link_name, UNUSED hid_t cur_group, - UNUSED const void * udata, UNUSED size_t udata_size, UNUSED hid_t lapl_id) + UNUSED const void * udata, UNUSED size_t udata_size, UNUSED hid_t lapl_id) { -return -1; + return -1; } const H5L_class_t UD_link_class[1] = {{ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)MY_LINKCLASS, /* Link type id number */ - "UD link class", /* name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + (H5L_type_t)MY_LINKCLASS, /* Link type id number */ + "UD link class", /* name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; /*------------------------------------------------------------------------- - * prototypes - *------------------------------------------------------------------------- - */ +* prototypes +*------------------------------------------------------------------------- +*/ /* tests called in main() */ static int test_basic(const char *fname1, const char *fname2, const char *fname3); @@ -88,43 +90,43 @@ static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: main program - * - *------------------------------------------------------------------------- - */ +* Function: main +* +* Purpose: main program +* +*------------------------------------------------------------------------- +*/ int main(void) { test_basic(FILE1, FILE2, FILE11); - + test_types (FILE3); test_datatypes(FILE4); - + /* generate 2 files, the second call creates a similar file with differences */ test_attributes(FILE5,0); test_attributes(FILE6,1); - + /* generate 2 files, the second call creates a similar file with differences */ test_datasets(FILE7,0); test_datasets(FILE8,1); - + /* generate 2 files, the second call creates a similar file with differences */ test_hyperslab(FILE9,0); test_hyperslab(FILE10,1); return 0; - + } /*------------------------------------------------------------------------- - * Function: test_basic - * - * Purpose: Create basic test files, first two contains different data, the - * third one is just an empty file. - * - *------------------------------------------------------------------------- - */ +* Function: test_basic +* +* Purpose: Create basic test files, first two contains different data, the +* third one is just an empty file. +* +*------------------------------------------------------------------------- +*/ static int test_basic(const char *fname1, const char *fname2, const char *fname3) @@ -133,7 +135,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) hid_t gid1, gid2, gid3; hsize_t dims1[1] = { 6 }; hsize_t dims2[2] = { 3,2 }; - + /* create the empty file */ if ((fid1=H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0){ fprintf(stderr, "empty file (%s) creation failed.\n", fname3); @@ -143,26 +145,26 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) fprintf(stderr, "empty file (%s) close failed.\n", fname3); goto out; } - + /*------------------------------------------------------------------------- * create two files *------------------------------------------------------------------------- */ - + if (( fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) goto out; if (( fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) goto out; - - /*------------------------------------------------------------------------- - * create groups - *------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- + * create groups + *------------------------------------------------------------------------- */ - + gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); gid2 = H5Gcreate2(fid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); gid3 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * tests: * # 1.1 normal mode @@ -172,19 +174,19 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) * # 1.5 with -d *------------------------------------------------------------------------- */ - + { double data1[3][2] = {{1,1}, {1,1}, {0,0}}; double data2[3][2] = {{0,1.1},{1.01,1.001},{0,1}}; double data3[3][2] = {{100,100},{100,100},{100,100}}; double data4[3][2] = {{105,120},{160,95},{80,40}}; - + write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1); write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2); write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_DOUBLE,data3); write_dset(gid2,2,dims2,"dset4",H5T_NATIVE_DOUBLE,data4); write_dset(gid2,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data2); - + } /*------------------------------------------------------------------------- * relative error, compare divide by zero, both zero @@ -194,12 +196,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) { int data5[3][2] = {{100,100},{100,0},{0,100}}; int data6[3][2] = {{120,80}, {0,100},{0,50}}; - + write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5); write_dset(gid1,2,dims2,"dset6",H5T_NATIVE_INT,data6); - + } - + /*------------------------------------------------------------------------- * relative error, compare divide by zero, both zero * # 1.6.2 with -p (unsigned long long) @@ -208,12 +210,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) { unsigned long long data7[3][2] = {{100,100},{100,0},{0,100}}; unsigned long long data8[3][2] = {{120,80}, {0,100},{0,50}}; - + write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7); write_dset(gid1,2,dims2,"dset8",H5T_NATIVE_ULLONG,data8); - + } - + /*------------------------------------------------------------------------- * relative error, compare divide by zero, both zero * # 1.6.3 with -p (double) @@ -230,13 +232,13 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) { double data9[3][2] = {{100,100},{100,0},{0,100}}; double data10[3][2] ={{120,80}, {0,100},{0,50}}; - + write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9); write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10); - + } - - + + /*------------------------------------------------------------------------- * test floating point comparison *------------------------------------------------------------------------- @@ -247,86 +249,124 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) float data12[3][2] ={{0.00000f,0.00002f},{0.000009f,0.00001f},{0.00000f,0.00001f}}; double data13[3][2] ={{0.000000000,0.000000001},{0.000000001, 0.000000000},{0.000000001,0.000000001}}; double data14[3][2] ={{0.000000000,0.000000002},{0.0000000009,0.000000001},{0.000000000,0.000000001}}; - + write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11); write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12); write_dset(gid1,2,dims2,"d1",H5T_NATIVE_DOUBLE,data13); write_dset(gid1,2,dims2,"d2",H5T_NATIVE_DOUBLE,data14); - + } - - + + #if H5_SIZEOF_LONG_DOUBLE !=0 { - - /*------------------------------------------------------------------------- - * H5T_NATIVE_LDOUBLE - *------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- + * H5T_NATIVE_LDOUBLE + *------------------------------------------------------------------------- */ - + long double data15[3][2] ={{1,1},{1,1},{1,1}}; - + write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15); - + } #endif - - - + + + /*------------------------------------------------------------------------- * NaNs in H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ { - + float data15[6]; float data16[6]; - + data15[0] = (float) sqrt( (double)-1 ); data15[1] = 1; data15[2] = (float) sqrt( (double)-1 ); data15[3] = 1; data15[4] = 1; data15[5] = 1; - + data16[0] = (float) sqrt( (double)-1 ); data16[1] = (float) sqrt( (double)-1 ); data16[2] = 1; data16[3] = 1; data16[4] = 1; data16[5] = 1; - + write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15); write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16); - + } - + /*------------------------------------------------------------------------- * NaNs in H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ { - + double data17[6]; double data18[6]; - + data17[0] = sqrt( (double)-1 ); data17[1] = 1; data17[2] = sqrt( (double)-1 ); data17[3] = 1; data17[4] = 1; data17[5] = 1; - + data18[0] = (float) sqrt( (double)-1 ); data18[1] = (float) sqrt( (double)-1 ); data18[2] = 1; data18[3] = 1; data18[4] = 1; data18[5] = 1; - + write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17); write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); - + + } + + /*------------------------------------------------------------------------- + * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND + *------------------------------------------------------------------------- + */ + { + typedef struct cmp1_t + { + double d; + float f; + } cmp1_t; + + cmp1_t buf1[2]; + cmp1_t buf2[2]; + hsize_t dims[1] = {2}; + size_t type_size; + hid_t tid; + + buf1[0].d = sqrt( (double)-1 ); + buf1[0].f = (float) sqrt( (double)-1 ); + buf2[0].d = sqrt( (double)-1 ); + buf2[0].f = (float) sqrt( (double)-1 ); + + buf1[1].d = sqrt( (double)-1 ); + buf1[1].f = (float) sqrt( (double)-1 ); + buf2[1].d = 0; + buf2[1].f = 0; + + type_size = sizeof( cmp1_t ); + tid = H5Tcreate (H5T_COMPOUND, type_size ); + H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE ); + H5Tinsert(tid, "f", HOFFSET( cmp1_t, f ), H5T_NATIVE_FLOAT ); + write_dset(gid1,1,dims,"dset11",tid,buf1); + write_dset(gid1,1,dims,"dset12",tid,buf2); + H5Tclose(tid); + + } /* not comparable objects */ @@ -334,19 +374,19 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) typedef struct cmp1_t { - double d; - int i; + double d; + int i; } cmp1_t; typedef struct cmp2_t { - int i; - double d; + int i; + double d; } cmp2_t; typedef struct cmp3_t { - int i; + int i; } cmp3_t; double data2[6] = {0,0,0,0,0,0}; @@ -361,7 +401,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) size_t type_size; hid_t tid; - + write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL); write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2); @@ -391,10 +431,10 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); write_dset(gid3,1,dims4,"dset9",tid,NULL); H5Tclose(tid); - + } - - + + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -405,21 +445,21 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) H5Fclose(fid1); H5Fclose(fid2); return SUCCEED; - + out: - + return FAIL; } /*------------------------------------------------------------------------- - * Function: test_types - * - * Purpose: Compare different HDF5 object & link types: - * H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK - * - *------------------------------------------------------------------------- - */ +* Function: test_types +* +* Purpose: Compare different HDF5 object & link types: +* H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK +* +*------------------------------------------------------------------------- +*/ static int test_types(const char *fname) { @@ -439,19 +479,19 @@ int test_types(const char *fname) { int a; } s2_t; - + /*------------------------------------------------------------------------- * Create one file *------------------------------------------------------------------------- */ fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ write_dset(fid1,1,dims,"dset",H5T_NATIVE_INT,0); - + /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- @@ -460,12 +500,12 @@ int test_types(const char *fname) status = H5Gclose(gid1); gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Gclose(gid2); - + /*------------------------------------------------------------------------- * H5G_TYPE *------------------------------------------------------------------------- */ - + /* create and commit datatype 1 */ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT); @@ -477,15 +517,15 @@ int test_types(const char *fname) H5Tinsert(tid2, "a", HOFFSET(s2_t, a), H5T_NATIVE_INT); H5Tcommit2(fid1, "t2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Tclose(tid2); - + /*------------------------------------------------------------------------- * H5G_LINK *------------------------------------------------------------------------- */ - + status = H5Lcreate_soft("g1", fid1, "l1", H5P_DEFAULT, H5P_DEFAULT); status = H5Lcreate_soft("g2", fid1, "l2", H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * H5G_UDLINK *------------------------------------------------------------------------- @@ -493,7 +533,7 @@ int test_types(const char *fname) H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); H5Lregister(UD_link_class); H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * Close *------------------------------------------------------------------------- @@ -542,16 +582,16 @@ TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2 */ /*------------------------------------------------------------------------- - * Function: test_datatypes - * - * Purpose: test dataset datatypes - * - *------------------------------------------------------------------------- - */ +* Function: test_datatypes +* +* Purpose: test dataset datatypes +* +*------------------------------------------------------------------------- +*/ static int test_datatypes(const char *fname) { - + hid_t fid1; hsize_t dims[2]={3,2}; herr_t status; @@ -567,114 +607,114 @@ int test_datatypes(const char *fname) float buf5b[3][2] = {{1,1},{3,4},{5,6}}; double buf6a[3][2] = {{1,1},{1,1},{1,1}}; double buf6b[3][2] = {{1,1},{3,4},{5,6}}; - + /*unsigned/signed test signed char -128 to 127 unsigned char 0 to 255 */ char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; - + /* long long test */ long long buf8a[3][2] = {{1,1},{1,1},{1,1}}; long long buf8b[3][2] = {{1,1},{3,4},{5,6}}; unsigned long long buf9a[3][2] = {{1,1},{1,1},{1,1}}; unsigned long long buf9b[3][2] = {{1,1},{3,4},{5,6}}; - + unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}}; unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}}; - - + + /*------------------------------------------------------------------------- * Create a file *------------------------------------------------------------------------- */ fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * Check for different storage order. Give a warning if they are different *------------------------------------------------------------------------- */ - + write_dset(fid1,2,dims,"dset0a",H5T_STD_I16LE,buf2a); write_dset(fid1,2,dims,"dset0b",H5T_STD_I32LE,buf3b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_CHAR + * H5T_NATIVE_CHAR *------------------------------------------------------------------------- */ write_dset(fid1,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a); write_dset(fid1,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_SHORT + * H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ write_dset(fid1,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a); write_dset(fid1,2,dims,"dset2b",H5T_NATIVE_SHORT,buf2b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_INT + * H5T_NATIVE_INT *------------------------------------------------------------------------- */ write_dset(fid1,2,dims,"dset3a",H5T_NATIVE_INT,buf3a); write_dset(fid1,2,dims,"dset3b",H5T_NATIVE_INT,buf3b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_LONG + * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ write_dset(fid1,2,dims,"dset4a",H5T_NATIVE_LONG,buf4a); write_dset(fid1,2,dims,"dset4b",H5T_NATIVE_LONG,buf4b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_FLOAT + * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ write_dset(fid1,2,dims,"dset5a",H5T_NATIVE_FLOAT,buf5a); write_dset(fid1,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_DOUBLE + * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ - + write_dset(fid1,2,dims,"dset6a",H5T_NATIVE_DOUBLE,buf6a); write_dset(fid1,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b); - + /*------------------------------------------------------------------------- * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR *------------------------------------------------------------------------- */ - + write_dset(fid1,2,dims,"dset7a",H5T_NATIVE_CHAR,buf7a); write_dset(fid1,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b); - + /*------------------------------------------------------------------------- * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - + write_dset(fid1,2,dims,"dset8a",H5T_NATIVE_LLONG,buf8a); write_dset(fid1,2,dims,"dset8b",H5T_NATIVE_LLONG,buf8b); - + /*------------------------------------------------------------------------- * H5T_NATIVE_ULLONG *------------------------------------------------------------------------- */ - + write_dset(fid1,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a); write_dset(fid1,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b); - + /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - + write_dset(fid1,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a); write_dset(fid1,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b); - - + + /*------------------------------------------------------------------------- * Close *------------------------------------------------------------------------- @@ -717,12 +757,12 @@ TOOLTEST h5diff_58.txt file7.h5 file8.h5 -v refreg */ /*------------------------------------------------------------------------- - * Function: test_attributes - * - * Purpose: test attributes - * - *------------------------------------------------------------------------- - */ +* Function: test_attributes +* +* Purpose: test attributes +* +*------------------------------------------------------------------------- +*/ static int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */) @@ -734,31 +774,31 @@ int test_attributes(const char *file, hid_t sid; hsize_t dims[1]={2}; herr_t status; - + /* Create a file */ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - + /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Sclose(sid); assert(status >= 0); - + /* Create groups */ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); root_id = H5Gopen2(fid, "/", H5P_DEFAULT); - + /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group, and root group *------------------------------------------------------------------------- */ - + write_attr_in(did,"dset",fid,make_diffs); write_attr_in(gid,NULL,0,make_diffs); write_attr_in(root_id,NULL,0,make_diffs); - - + + /* Close */ status = H5Dclose(did); assert(status >= 0); @@ -766,7 +806,7 @@ int test_attributes(const char *file, assert(status >= 0); status = H5Gclose(root_id); assert(status >= 0); - + /* Close file */ status = H5Fclose(fid); assert(status >= 0); @@ -775,15 +815,15 @@ int test_attributes(const char *file, /*------------------------------------------------------------------------- - * Function: test_datasets - * - * Purpose: Check all HDF5 classes - * H5T_INTEGER, H5T_FLOAT - * H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, - * H5T_ENUM, H5T_VLEN, H5T_ARRAY - * - *------------------------------------------------------------------------- - */ +* Function: test_datasets +* +* Purpose: Check all HDF5 classes +* H5T_INTEGER, H5T_FLOAT +* H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, +* H5T_ENUM, H5T_VLEN, H5T_ARRAY +* +*------------------------------------------------------------------------- +*/ static int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */) @@ -795,37 +835,37 @@ int test_datasets(const char *file, hsize_t dims[1]={2}; herr_t status; int buf[2]={1,2}; - + if(make_diffs) memset(buf, 0, sizeof buf); - + /* Create a file */ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - + /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); status = H5Sclose(sid); assert(status >= 0); - + /* Create a group */ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * write a series of datasets on the group *------------------------------------------------------------------------- */ - + write_dset_in(gid,"/dset",fid,make_diffs); - + /* close */ status = H5Dclose(did); assert(status >= 0); status = H5Gclose(gid); assert(status >= 0); - + /* close file */ status = H5Fclose(fid); assert(status >= 0); @@ -833,12 +873,12 @@ int test_datasets(const char *file, } /*------------------------------------------------------------------------- - * Function: write_attr_in - * - * Purpose: write attributes in LOC_ID (dataset, group, named datatype) - * - *------------------------------------------------------------------------- - */ +* Function: write_attr_in +* +* Purpose: write attributes in LOC_ID (dataset, group, named datatype) +* +*------------------------------------------------------------------------- +*/ static void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ @@ -851,20 +891,20 @@ void write_attr_in(hid_t loc_id, char a; double b; } s_t; - + typedef enum { RED, - GREEN + GREEN } e_t; - + hid_t aid; hid_t sid; hid_t tid; herr_t status; int val, i, j, k, l, n; float f; - + /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ @@ -878,7 +918,7 @@ void write_attr_in(hid_t loc_id, int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ int buf7[2]= {1,2}; /* integer */ float buf8[2]= {1,2}; /* float */ - + /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ @@ -891,7 +931,7 @@ void write_attr_in(hid_t loc_id, int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - + /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, @@ -907,18 +947,18 @@ void write_attr_in(hid_t loc_id, int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ float buf83[4][3][2]; /* float */ - - + + /*------------------------------------------------------------------------- * 1D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -945,19 +985,19 @@ void write_attr_in(hid_t loc_id, status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,1,dims,"string",tid,buf1); status = H5Tclose(tid); - + for (i=0; i<2; i++) buf1a[i]=buf1[i]; tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id,1,dims,"VLstring",tid,buf1a); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -974,16 +1014,16 @@ void write_attr_in(hid_t loc_id, [ 0 ] 1 0 1 [ 1 ] 2 0 2 */ - + tid = H5Tcopy(H5T_STD_B8LE); write_attr(loc_id,1,dims,"bitfield",tid,buf2); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - + /* buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -995,17 +1035,17 @@ void write_attr_in(hid_t loc_id, [ 0 ] 1 0 1 [ 1 ] 2 0 2 */ - + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,1,dims,"opaque",tid,buf2); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -1013,7 +1053,7 @@ void write_attr_in(hid_t loc_id, buf3[i].a=0; buf3[i].b=0; } } - + /* buf3[2]= {{1,2},{3,4}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -1026,13 +1066,13 @@ void write_attr_in(hid_t loc_id, [ 1 ] 3 5 2 [ 1 ] 4 5 1 */ - + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,1,dims,"compound",tid,buf3); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_OBJECT object reference) *------------------------------------------------------------------------- @@ -1044,7 +1084,7 @@ void write_attr_in(hid_t loc_id, status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- @@ -1071,14 +1111,14 @@ void write_attr_in(hid_t loc_id, H5Tenum_insert(tid, "GREEN", (val = 1, &val)); write_attr(loc_id,1,dims,"enum",tid,buf45); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ - + buf5[0].len = 1; buf5[0].p = malloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; @@ -1086,7 +1126,7 @@ void write_attr_in(hid_t loc_id, buf5[1].p = malloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0]=2; ((int *)buf5[1].p)[1]=3; - + if (make_diffs) { ((int *)buf5[0].p)[0]=0; @@ -1102,7 +1142,7 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 [ 1 ] 3 0 3 */ - + sid = H5Screate_simple(1, dims, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -1113,12 +1153,12 @@ void write_attr_in(hid_t loc_id, status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -1144,12 +1184,12 @@ void write_attr_in(hid_t loc_id, tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -1174,13 +1214,13 @@ void write_attr_in(hid_t loc_id, */ write_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); write_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); - - + + /*------------------------------------------------------------------------- * 2D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -1192,7 +1232,7 @@ void write_attr_in(hid_t loc_id, for (k=0; k<2; k++) buf12[i][j][k]='z'; } - + /* buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -1212,17 +1252,17 @@ void write_attr_in(hid_t loc_id, [ 2 1 ] k z [ 2 1 ] l z */ - + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,2,dims2,"string2D",tid,buf12); status = H5Tclose(tid); - + for (i=0; i<3; i++) { for (j=0; j<2; j++) { - + buf12a[i][j]=buf12[i][j]; } } @@ -1230,17 +1270,17 @@ void write_attr_in(hid_t loc_id, status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id,2,dims2,"VLstring2D",tid,buf12a); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf22,0,sizeof buf22); } - + /* buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -1254,17 +1294,17 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - - + + tid = H5Tcopy(H5T_STD_B8LE); write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - + /* buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -1282,7 +1322,7 @@ void write_attr_in(hid_t loc_id, status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- @@ -1291,7 +1331,7 @@ void write_attr_in(hid_t loc_id, { memset(buf32,0,sizeof buf32); } - + /* buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -1305,14 +1345,14 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - - + + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,2,dims2,"compound2D",tid,buf32); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_OBJECT object reference) *------------------------------------------------------------------------- @@ -1327,7 +1367,7 @@ void write_attr_in(hid_t loc_id, } write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- @@ -1339,7 +1379,7 @@ void write_attr_in(hid_t loc_id, if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; } } - + /* Attribute: <enum2D> and <enum2D> position enum2D of </g1> enum2D of </g1> difference @@ -1351,18 +1391,18 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] RED GREEN [ 2 1 ] RED GREEN */ - + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); write_attr(loc_id,2,dims2,"enum2D",tid,buf452); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 3; i++) { @@ -1374,7 +1414,7 @@ void write_attr_in(hid_t loc_id, else ((int *)buf52[i][j].p)[l] = n++; } } - + /* position vlen2D of </g1> vlen2D of </g1> difference ------------------------------------------------------------ @@ -1390,7 +1430,7 @@ void write_attr_in(hid_t loc_id, [ 2 1 ] 10 0 10 [ 2 1 ] 11 0 11 */ - + sid = H5Screate_simple(2, dims2, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -1401,12 +1441,12 @@ void write_attr_in(hid_t loc_id, status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf62,0,sizeof buf62); @@ -1440,12 +1480,12 @@ void write_attr_in(hid_t loc_id, tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 2, dims2, "array2D", tid, buf62); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf72,0,sizeof buf72); @@ -1472,21 +1512,21 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - + write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - - + + /*------------------------------------------------------------------------- * 3D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<4; i++) @@ -1495,69 +1535,69 @@ void write_attr_in(hid_t loc_id, for (l=0; l<2; l++) buf13[i][j][k][l]='z'; } - + /* buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", "rs","tu","vw","xz","AB","CD","EF","GH", "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; - - Attribute: <string3D> and <string3D> - position string3D of </g1> string3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] a z - [ 0 0 0 ] b z - [ 0 0 1 ] c z - [ 0 0 1 ] d z - [ 0 1 0 ] e z - [ 0 1 0 ] f z - [ 0 1 1 ] g z - [ 0 1 1 ] h z - [ 0 2 0 ] i z - [ 0 2 0 ] j z - [ 0 2 1 ] k z - [ 0 2 1 ] l z - [ 1 0 0 ] m z - [ 1 0 0 ] n z - [ 1 0 1 ] p z - [ 1 0 1 ] q z - [ 1 1 0 ] r z - [ 1 1 0 ] s z - [ 1 1 1 ] t z - [ 1 1 1 ] u z - [ 1 2 0 ] v z - [ 1 2 0 ] w z - [ 1 2 1 ] x z - [ 2 0 0 ] A z - [ 2 0 0 ] B z - [ 2 0 1 ] C z - [ 2 0 1 ] D z - [ 2 1 0 ] E z - [ 2 1 0 ] F z - [ 2 1 1 ] G z - [ 2 1 1 ] H z - [ 2 2 0 ] I z - [ 2 2 0 ] J z - [ 2 2 1 ] K z - [ 2 2 1 ] L z - [ 3 0 0 ] M z - [ 3 0 0 ] N z - [ 3 0 1 ] P z - [ 3 0 1 ] Q z - [ 3 1 0 ] R z - [ 3 1 0 ] S z - [ 3 1 1 ] T z - [ 3 1 1 ] U z - [ 3 2 0 ] V z - [ 3 2 0 ] W z - [ 3 2 1 ] X z - [ 3 2 1 ] Z z - */ - + + Attribute: <string3D> and <string3D> + position string3D of </g1> string3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] a z + [ 0 0 0 ] b z + [ 0 0 1 ] c z + [ 0 0 1 ] d z + [ 0 1 0 ] e z + [ 0 1 0 ] f z + [ 0 1 1 ] g z + [ 0 1 1 ] h z + [ 0 2 0 ] i z + [ 0 2 0 ] j z + [ 0 2 1 ] k z + [ 0 2 1 ] l z + [ 1 0 0 ] m z + [ 1 0 0 ] n z + [ 1 0 1 ] p z + [ 1 0 1 ] q z + [ 1 1 0 ] r z + [ 1 1 0 ] s z + [ 1 1 1 ] t z + [ 1 1 1 ] u z + [ 1 2 0 ] v z + [ 1 2 0 ] w z + [ 1 2 1 ] x z + [ 2 0 0 ] A z + [ 2 0 0 ] B z + [ 2 0 1 ] C z + [ 2 0 1 ] D z + [ 2 1 0 ] E z + [ 2 1 0 ] F z + [ 2 1 1 ] G z + [ 2 1 1 ] H z + [ 2 2 0 ] I z + [ 2 2 0 ] J z + [ 2 2 1 ] K z + [ 2 2 1 ] L z + [ 3 0 0 ] M z + [ 3 0 0 ] N z + [ 3 0 1 ] P z + [ 3 0 1 ] Q z + [ 3 1 0 ] R z + [ 3 1 0 ] S z + [ 3 1 1 ] T z + [ 3 1 1 ] U z + [ 3 2 0 ] V z + [ 3 2 0 ] W z + [ 3 2 1 ] X z + [ 3 2 1 ] Z z + */ + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,3,dims3,"string3D",tid,buf13); status = H5Tclose(tid); - + for (i=0; i<4; i++) { for (j=0; j<3; j++) @@ -1572,12 +1612,12 @@ void write_attr_in(hid_t loc_id, status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id,3,dims3,"VLstring3D",tid,buf13a); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + n=1; for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { @@ -1587,7 +1627,7 @@ void write_attr_in(hid_t loc_id, } } } - + /* position bitfield3D of </g1> bitfield3D of </g1> difference ------------------------------------------------------------ @@ -1616,11 +1656,11 @@ void write_attr_in(hid_t loc_id, [ 3 2 0 ] 23 0 23 [ 3 2 1 ] 24 0 24 */ - + tid = H5Tcopy(H5T_STD_B8LE); write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- @@ -1629,12 +1669,12 @@ void write_attr_in(hid_t loc_id, status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + n=1; for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { @@ -1701,13 +1741,13 @@ void write_attr_in(hid_t loc_id, [ 3 2 1 ] 47 0 47 [ 3 2 1 ] 48 0 48 */ - + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,3,dims3,"compound3D",tid,buf33); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_OBJECT object reference) *------------------------------------------------------------------------- @@ -1723,12 +1763,12 @@ void write_attr_in(hid_t loc_id, } write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - + for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) { @@ -1736,7 +1776,7 @@ void write_attr_in(hid_t loc_id, } } } - + /* position enum3D of </g1> enum3D of </g1> difference ------------------------------------------------------------ @@ -1765,19 +1805,19 @@ void write_attr_in(hid_t loc_id, [ 3 2 0 ] GREEN RED [ 3 2 1 ] GREEN RED */ - - + + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); write_attr(loc_id,3,dims3,"enum3D",tid,buf453); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -1816,7 +1856,7 @@ void write_attr_in(hid_t loc_id, status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- @@ -1840,11 +1880,11 @@ void write_attr_in(hid_t loc_id, [ 0 1 0 ] 7 0 7 etc */ - + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 3, dims3, "array3D", tid, buf63); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- @@ -1864,7 +1904,7 @@ void write_attr_in(hid_t loc_id, } } } - + /* position integer3D of </g1> integer3D of </g1> difference ------------------------------------------------------------ @@ -1887,12 +1927,12 @@ void write_attr_in(hid_t loc_id, /*------------------------------------------------------------------------- - * Function: write_dset_in - * - * Purpose: write datasets in LOC_ID - * - *------------------------------------------------------------------------- - */ +* Function: write_dset_in +* +* Purpose: write datasets in LOC_ID +* +*------------------------------------------------------------------------- +*/ static void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ @@ -1905,13 +1945,13 @@ void write_dset_in(hid_t loc_id, char a; double b; } s_t; - + typedef enum { RED, - GREEN + GREEN } e_t; - + hid_t did; hid_t sid; hid_t tid; @@ -1921,7 +1961,7 @@ void write_dset_in(hid_t loc_id, float f; int fillvalue=2; int scalar_data = 2; - + /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ @@ -1935,7 +1975,7 @@ void write_dset_in(hid_t loc_id, int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ int buf7[2]= {1,2}; /* integer */ float buf8[2]= {1,2}; /* float */ - + /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ @@ -1947,7 +1987,7 @@ void write_dset_in(hid_t loc_id, int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - + /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, @@ -1962,59 +2002,59 @@ void write_dset_in(hid_t loc_id, int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ float buf83[4][3][2]; /* float */ - - + + /*------------------------------------------------------------------------- * H5S_SCALAR *------------------------------------------------------------------------- */ - - - + + + if ( make_diffs ) { - + scalar_data = 1; } - + /* create a space */ sid = H5Screate(H5S_SCALAR); - + /* create a dataset */ did = H5Dcreate2(loc_id, "scalar", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - + /* write */ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &scalar_data); - + /* close */ H5Dclose(did); H5Sclose(sid); - - + + /*------------------------------------------------------------------------- * 1D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - - + + if (make_diffs) { for (i=0; i<2; i++) for (j=0; j<2; j++) buf1[i][j]='z'; } - - + + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,1,dims,"string",tid,buf1); status = H5Tclose(tid); - + for (i=0; i<2; i++) { buf1a[i]=buf1[i]; @@ -2023,27 +2063,27 @@ void write_dset_in(hid_t loc_id, status = H5Tset_size(tid, H5T_VARIABLE); write_dset(loc_id,1,dims,"VLstring",tid,buf1a); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) buf2[i]=buf2[1]=0; } - + tid = H5Tcopy(H5T_STD_B8LE); write_dset(loc_id,1,dims,"bitfield",tid,buf2); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -2051,18 +2091,18 @@ void write_dset_in(hid_t loc_id, buf3[i].a=0; buf3[i].b=0; } } - + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,1,dims,"opaque",tid,buf2); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - - + + if (make_diffs) { for (i=0; i<2; i++) @@ -2070,13 +2110,13 @@ void write_dset_in(hid_t loc_id, buf45[i]=GREEN; } } - + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,1,dims,"compound",tid,buf3); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_OBJECT object reference) *------------------------------------------------------------------------- @@ -2088,14 +2128,14 @@ void write_dset_in(hid_t loc_id, status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); } - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference) *------------------------------------------------------------------------- */ - + gen_datareg(fid,make_diffs); - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- @@ -2105,14 +2145,14 @@ void write_dset_in(hid_t loc_id, H5Tenum_insert(tid, "GREEN", (val = 1, &val)); write_dset(loc_id,1,dims,"enum",tid,buf45); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ - + buf5[0].len = 1; buf5[0].p = malloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; @@ -2120,13 +2160,13 @@ void write_dset_in(hid_t loc_id, buf5[1].p = malloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0]=2; ((int *)buf5[1].p)[1]=3; - + if(make_diffs) { ((int *)buf5[0].p)[0] = 0; ((int *)buf5[1].p)[0] = 0; ((int *)buf5[1].p)[1]=0; } - + sid = H5Screate_simple(1, dims, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2137,12 +2177,12 @@ void write_dset_in(hid_t loc_id, status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -2151,16 +2191,56 @@ void write_dset_in(hid_t loc_id, buf6[i][j]=0; } } - + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); - + + { + + double *dbuf; /* information to write */ + hid_t did; /* dataset ID */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + size_t size; + hsize_t sdims[] = {1}; + hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1}; + int j; + + /* allocate and initialize array data to write */ + size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); + dbuf = malloc( size ); + + for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++) + dbuf[j] = j; + + if (make_diffs) + { + dbuf[5] = 0; + dbuf[6] = 0; + } + + /* create a type larger than H5TOOLS_MALLOCSIZE */ + tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims); + size = H5Tget_size(tid); + sid = H5Screate_simple(1, sdims, NULL); + did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); +#if defined(WRITE_ARRAY) + H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); +#endif + + /* close */ + H5Dclose(did); + H5Tclose(tid); + H5Sclose(sid); + free( dbuf ); + } + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -2169,21 +2249,21 @@ void write_dset_in(hid_t loc_id, buf8[i]=0; } } - + write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); - - + + /*------------------------------------------------------------------------- * 2D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<3; i++) @@ -2191,13 +2271,13 @@ void write_dset_in(hid_t loc_id, for (k=0; k<2; k++) buf12[i][j][k]='z'; } - - + + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,2,dims2,"string2D",tid,buf12); status = H5Tclose(tid); - + for (i=0; i<3; i++) { for (j=0; j<2; j++) @@ -2209,22 +2289,22 @@ void write_dset_in(hid_t loc_id, status = H5Tset_size(tid, H5T_VARIABLE); write_dset(loc_id,2,dims2,"VLstring2D",tid,buf12a); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - - + + if (make_diffs) { memset(buf22,0,sizeof buf22); } - + tid = H5Tcopy(H5T_STD_B8LE); write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- @@ -2233,23 +2313,23 @@ void write_dset_in(hid_t loc_id, status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf32,0,sizeof buf32); } - + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,2,dims2,"compound2D",tid,buf32); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_OBJECT object reference) *------------------------------------------------------------------------- @@ -2264,23 +2344,23 @@ void write_dset_in(hid_t loc_id, } write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); write_dset(loc_id,2,dims2,"enum2D",tid,0); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n = 0; for(i = 0; i < 3; i++) @@ -2298,7 +2378,7 @@ void write_dset_in(hid_t loc_id, } } } - + sid = H5Screate_simple(2, dims2, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2309,35 +2389,35 @@ void write_dset_in(hid_t loc_id, status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf62,0,sizeof buf62); } - - + + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 2, dims2, "array2D", tid, buf62); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_INTEGER, write a fill value *------------------------------------------------------------------------- */ - - + + if (make_diffs) { memset(buf72, 0, sizeof buf72); memset(buf82, 0, sizeof buf82); } - - + + dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue); sid = H5Screate_simple(2, dims2, NULL); @@ -2346,25 +2426,25 @@ void write_dset_in(hid_t loc_id, status = H5Pclose(dcpl); status = H5Dclose(did); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_FLOAT *------------------------------------------------------------------------- */ - + write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - - + + /*------------------------------------------------------------------------- * 3D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<4; i++) @@ -2373,12 +2453,12 @@ void write_dset_in(hid_t loc_id, for (l=0; l<2; l++) buf13[i][j][k][l]='z'; } - + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,3,dims3,"string3D",tid,buf13); status = H5Tclose(tid); - + for (i=0; i<4; i++) { for (j=0; j<3; j++) @@ -2393,13 +2473,13 @@ void write_dset_in(hid_t loc_id, status = H5Tset_size(tid, H5T_VARIABLE); write_dset(loc_id,3,dims3,"VLstring3D",tid,buf13a); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - - + + n=1; for (i = 0; i < 4; i++) { @@ -2413,12 +2493,12 @@ void write_dset_in(hid_t loc_id, } } } - - + + tid = H5Tcopy(H5T_STD_B8LE); write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- @@ -2427,12 +2507,12 @@ void write_dset_in(hid_t loc_id, status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + n=1; for (i = 0; i < 4; i++) { @@ -2452,14 +2532,14 @@ void write_dset_in(hid_t loc_id, } } } - - + + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,3,dims3,"compound3D",tid,buf33); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_REFERENCE (H5R_OBJECT object reference) *------------------------------------------------------------------------- @@ -2475,23 +2555,23 @@ void write_dset_in(hid_t loc_id, } write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); write_dset(loc_id,3,dims3,"enum3D",tid,0); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for(i = 0; i < 4; i++) @@ -2512,7 +2592,7 @@ void write_dset_in(hid_t loc_id, } } } - + sid = H5Screate_simple(3, dims3, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2523,13 +2603,13 @@ void write_dset_in(hid_t loc_id, status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - - + + n=1; for (i = 0; i < 24; i++) { for (j = 0; j < (int)dimarray[0]; j++) { @@ -2537,11 +2617,11 @@ void write_dset_in(hid_t loc_id, else buf63[i][j]=n++; } } - + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 3, dims3, "array3D", tid, buf63); status = H5Tclose(tid); - + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- @@ -2566,14 +2646,14 @@ void write_dset_in(hid_t loc_id, } /*------------------------------------------------------------------------- - * Function: gen_datareg - * - * Purpose: generate a dataset region and its reference - * - * Date: April 19, 2006 - * - *------------------------------------------------------------------------- - */ +* Function: gen_datareg +* +* Purpose: generate a dataset region and its reference +* +* Date: April 19, 2006 +* +*------------------------------------------------------------------------- +*/ static void gen_datareg(hid_t fid, @@ -2594,44 +2674,44 @@ void gen_datareg(hid_t fid, hsize_t coord[5][2]; /* coordinates for point selection */ herr_t status; int i; - + /* allocate the buffer for write the references */ rbuf = calloc((size_t)2, sizeof(hdset_reg_ref_t)); - + /* allocate the buffer for write the data dataset */ buf = malloc(10 * 10 * sizeof(int)); - + for(i = 0; i < 10 * 10; i++) buf[i] = i; - + /* create the data dataset */ sid1 = H5Screate_simple(2, dims1, NULL); did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); assert(status >= 0); - + /* create the reference dataset */ sid2 = H5Screate_simple(1, dims2, NULL); did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - + /* create the references */ /* select hyperslab for first reference */ - + start[0] = 2; start[1] = 2; count[0] = 6; count[1] = 6; if(make_diffs) { start[0] = 0; start[1] = 0; count[0] = 3; count[1] = 3; } - + status = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); assert(status >= 0); H5Sget_select_npoints(sid1); - + /* store first dataset region */ status = H5Rcreate(&rbuf[0], fid, "dsetref", H5R_DATASET_REGION, sid1); assert(status >= 0); - + /* select sequence of five points for second reference */ coord[0][0]=6; coord[0][1]=9; coord[1][0]=2; coord[1][1]=2; @@ -2646,14 +2726,14 @@ void gen_datareg(hid_t fid, } H5Sselect_elements(sid1,H5S_SELECT_SET,(size_t)5,(const hsize_t *)coord); H5Sget_select_npoints(sid1); - + /* store second dataset region */ H5Rcreate(&rbuf[1],fid,"dsetref",H5R_DATASET_REGION,sid1); - + /* write */ status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); assert(status >= 0); - + /* close, free memory buffers */ status = H5Dclose(did1); assert(status >= 0); @@ -2670,13 +2750,13 @@ void gen_datareg(hid_t fid, /*------------------------------------------------------------------------- - * Function: test_hyperslab - * - * Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions - * by iterating trough 1KB hyperslabs - * - *------------------------------------------------------------------------- - */ +* Function: test_hyperslab +* +* Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions +* by iterating trough 1KB hyperslabs +* +*------------------------------------------------------------------------- +*/ static int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */) @@ -2697,7 +2777,7 @@ int test_hyperslab(const char *fname, char *buf=NULL; int i, j, s; char c; - + /* create */ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -2716,7 +2796,7 @@ int test_hyperslab(const char *fname, goto out; if((size = H5Tget_size(tid)) <= 0) goto out; - + /* create a evenly divided buffer from 0 to 127 */ buf = (char *)HDmalloc((size_t)(nelmts * size)); s = 1024 * 1024 / 127; @@ -2725,29 +2805,29 @@ int test_hyperslab(const char *fname, c++; j = 0; } - + /* set the hyperslab values */ HDmemset(buf, c, nelmts); - + /* make a different hyperslab at this position */ if(make_diffs && i == 512 * 512) HDmemset(buf, 0, nelmts); - + hs_start[0] = i * GBLL/(1024*1024); if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) goto out; - + /* write only one hyperslab */ if ( i==512*512) { if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) goto out; } - + } free(buf); buf=NULL; - + /* close */ if(H5Sclose(f_sid) < 0) goto out; @@ -2758,9 +2838,9 @@ int test_hyperslab(const char *fname, if(H5Dclose(did) < 0) goto out; H5Fclose(fid); - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2770,17 +2850,17 @@ out: H5Fclose(fid); } H5E_END_TRY; return -1; - + } /*------------------------------------------------------------------------- - * Function: write_attr - * - * Purpose: utility function to write an attribute in LOC_ID - * - *------------------------------------------------------------------------- - */ +* Function: write_attr +* +* Purpose: utility function to write an attribute in LOC_ID +* +*------------------------------------------------------------------------- +*/ static int write_attr(hid_t loc_id, int rank, @@ -2821,19 +2901,19 @@ out: } /*------------------------------------------------------------------------- - * Function: write_dset - * - * Purpose: utility function to create and write a dataset in LOC_ID - * - *------------------------------------------------------------------------- - */ +* Function: write_dset +* +* Purpose: utility function to create and write a dataset in LOC_ID +* +*------------------------------------------------------------------------- +*/ static int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, - const char *name, - hid_t tid, - void *buf ) + int rank, + hsize_t *dims, + const char *name, + hid_t tid, + void *buf ) { hid_t did=-1; hid_t sid=-1; diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt index 599cc2b..a212444 100644 --- a/tools/h5diff/testfiles/h5diff_201.txt +++ b/tools/h5diff/testfiles/h5diff_201.txt @@ -1 +1 @@ -</g2/dset1> or </g2/dset2> are empty datasets +Not comparable: </g2/dset1> or </g2/dset2> are empty datasets diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt index a881cf5..ee240c2 100644 --- a/tools/h5diff/testfiles/h5diff_202.txt +++ b/tools/h5diff/testfiles/h5diff_202.txt @@ -1,2 +1,2 @@ </g2/dset2> is of class H5T_FLOAT and </g2/dset3> is of class H5T_INTEGER -</g2/dset2> has sign H5T_SGN_ERROR and </g2/dset3> has sign H5T_SGN_2 +Not comparable: </g2/dset2> has sign H5T_SGN_ERROR and </g2/dset3> has sign H5T_SGN_2 diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt index aea1891..49ee21c 100644 --- a/tools/h5diff/testfiles/h5diff_203.txt +++ b/tools/h5diff/testfiles/h5diff_203.txt @@ -1,2 +1,2 @@ -</g2/dset3> has rank 1, dimensions [6], max dimensions [6] +Not comparable: </g2/dset3> has rank 1, dimensions [6], max dimensions [6] </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt index 66b9e63..5a3d87f 100644 --- a/tools/h5diff/testfiles/h5diff_204.txt +++ b/tools/h5diff/testfiles/h5diff_204.txt @@ -1,2 +1,2 @@ -</g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] +Not comparable: </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2] diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt index f7360ab..81298af 100644 --- a/tools/h5diff/testfiles/h5diff_205.txt +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -1,3 +1,3 @@ -</g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2] +Not comparable: </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2] </g2/dset6> has rank 2, dimensions [3x2], max dimensions [3x2] -</g2/dset5> has sign H5T_SGN_2 and </g2/dset6> has sign H5T_SGN_NONE +Not comparable: </g2/dset5> has sign H5T_SGN_2 and </g2/dset6> has sign H5T_SGN_NONE diff --git a/tools/h5diff/testfiles/h5diff_206.txt b/tools/h5diff/testfiles/h5diff_206.txt index 8bbbb9a..164aed9 100644 --- a/tools/h5diff/testfiles/h5diff_206.txt +++ b/tools/h5diff/testfiles/h5diff_206.txt @@ -1 +1 @@ -</g2/dset7> has a class H5T_FLOAT and </g2/dset8> has a class H5T_INTEGER +Not comparable: </g2/dset7> has a class H5T_FLOAT and </g2/dset8> has a class H5T_INTEGER diff --git a/tools/h5diff/testfiles/h5diff_207.txt b/tools/h5diff/testfiles/h5diff_207.txt index 833afe8..f8152f8 100644 --- a/tools/h5diff/testfiles/h5diff_207.txt +++ b/tools/h5diff/testfiles/h5diff_207.txt @@ -1,2 +1,2 @@ -</g2/dset8> or </g2/dset9> are empty datasets -</g2/dset8> has 2 members </g2/dset9> has 1 members +Not comparable: </g2/dset8> or </g2/dset9> are empty datasets +Not comparable: </g2/dset8> has 2 members </g2/dset9> has 1 members diff --git a/tools/h5diff/testfiles/h5diff_57.txt b/tools/h5diff/testfiles/h5diff_57.txt index c1a0d64..a026077 100644 --- a/tools/h5diff/testfiles/h5diff_57.txt +++ b/tools/h5diff/testfiles/h5diff_57.txt @@ -2,7 +2,7 @@ dataset: </dset7a> and </dset7b> Warning: different storage datatype </dset7a> has file datatype H5T_STD_I8LE </dset7b> has file datatype H5T_STD_U8LE -</dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE +Not comparable: </dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE 0 differences found -------------------------------- Some objects are not comparable diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt index 42fe6fc..b42cacd 100644 --- a/tools/h5diff/testfiles/h5diff_70.txt +++ b/tools/h5diff/testfiles/h5diff_70.txt @@ -677,7 +677,7 @@ position float3D of </> float3D of </> difference [ 3 2 1 ] 24 0 24 24 differences found dataset: </dset> and </dset> -</dset> or </dset> are empty datasets +Not comparable: </dset> or </dset> are empty datasets attribute: <string of </dset>> and <string of </dset>> size: [2] [2] position string of </dset> string of </dset> difference diff --git a/tools/h5diff/testfiles/h5diff_80.txt b/tools/h5diff/testfiles/h5diff_80.txt index dcabf10..c8ec309 100644 --- a/tools/h5diff/testfiles/h5diff_80.txt +++ b/tools/h5diff/testfiles/h5diff_80.txt @@ -11,6 +11,7 @@ file1 file2 x x /g1/array x x /g1/array2D x x /g1/array3D + x x /g1/arrayd x x /g1/bitfield x x /g1/bitfield2D x x /g1/bitfield3D @@ -243,6 +244,9 @@ position array3D array3D difference [ 3 2 1 ] 71 0 71 [ 3 2 1 ] 72 0 72 72 differences found +dataset: </g1/arrayd> and </g1/arrayd> +Not comparable: </g1/arrayd> or </g1/arrayd> are empty datasets +0 differences found dataset: </g1/bitfield> and </g1/bitfield> size: [2] [2] position bitfield bitfield difference @@ -376,10 +380,10 @@ position enum enum difference [ 0 ] RED GREEN 1 differences found dataset: </g1/enum2D> and </g1/enum2D> -</g1/enum2D> or </g1/enum2D> are empty datasets +Not comparable: </g1/enum2D> or </g1/enum2D> are empty datasets 0 differences found dataset: </g1/enum3D> and </g1/enum3D> -</g1/enum3D> or </g1/enum3D> are empty datasets +Not comparable: </g1/enum3D> or </g1/enum3D> are empty datasets 0 differences found dataset: </g1/float> and </g1/float> size: [2] [2] diff --git a/tools/h5diff/testfiles/h5diff_90.txt b/tools/h5diff/testfiles/h5diff_90.txt index 71b960e..a513ffa 100644 --- a/tools/h5diff/testfiles/h5diff_90.txt +++ b/tools/h5diff/testfiles/h5diff_90.txt @@ -30,7 +30,7 @@ dataset: </g1/dset4> and </g1/dset4> group : </g2> and </g2> 0 differences found dataset: </g2/dset1> and </g2/dset1> -</g2/dset1> or </g2/dset1> are empty datasets +Not comparable: </g2/dset1> or </g2/dset1> are empty datasets 0 differences found dataset: </g2/dset2> and </g2/dset2> 0 differences found @@ -47,7 +47,7 @@ dataset: </g2/dset7> and </g2/dset7> dataset: </g2/dset8> and </g2/dset8> 0 differences found dataset: </g2/dset9> and </g2/dset9> -</g2/dset9> or </g2/dset9> are empty datasets +Not comparable: </g2/dset9> or </g2/dset9> are empty datasets 0 differences found -------------------------------- Some objects are not comparable diff --git a/tools/h5diff/testfiles/h5diff_dset1.h5 b/tools/h5diff/testfiles/h5diff_dset1.h5 Binary files differindex d1ceb9d..123e141 100644 --- a/tools/h5diff/testfiles/h5diff_dset1.h5 +++ b/tools/h5diff/testfiles/h5diff_dset1.h5 diff --git a/tools/h5diff/testfiles/h5diff_dset2.h5 b/tools/h5diff/testfiles/h5diff_dset2.h5 Binary files differindex d1370d9..3ae6993 100644 --- a/tools/h5diff/testfiles/h5diff_dset2.h5 +++ b/tools/h5diff/testfiles/h5diff_dset2.h5 diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 9bf42b7..0d77850 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -385,8 +385,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -501,7 +501,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index f116e89..6868332 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -105,8 +105,8 @@ static H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | d **/ /* module-scoped variables for XML option */ -#define DEFAULT_XSD "http://hdfgroup.org/DTDs/HDF5-File.xsd" -#define DEFAULT_DTD "http://hdfgroup.org/DTDs/HDF5-File.dtd" +#define DEFAULT_XSD "http://www.hdfgroup.org/DTDs/HDF5-File.xsd" +#define DEFAULT_DTD "http://www.hdfgroup.org/DTDs/HDF5-File.dtd" static int doxml = 0; static int useschema = 1; @@ -4396,8 +4396,8 @@ main(int argc, const char *argv[]) printf("<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/DTDs/HDF5-File\" " "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " - "xsi:schemaLocation=\"http://hdfgroup.org/DTDs/HDF5File " - "http://hdfgroup.org/DTDs/HDF5-File.xsd\">\n",xmlnsprefix,ns); + "xsi:schemaLocation=\"http://hdfgroup.org/DTDs/HDF5-File " + "http://www.hdfgroup.org/DTDs/HDF5-File.xsd\">\n",xmlnsprefix,ns); } } else { printf("<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index fc75681..c7e1445 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -91,6 +91,7 @@ #define FILE61 "textlinksrc.h5" #define FILE62 "textlinktar.h5" #define FILE63 "textlinkfar.h5" +#define FILE64 "tarray8.h5" @@ -121,7 +122,7 @@ set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t UNUSED sid); #define MYFILTER_ID 405 /* This message derives from H5Z */ -const H5Z_class_t H5Z_MYFILTER[1] = {{ +const H5Z_class2_t H5Z_MYFILTER[1] = {{ H5Z_CLASS_T_VERS, MYFILTER_ID, /* Filter id number */ 1, 1, @@ -2812,6 +2813,50 @@ static void gent_array7(void) assert(ret >= 0); } +static void gent_array8(void) +{ + int *buf; /* information to write */ + hid_t fid; /* HDF5 File ID */ + hid_t did; /* dataset ID */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + size_t size; + hsize_t sdims[] = {1}; + hsize_t tdims[] = {H5TOOLS_BUFSIZE / sizeof(int) + 1}; + int i; + herr_t ret; + + size = ( H5TOOLS_BUFSIZE / sizeof(int) + 1 ) * sizeof(int); + buf = malloc( size ); + + for( i = 0; i < H5TOOLS_BUFSIZE / sizeof(int) + 1; i++) + buf[i] = i; + + /* create file */ + fid = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* create a type larger than H5TOOLS_BUFSIZE */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, tdims); + size = H5Tget_size(tid); + sid = H5Screate_simple(1, sdims, NULL); + did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + assert(ret >= 0); + + + /* close */ + ret = H5Dclose(did); + assert(ret >= 0); + ret = H5Tclose(tid); + assert(ret >= 0); + ret = H5Sclose(sid); + assert(ret >= 0); + + ret = H5Fclose(fid); + assert(ret >= 0); + free( buf ); +} + static void gent_empty(void) { typedef struct { diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 9718bfc..080726f 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -514,6 +514,7 @@ TOOLTEST textlinkfar.ddl textlinkfar.h5 + if test $nerrors -eq 0 ; then echo "All $DUMPER tests passed." fi diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 65cefc8..9314d90 100755 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -376,8 +376,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -484,7 +484,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 32a6c2f..87d1c6b 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -388,8 +388,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -510,7 +510,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index bfc0e78..72fc0bf 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -369,8 +369,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -468,7 +468,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index f677de0..2c0c0c2 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -50,6 +50,9 @@ h5repacktst_SOURCES=$(COMMON_SOURCES) h5repacktst.c testh5repack_detect_szip_SOURCES=testh5repack_detect_szip.c +# The h5repack.sh script needs h5repacktst to run first. +h5repack.sh.chkexe_: h5repacktst.chkexe_ + # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 1a5990d..9b559ad 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -403,8 +403,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -531,7 +531,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -722,6 +722,9 @@ uninstall-am: uninstall-binPROGRAMS help: @$(top_srcdir)/bin/makehelp +# The h5repack.sh script needs h5repacktst to run first. +h5repack.sh.chkexe_: h5repacktst.chkexe_ + # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 92db049..d8a503c 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * +* the files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +* access to either file, you may request a copy from help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <stdlib.h> #include <string.h> @@ -27,10 +27,10 @@ extern char *progname; /*------------------------------------------------------------------------- - * File: h5repack.c - * Purpose: Public API functions - *------------------------------------------------------------------------- - */ +* File: h5repack.c +* Purpose: Public API functions +*------------------------------------------------------------------------- +*/ static int check_options(pack_opt_t *options); static int check_objects(const char* fname, pack_opt_t *options); @@ -40,24 +40,24 @@ static int have_request(pack_opt_t *options); /*------------------------------------------------------------------------- - * Function: h5repack - * - * Purpose: locate all high-level HDF5 objects in the file - * and compress/chunk them using options - * - * Algorithm: 2 traversals are made to the file; the 1st builds a list of - * the objects, the 2nd makes a copy of them, using the options; - * the reason for the 1st traversal is to check for invalid - * object name requests - * - * Return: 0, ok, -1, fail - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * - *------------------------------------------------------------------------- - */ +* Function: h5repack +* +* Purpose: locate all high-level HDF5 objects in the file +* and compress/chunk them using options +* +* Algorithm: 2 traversals are made to the file; the 1st builds a list of +* the objects, the 2nd makes a copy of them, using the options; +* the reason for the 1st traversal is to check for invalid +* object name requests +* +* Return: 0, ok, -1, fail +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September, 22, 2003 +* +*------------------------------------------------------------------------- +*/ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) @@ -81,14 +81,14 @@ int h5repack(const char* infile, /*------------------------------------------------------------------------- - * Function: h5repack_init - * - * Purpose: initialize options - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ +* Function: h5repack_init +* +* Purpose: initialize options +* +* Return: 0, ok, -1, fail +* +*------------------------------------------------------------------------- +*/ int h5repack_init (pack_opt_t *options, int verbose) @@ -110,12 +110,12 @@ int h5repack_init (pack_opt_t *options, } /*------------------------------------------------------------------------- - * Function: h5repack_end - * - * Purpose: free options table - * - *------------------------------------------------------------------------- - */ +* Function: h5repack_end +* +* Purpose: free options table +* +*------------------------------------------------------------------------- +*/ int h5repack_end (pack_opt_t *options) { @@ -123,15 +123,15 @@ int h5repack_end (pack_opt_t *options) } /*------------------------------------------------------------------------- - * Function: h5repack_addfilter - * - * Purpose: add a compression -f option to table - * Example: -f dset:GZIP=6 - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ +* Function: h5repack_addfilter +* +* Purpose: add a compression -f option to table +* Example: -f dset:GZIP=6 +* +* Return: 0, ok, -1, fail +* +*------------------------------------------------------------------------- +*/ int h5repack_addfilter(const char* str, pack_opt_t *options) @@ -177,14 +177,14 @@ int h5repack_addfilter(const char* str, /*------------------------------------------------------------------------- - * Function: h5repack_addlayout - * - * Purpose: add a layout option - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ +* Function: h5repack_addlayout +* +* Purpose: add a layout option +* +* Return: 0, ok, -1, fail +* +*------------------------------------------------------------------------- +*/ int h5repack_addlayout(const char* str, @@ -199,9 +199,9 @@ int h5repack_addlayout(const char* str, init_packobject(&pack); if (options->all_layout==1){ - error_msg(progname, "invalid layout input: 'all' option \ - is present with other objects <%s>\n",str); - return -1; + error_msg(progname, "invalid layout input: 'all' option \ + is present with other objects <%s>\n",str); + return -1; } /* parse the layout option */ @@ -215,7 +215,7 @@ int h5repack_addlayout(const char* str, options->layout_g=pack.layout; if (pack.layout==H5D_CHUNKED) { - /* -2 means the NONE option, remove chunking + /* -2 means the NONE option, remove chunking and set the global layout to contiguous */ if (pack.chunk.rank==-2) { @@ -243,22 +243,22 @@ int h5repack_addlayout(const char* str, /*------------------------------------------------------------------------- - * Function: check_options - * - * Purpose: print options, checks for invalid options - * - * Return: void, return -1 on error - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * - * Modification: - * Peter Cao, July 9, 2007 - * Add "-L, --latest" and other options to pack a file with the latest file format - * - *------------------------------------------------------------------------- - */ +* Function: check_options +* +* Purpose: print options, checks for invalid options +* +* Return: void, return -1 on error +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September, 22, 2003 +* +* Modification: +* Peter Cao, July 9, 2007 +* Add "-L, --latest" and other options to pack a file with the latest file format +* +*------------------------------------------------------------------------- +*/ static int check_options(pack_opt_t *options) { unsigned int i; @@ -272,7 +272,8 @@ static int check_options(pack_opt_t *options) if (options->verbose && have_request(options) /* only print if requested */) { printf("Objects to modify layout are...\n"); - if (options->all_layout==1) { + if (options->all_layout==1) + { switch (options->layout_g) { case H5D_COMPACT: @@ -284,12 +285,17 @@ static int check_options(pack_opt_t *options) case H5D_CHUNKED: strcpy(slayout,"chunked"); break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + error_msg(progname, "invalid layout\n"); + return -1; default: - strcpy(slayout,"unknown"); - break; + strcpy(slayout,"invalid layout\n"); + return -1; } printf(" Apply %s layout to all\n", slayout); - if (H5D_CHUNKED==options->layout_g) { + if (H5D_CHUNKED==options->layout_g) + { printf("with dimension ["); for ( j = 0; j < options->chunk_g.rank; j++) printf("%d ",(int)options->chunk_g.chunk_lengths[j]); @@ -322,9 +328,9 @@ static int check_options(pack_opt_t *options) if (options->all_layout==1 && has_ck) { - error_msg(progname, "invalid chunking input: 'all' option\ - is present with other objects\n"); - return -1; + error_msg(progname, "invalid chunking input: 'all' option\ + is present with other objects\n"); + return -1; } /*------------------------------------------------------------------------- @@ -356,6 +362,8 @@ static int check_options(pack_opt_t *options) get_sfilter(filtn), options->filter_g[k].cd_values[0]); break; + default: + break; } /* k */ }; } @@ -382,9 +390,9 @@ static int check_options(pack_opt_t *options) if (options->all_filter==1 && has_cp) { - error_msg(progname, "invalid compression input: 'all' option\ - is present with other objects\n"); - return -1; + error_msg(progname, "invalid compression input: 'all' option\ + is present with other objects\n"); + return -1; } /*------------------------------------------------------------------------- @@ -455,19 +463,19 @@ static int check_options(pack_opt_t *options) /*------------------------------------------------------------------------- - * Function: check_objects - * - * Purpose: locate all HDF5 objects in the file and compare with user - * supplied list - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: September, 23, 2003 - * - *------------------------------------------------------------------------- - */ +* Function: check_objects +* +* Purpose: locate all HDF5 objects in the file and compare with user +* supplied list +* +* Return: 0, ok, -1 no +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: September, 23, 2003 +* +*------------------------------------------------------------------------- +*/ static int check_objects(const char* fname, pack_opt_t *options) { @@ -480,9 +488,9 @@ static int check_objects(const char* fname, return 0; /*------------------------------------------------------------------------- - * open the file - *------------------------------------------------------------------------- - */ + * open the file + *------------------------------------------------------------------------- + */ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) { printf("<%s>: %s\n", fname, H5FOPENERROR ); @@ -490,9 +498,9 @@ static int check_objects(const char* fname, } /*------------------------------------------------------------------------- - * get the list of objects in the file - *------------------------------------------------------------------------- - */ + * get the list of objects in the file + *------------------------------------------------------------------------- + */ /* init table */ trav_table_init(&travt); @@ -502,9 +510,9 @@ static int check_objects(const char* fname, goto out; /*------------------------------------------------------------------------- - * compare with user supplied list - *------------------------------------------------------------------------- - */ + * compare with user supplied list + *------------------------------------------------------------------------- + */ if(options->verbose) printf("Opening file <%s>. Searching for objects to modify...\n", fname); @@ -529,7 +537,7 @@ static int check_objects(const char* fname, switch(options->op_tbl->objs[i].filter->filtn) { /* chunk size must be smaller than pixels per block */ - case H5Z_FILTER_SZIP: + case H5Z_FILTER_SZIP: { int j; hsize_t csize = 1; @@ -568,10 +576,12 @@ static int check_objects(const char* fname, } } break; + default: + break; } } /* i */ - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ @@ -590,16 +600,16 @@ out: /*------------------------------------------------------------------------- - * Function: have_request - * - * Purpose: check if a filter or layout was requested - * - * Return: 1 yes, 0 no - * - * Date: May, 24, 2007 - * - *------------------------------------------------------------------------- - */ +* Function: have_request +* +* Purpose: check if a filter or layout was requested +* +* Return: 1 yes, 0 no +* +* Date: May, 24, 2007 +* +*------------------------------------------------------------------------- +*/ static int have_request(pack_opt_t *options) { @@ -612,14 +622,14 @@ static int have_request(pack_opt_t *options) /*------------------------------------------------------------------------- - * Function: get_sfilter - * - * Purpose: return the filter as a string name - * - * Return: name of filter, exit on error - * - *------------------------------------------------------------------------- - */ +* Function: get_sfilter +* +* Purpose: return the filter as a string name +* +* Return: name of filter, exit on error +* +*------------------------------------------------------------------------- +*/ static const char* get_sfilter(H5Z_filter_t filtn) { @@ -641,6 +651,5 @@ static const char* get_sfilter(H5Z_filter_t filtn) error_msg(progname, "input error in filter type\n"); exit(1); } - return NULL; } diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index b63102b..cb3d75a 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -131,7 +131,7 @@ int h5repack_addlayout (const char* str, pack_opt_t *options); int h5repack_init (pack_opt_t *options, int verbose); int h5repack_end (pack_opt_t *options); int h5repack_verify (const char *fname,pack_opt_t *options); -int h5repack_cmpdcpl (const char *fname1, +int h5repack_cmp_pl (const char *fname1, const char *fname2); diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index ba3bdfe..a09e8b9 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -53,6 +53,7 @@ FILE12=h5repack_nbit.h5 FILE13=h5repack_soffset.h5 FILE14=h5repack_layouto.h5 # A file with an older version of the layout message # (copy of test/tlayouto.h5) +FILE15=h5repack_named_dtypes.h5 nerrors=0 @@ -455,7 +456,10 @@ TOOLTEST $FILE4 -l dset_chunk:CONTI TOOLTEST $FILE4 -l dset_chunk:CHUNK=18x13 # Native option -TOOLTEST $FILE1 -n +# Do not use FILE1, as the named dtype will be converted to native, and h5diff will +# report a difference. +TOOLTEST $FILE0 -n +TOOLTEST $FILE2 -n # latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters) @@ -504,6 +508,12 @@ TOOLTEST $arg # to new version and be readable, etc.) TOOLTEST $FILE14 +# test for datum size > H5TOOLS_MALLOCSIZE +TOOLTEST $FILE1 -f GZIP=1 + +# Check repacking file with committed datatypes in odd configurations +TOOLTEST $FILE15 + if test $nerrors -eq 0 ; then echo "All $H5REPACK tests passed." fi diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index b165dc7..73f57e3 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * +* the files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +* access to either file, you may request a copy from help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <stdlib.h> #include <string.h> @@ -21,50 +21,67 @@ #include "h5tools.h" #include "h5tools_utils.h" -extern char *progname; +/*------------------------------------------------------------------------- +* typedefs +*------------------------------------------------------------------------- +*/ +typedef struct named_dt_t { + haddr_t addr_in; /* Address of the named dtype in the in file */ + hid_t id_out; /* Open identifier for the dtype in the out file */ + struct named_dt_t *next; /* Next dtype */ +} named_dt_t; +/*------------------------------------------------------------------------- +* globals +*------------------------------------------------------------------------- +*/ +extern char *progname; /*------------------------------------------------------------------------- - * macros - *------------------------------------------------------------------------- - */ +* macros +*------------------------------------------------------------------------- +*/ #define USERBLOCK_XFER_SIZE 512 /* size of buffer/# of bytes to xfer at a time when copying userblock */ /*------------------------------------------------------------------------- - * local functions - *------------------------------------------------------------------------- - */ +* local functions +*------------------------------------------------------------------------- +*/ static void print_dataset_info(hid_t dcpl_id,char *objname,double per, int pr); static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options); -static int copy_attr(hid_t loc_in,hid_t loc_out,pack_opt_t *options); +static int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, + trav_table_t *travt, pack_opt_t *options); +static hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, + trav_table_t *travt, pack_opt_t *options); +static int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err); static int copy_user_block(const char *infile, const char *outfile, hsize_t size); #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif /*------------------------------------------------------------------------- - * Function: copy_objects - * - * Purpose: duplicate all HDF5 objects in the file - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 23, 2003 - * - * Modification: - * Peter Cao, June 13, 2007 - * Add "-L, --latest" and other options to pack a file with the latest file format - * - * Peter Cao, September 25, 2007 - * Copy user block when repacking a file - * - * Pedro Vicente, August 20, 2008 - * Add a user block to file if requested - * - *------------------------------------------------------------------------- - */ +* Function: copy_objects +* +* Purpose: duplicate all HDF5 objects in the file +* +* Return: 0, ok, -1 no +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: October, 23, 2003 +* +* Modification: +* Peter Cao, June 13, 2007 +* Add "-L, --latest" and other options to pack a file with the latest file format +* +* Peter Cao, September 25, 2007 +* Copy user block when repacking a file +* +* Pedro Vicente, August 20, 2008 +* Add a user block to file if requested +* +*------------------------------------------------------------------------- +*/ int copy_objects(const char* fnamein, const char* fnameout, @@ -90,19 +107,19 @@ int copy_objects(const char* fnamein, /* get user block size */ { hid_t fcpl_in; /* file creation property list ID for input file */ - + if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { error_msg(progname, "failed to retrieve file creation property list\n"); goto out; } - + if(H5Pget_userblock(fcpl_in, &ub_size) < 0) { error_msg(progname, "failed to retrieve userblock size\n"); goto out; } - + if(H5Pclose(fcpl_in) < 0) { error_msg(progname, "failed to close property list\n"); @@ -147,25 +164,27 @@ int copy_objects(const char* fnamein, { switch(i) { - case 0: - mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; - break; - - case 1: - mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; - break; - - case 2: - mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; - break; - - case 3: - mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; - break; - - case 4: - mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; - break; + case 0: + mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; + break; + + case 1: + mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; + break; + + case 2: + mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; + break; + + case 3: + mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; + break; + + case 4: + mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; + break; + default: + break; } /* end switch */ min_mesg_sizes[nindex] = (unsigned)options->msg_size[i]; @@ -205,8 +224,8 @@ int copy_objects(const char* fnamein, } /* end if */ } /* end if */ } /* end if */ - - + + #if defined (H5REPACK_DEBUG_USER_BLOCK) @@ -230,30 +249,30 @@ int copy_objects(const char* fnamein, error_msg(progname, "failed to set userblock size\n"); goto out; } - + } - + else { - + /* create a file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg(progname, "fail to create a file creation property list\n"); goto out; } - + /* set user block size */ if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { error_msg(progname, "failed to set userblock size\n"); goto out; } - + } - - - + + + } @@ -262,39 +281,39 @@ int copy_objects(const char* fnamein, *------------------------------------------------------------------------- */ - + if ( options->alignment > 0 ) { /* either use the FAPL already created or create a new one */ if (fapl != H5P_DEFAULT) { - + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { error_msg(progname, "failed to set alignment\n"); goto out; } - + } - + else { - + /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg(progname, "Could not create file access property list\n"); goto out; } - + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { error_msg(progname, "failed to set alignment\n"); goto out; } - + } - + } @@ -303,18 +322,18 @@ int copy_objects(const char* fnamein, *------------------------------------------------------------------------- */ - + if(options->verbose) printf("Making file <%s>...\n",fnameout); - - + + if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) { error_msg(progname, "<%s>: Could not create file\n", fnameout ); goto out; } - + /*------------------------------------------------------------------------- * write a new user block if requested *------------------------------------------------------------------------- @@ -325,11 +344,11 @@ int copy_objects(const char* fnamein, { error_msg(progname, "Could not copy user block. Exiting...\n"); goto out; - + } } - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * get list of objects *------------------------------------------------------------------------- */ @@ -375,7 +394,7 @@ int copy_objects(const char* fnamein, H5Fclose(fidin); H5Fclose(fidout); - + /* free table */ trav_table_free(travt); travt = NULL; @@ -391,7 +410,7 @@ int copy_objects(const char* fnamein, { error_msg(progname, "Could not copy user block. Exiting...\n"); goto out; - + } } @@ -417,74 +436,74 @@ out: } /*------------------------------------------------------------------------- - * Function: do_copy_objects - * - * Purpose: duplicate all HDF5 objects in the file - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 23, 2003 - * - * Modifications: - * - * July 2004: Introduced the extra EC or NN option for SZIP - * - * December 2004: Added a check for H5Dcreate; if the dataset cannot be created - * with the requested filter, use the input one - * - * October 2006: Read/write using the file type by default. - * - * October 2006: Read by hyperslabs for big datasets. - * - * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done - * i.e., if the memory needed to read a dataset is greater than this limit, - * then hyperslab I/O is done instead of one operation I/O - * For each dataset, the memory needed is calculated according to - * - * memory needed = number of elements * size of each element - * - * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations - * are done - * - * H5Dread( input_dataset1 ) - * H5Dread( input_dataset2 ) - * - * with all elements in the datasets selected. If the memory needed is greater than - * H5TOOLS_MALLOCSIZE, then the following operations are done instead: - * - * a strip mine is defined for each dimension k (a strip mine is defined as a - * hyperslab whose size is memory manageable) according to the formula - * - * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) - * - * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures - * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip - * mine size k is simply defined as its dimension k, but for larger datasets the - * hyperslab size is still memory manageable. - * a cycle is done until the number of elements in the dataset is reached. In each - * iteration, two parameters are defined for the function H5Sselect_hyperslab, - * the start and size of each hyperslab, according to - * - * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) - * - * where hyperslab_offset [k] is initially set to zero, and later incremented in - * hyperslab_size[k] offsets. The reason for the operation - * - * dimension[k] - hyperslab_offset[k] - * - * in (2) is that, when using the strip mine size, it assures that the "remaining" part - * of the dataset that does not fill an entire strip mine is processed. - * - * November 2006: Use H5Ocopy in the copy of objects. The logic for using - * H5Ocopy or not is if a change of filters or layout is requested by the user - * then use read/write else use H5Ocopy. - * - * May, 1, 2008: Add a printing of the compression ratio of old size / new size - * - *------------------------------------------------------------------------- - */ +* Function: do_copy_objects +* +* Purpose: duplicate all HDF5 objects in the file +* +* Return: 0, ok, -1 no +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: October, 23, 2003 +* +* Modifications: +* +* July 2004: Introduced the extra EC or NN option for SZIP +* +* December 2004: Added a check for H5Dcreate; if the dataset cannot be created +* with the requested filter, use the input one +* +* October 2006: Read/write using the file type by default. +* +* October 2006: Read by hyperslabs for big datasets. +* +* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done +* i.e., if the memory needed to read a dataset is greater than this limit, +* then hyperslab I/O is done instead of one operation I/O +* For each dataset, the memory needed is calculated according to +* +* memory needed = number of elements * size of each element +* +* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations +* are done +* +* H5Dread( input_dataset1 ) +* H5Dread( input_dataset2 ) +* +* with all elements in the datasets selected. If the memory needed is greater than +* H5TOOLS_MALLOCSIZE, then the following operations are done instead: +* +* a strip mine is defined for each dimension k (a strip mine is defined as a +* hyperslab whose size is memory manageable) according to the formula +* +* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) +* +* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures +* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip +* mine size k is simply defined as its dimension k, but for larger datasets the +* hyperslab size is still memory manageable. +* a cycle is done until the number of elements in the dataset is reached. In each +* iteration, two parameters are defined for the function H5Sselect_hyperslab, +* the start and size of each hyperslab, according to +* +* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) +* +* where hyperslab_offset [k] is initially set to zero, and later incremented in +* hyperslab_size[k] offsets. The reason for the operation +* +* dimension[k] - hyperslab_offset[k] +* +* in (2) is that, when using the strip mine size, it assures that the "remaining" part +* of the dataset that does not fill an entire strip mine is processed. +* +* November 2006: Use H5Ocopy in the copy of objects. The logic for using +* H5Ocopy or not is if a change of filters or layout is requested by the user +* then use read/write else use H5Ocopy. +* +* May, 1, 2008: Add a printing of the compression ratio of old size / new size +* +*------------------------------------------------------------------------- +*/ int do_copy_objects(hid_t fidin, hid_t fidout, @@ -495,7 +514,8 @@ int do_copy_objects(hid_t fidin, hid_t grp_out=-1; /* group ID */ hid_t dset_in=-1; /* read dataset ID */ hid_t dset_out=-1; /* write dataset ID */ - hid_t gcpl_id=-1; /* group creation property list */ + hid_t gcpl_in=-1; /* group creation property list */ + hid_t gcpl_out=-1; /* group creation property list */ hid_t type_in=-1; /* named type ID */ hid_t type_out=-1; /* named type ID */ hid_t dcpl_id=-1; /* dataset creation property list ID */ @@ -503,6 +523,7 @@ int do_copy_objects(hid_t fidin, hid_t f_space_id=-1; /* file space ID */ hid_t ftype_id=-1; /* file type ID */ hid_t wtype_id=-1; /* read/write type ID */ + named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes copied */ size_t msize; /* size of type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ @@ -515,9 +536,11 @@ int do_copy_objects(hid_t fidin, void *sm_buf=NULL; /* buffer for raw data */ int has_filter; /* current object has a filter */ int req_filter; /* there was a request for a filter */ + unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; int is_ref=0; + htri_t is_named; /*------------------------------------------------------------------------- * copy the suppplied object list @@ -537,506 +560,548 @@ int do_copy_objects(hid_t fidin, buf = NULL; switch ( travt->objs[i].type ) { + + case H5TRAV_TYPE_UNKNOWN: + assert(0); + break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_GROUP: - if (options->verbose) - printf(FORMAT_OBJ,"group",travt->objs[i].name ); + * H5TRAV_TYPE_GROUP + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_GROUP: - /*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group - * and copy its attributes using that ID - *------------------------------------------------------------------------- - */ - if(HDstrcmp(travt->objs[i].name, "/") == 0) - { - if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) - goto error; - } - else if (options->grp_compact>0 || options->grp_indexed>0) - { - /* Set up group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto error; + if (options->verbose) + { + printf(FORMAT_OBJ,"group",travt->objs[i].name ); + } - if(H5Pset_link_phase_change(gcpl_id, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) - goto error; + /* open input group */ + if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; - if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) - goto error; - } - else - { - if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - } + /* get input group creation property list */ + if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) + goto error; - if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; + /* query and set the group creation properties */ + if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) + goto error; - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if(copy_attr(grp_in,grp_out,options) < 0) + /* set up group creation property list */ + if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + + if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) + goto error; + + + /*------------------------------------------------------------------------- + * the root is a special case, we get an ID for the root group + * and copy its attributes using that ID + *------------------------------------------------------------------------- + */ + if(HDstrcmp(travt->objs[i].name, "/") == 0) + { + if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) goto error; + } + + else + { - if(gcpl_id > 0) { - if(H5Pclose(gcpl_id) < 0) + if (options->grp_compact>0 || options->grp_indexed>0) + { + if(H5Pset_link_phase_change(gcpl_out, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) goto error; } - if(H5Gclose(grp_out) < 0) - goto error; - if(H5Gclose(grp_in) < 0) + + if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) goto error; - break; + } + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if(copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) + goto error; + + + if(H5Pclose(gcpl_out) < 0) + goto error; + if(H5Pclose(gcpl_in) < 0) + goto error; + if(H5Gclose(grp_out) < 0) + goto error; + if(H5Gclose(grp_in) < 0) + goto error; + + break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_DATASET: + * H5TRAV_TYPE_DATASET + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_DATASET: + + has_filter = 0; + req_filter = 0; - has_filter = 0; - req_filter = 0; + /* check if global filters were requested */ + if ( options->n_filter_g ) + req_filter = 1; - /* check if global filters were requested */ - if ( options->n_filter_g ) - req_filter = 1; + /* check if filters were requested for individual objects */ + for( u = 0; u < options->op_tbl->nelems; u++) + { + int k; - /* check if filters were requested for individual objects */ - for( u = 0; u < options->op_tbl->nelems; u++) + for( k = 0; k < options->op_tbl->objs[u].nfilters; k++) { - int k; - - for( k = 0; k < options->op_tbl->objs[u].nfilters; k++) + if ( options->op_tbl->objs[u].filter->filtn > 0 ) { - if ( options->op_tbl->objs[u].filter->filtn > 0 ) - { - - req_filter = 1; - - } - + + req_filter = 1; + } + } + } + + /* early detection of references */ + if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if((ftype_id = H5Dget_type(dset_in)) < 0) + goto error; + if(H5T_REFERENCE == H5Tget_class(ftype_id)) + is_ref = 1; + + /* Check if the datatype is committed */ + if((is_named = H5Tcommitted(ftype_id)) < 0) + goto error; + if(is_named) + if((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) + goto error; + + if(H5Tclose(ftype_id) < 0) + goto error; + if(H5Dclose(dset_in) < 0) + goto error; + + + /*------------------------------------------------------------------------- + * check if we should use H5Ocopy or not + * if there is a request for filters/layout, we read/write the object + * otherwise we do a copy using H5Ocopy + *------------------------------------------------------------------------- + */ + if ( options->op_tbl->nelems || + options->all_filter == 1 || + options->all_layout == 1 || + is_ref || + is_named) + { + + int j; - /* early detection of references */ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; + if((f_space_id = H5Dget_space(dset_in)) < 0) + goto error; if((ftype_id = H5Dget_type(dset_in)) < 0) goto error; - if(H5T_REFERENCE == H5Tget_class(ftype_id)) - is_ref = 1; - if(H5Tclose(ftype_id) < 0) + if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) goto error; - if(H5Dclose(dset_in) < 0) + if((dcpl_out = H5Pcopy(dcpl_id)) < 0) goto error; - - - /*------------------------------------------------------------------------- - * check if we should use H5Ocopy or not - * if there is a request for filters/layout, we read/write the object - * otherwise we do a copy using H5Ocopy - *------------------------------------------------------------------------- - */ - if ( options->op_tbl->nelems || - options->all_filter == 1 || - options->all_layout == 1 || - is_ref) + if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) + goto error; + HDmemset(dims, 0, sizeof dims); + if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) + goto error; + nelmts = 1; + for ( j = 0; j < rank; j++) { - - int j; - - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((f_space_id = H5Dget_space(dset_in)) < 0) - goto error; - if((ftype_id = H5Dget_type(dset_in)) < 0) - goto error; - if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) - goto error; - if((dcpl_out = H5Pcopy(dcpl_id)) < 0) - goto error; - if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - goto error; - HDmemset(dims, 0, sizeof dims); - if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - goto error; - nelmts = 1; - for ( j = 0; j < rank; j++) - { - nelmts *= dims[j]; - } + nelmts *= dims[j]; + } + /* wtype_id will have already been set if using a named dtype */ + if(!is_named) { if(options->use_native == 1) wtype_id = h5tools_get_native_type(ftype_id); else - wtype_id = H5Tcopy(ftype_id); + wtype_id = H5Tcopy(ftype_id); + } /* end if */ + + if((msize = H5Tget_size(wtype_id)) == 0) + goto error; + + /*------------------------------------------------------------------------- + * check if the dataset creation property list has filters that + * are not registered in the current configuration + * 1) the external filters GZIP and SZIP might not be available + * 2) the internal filters might be turned off + *------------------------------------------------------------------------- + */ + if (h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) + { + apply_s=1; + apply_f=1; - if((msize = H5Tget_size(wtype_id)) == 0) - goto error; - /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration - * 1) the external filters GZIP and SZIP might not be available - * 2) the internal filters might be turned off - *------------------------------------------------------------------------- - */ - if (h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) + * references are a special case + * we cannot just copy the buffers, but instead we recreate the reference + * in a second traversal of the output file + *------------------------------------------------------------------------- + */ + if (H5T_REFERENCE!=H5Tget_class(wtype_id)) { - apply_s=1; - apply_f=1; + /* get the storage size of the input dataset */ + dsize_in=H5Dget_storage_size(dset_in); + + /* check for datasets too small */ + if (nelmts*msize < options->min_comp ) + apply_s=0; + + /* apply the filter */ + if (apply_s) + { + if (apply_filters(travt->objs[i].name, + rank, + dims, + msize, + dcpl_out, + options, + &has_filter) < 0) + goto error; + } /*------------------------------------------------------------------------- - * references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - * in a second traversal of the output file + * create the output dataset; + * disable error checking in case the dataset cannot be created with the + * modified dcpl; in that case use the original instead *------------------------------------------------------------------------- */ - if (H5T_REFERENCE!=H5Tget_class(wtype_id)) + H5E_BEGIN_TRY { + dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); + } H5E_END_TRY; + + if(dset_out == FAIL) { - /* get the storage size of the input dataset */ - dsize_in=H5Dget_storage_size(dset_in); + if(options->verbose) + printf(" warning: could not create dataset <%s>. Applying original settings\n", + travt->objs[i].name); - /* check for datasets too small */ - if (nelmts*msize < options->min_comp ) - apply_s=0; + if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; + apply_f = 0; + } - /* apply the filter */ - if (apply_s) - { - if (apply_filters(travt->objs[i].name, - rank, - dims, - msize, - dcpl_out, - options, - &has_filter) < 0) - goto error; - } + /*------------------------------------------------------------------------- + * read/write + *------------------------------------------------------------------------- + */ + if (nelmts) + { + size_t need = (size_t)(nelmts*msize); /* bytes needed */ + if ( need < H5TOOLS_MALLOCSIZE ) + buf = HDmalloc(need); - /*------------------------------------------------------------------------- - * create the output dataset; - * disable error checking in case the dataset cannot be created with the - * modified dcpl; in that case use the original instead - *------------------------------------------------------------------------- - */ - H5E_BEGIN_TRY { - dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); - } H5E_END_TRY; - - if(dset_out == FAIL) + if (buf != NULL ) { - if(options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", - travt->objs[i].name); - - if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) goto error; - apply_f = 0; - } + if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) + goto error; + } - /*------------------------------------------------------------------------- - * read/write - *------------------------------------------------------------------------- - */ - if (nelmts) + else /* possibly not enough memory, read/write by hyperslabs */ { - size_t need = (size_t)(nelmts*msize); /* bytes needed */ - if ( need < H5TOOLS_MALLOCSIZE ) - buf = HDmalloc(need); + size_t p_type_nbytes = msize; /*size of memory type */ + hsize_t p_nelmts = nelmts; /*total selected elmts */ + hsize_t elmtno; /*counter */ + int carry; /*counter carry value */ + unsigned int vl_data = 0; /*contains VL datatypes */ + + /* stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ + hsize_t sm_nbytes; /*bytes per stripmine */ + hsize_t sm_nelmts; /*elements per stripmine*/ + hid_t sm_space; /*stripmine data space */ + + /* hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ + hsize_t hs_nelmts; /*elements in request */ + hsize_t zero[8]; /*vector of zeros */ + int k; + + /* check if we have VL data in the dataset's datatype */ + if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* + * determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes; - if (buf != NULL ) + for (k = rank; k > 0; --k) { - if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) - goto error; - if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) - goto error; - } + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[k - 1] = MIN(dims[k - 1], size); + sm_nbytes *= sm_size[k - 1]; + assert(sm_nbytes > 0); + } + sm_buf = HDmalloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + /* the stripmine loop */ + memset(hs_offset, 0, sizeof hs_offset); + memset(zero, 0, sizeof zero); - else /* possibly not enough memory, read/write by hyperslabs */ + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { - size_t p_type_nbytes = msize; /*size of memory type */ - hsize_t p_nelmts = nelmts; /*total selected elmts */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ - unsigned int vl_data = 0; /*contains VL datatypes */ - - /* stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ - hsize_t sm_nbytes; /*bytes per stripmine */ - hsize_t sm_nelmts; /*elements per stripmine*/ - hid_t sm_space; /*stripmine data space */ - - /* hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ - hsize_t hs_nelmts; /*elements in request */ - hsize_t zero[8]; /*vector of zeros */ - int k; - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* - * determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ - sm_nbytes = p_type_nbytes; - - for (k = rank; k > 0; --k) { - sm_size[k - 1] = MIN(dims[k - 1], H5TOOLS_BUFSIZE / sm_nbytes); - sm_nbytes *= sm_size[k - 1]; - assert(sm_nbytes > 0); - } - sm_buf = HDmalloc((size_t)sm_nbytes); - - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - - /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + /* calculate the hyperslab size */ + if (rank > 0) { - /* calculate the hyperslab size */ - if (rank > 0) + for (k = 0, hs_nelmts = 1; k < rank; k++) { - for (k = 0, hs_nelmts = 1; k < rank; k++) - { - hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); - hs_nelmts *= hs_size[k]; - } - - if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - goto error; - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - goto error; - } - else - { - H5Sselect_all(f_space_id); - H5Sselect_all(sm_space); - hs_nelmts = 1; - } /* rank */ + hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); + hs_nelmts *= hs_size[k]; + } - /* read/write */ - if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) goto error; - if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; + } + else + { + H5Sselect_all(f_space_id); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } /* rank */ + + /* read/write */ + if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + goto error; + if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + goto error; - /* reclaim any VL memory, if necessary */ - if(vl_data) - H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); + /* reclaim any VL memory, if necessary */ + if(vl_data) + H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); - /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; --k) - { - hs_offset[k - 1] += hs_size[k - 1]; - if (hs_offset[k - 1] == dims[k - 1]) - hs_offset[k - 1] = 0; - else - carry = 0; - } /* k */ - } /* elmtno */ - - H5Sclose(sm_space); - /* free */ - if (sm_buf!=NULL) + /* calculate the next hyperslab offset */ + for (k = rank, carry = 1; k > 0 && carry; --k) { - HDfree(sm_buf); - sm_buf=NULL; - } - } /* hyperslab read */ - }/*nelmts*/ - - /*------------------------------------------------------------------------- - * amount of compression used - *------------------------------------------------------------------------- - */ - if (options->verbose) + hs_offset[k - 1] += hs_size[k - 1]; + if (hs_offset[k - 1] == dims[k - 1]) + hs_offset[k - 1] = 0; + else + carry = 0; + } /* k */ + } /* elmtno */ + + H5Sclose(sm_space); + /* free */ + if (sm_buf!=NULL) + { + HDfree(sm_buf); + sm_buf=NULL; + } + } /* hyperslab read */ + }/*nelmts*/ + + /*------------------------------------------------------------------------- + * amount of compression used + *------------------------------------------------------------------------- + */ + if (options->verbose) + { + double ratio=0; + + /* only print the compression ration if there was a filter request */ + if (apply_s && apply_f && req_filter) { - double ratio=0; + hssize_t a, b; - /* only print the compression ration if there was a filter request */ - if (apply_s && apply_f && req_filter) - { - hssize_t a, b; + /* get the storage size of the output dataset */ + dsize_out=H5Dget_storage_size(dset_out); - /* get the storage size of the output dataset */ - dsize_out=H5Dget_storage_size(dset_out); + /* compression ratio = uncompressed size / compressed size */ - /* compression ratio = uncompressed size / compressed size */ + a = dsize_in; b = dsize_out; + if (b!=0) + ratio = (double) a / (double) b; - a = dsize_in; b = dsize_out; - if (b!=0) - ratio = (double) a / (double) b; - - print_dataset_info(dcpl_out,travt->objs[i].name,ratio,1); - } - else - print_dataset_info(dcpl_id,travt->objs[i].name,ratio,0); + print_dataset_info(dcpl_out,travt->objs[i].name,ratio,1); + } + else + print_dataset_info(dcpl_id,travt->objs[i].name,ratio,0); - /* print a message that the filter was not applied - (in case there was a filter) - */ - if ( has_filter && apply_s == 0 ) - printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", - travt->objs[i].name, - (int)options->min_comp); - - if ( has_filter && apply_f == 0 ) - printf(" <warning: could not apply the filter to %s>\n", - travt->objs[i].name); - - } /* verbose */ - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(dset_in,dset_out,options) < 0) - goto error; + /* print a message that the filter was not applied + (in case there was a filter) + */ + if ( has_filter && apply_s == 0 ) + printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", + travt->objs[i].name, + (int)options->min_comp); - /*close */ - if (H5Dclose(dset_out) < 0) - goto error; + if ( has_filter && apply_f == 0 ) + printf(" <warning: could not apply the filter to %s>\n", + travt->objs[i].name); - }/*!H5T_REFERENCE*/ - }/*h5tools_canreadf*/ + } /* verbose */ + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) + goto error; + + /*close */ + if (H5Dclose(dset_out) < 0) + goto error; + + }/*!H5T_REFERENCE*/ + }/*h5tools_canreadf*/ - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if (H5Tclose(ftype_id) < 0) - goto error; - if (H5Tclose(wtype_id) < 0) - goto error; - if (H5Pclose(dcpl_id) < 0) - goto error; - if (H5Pclose(dcpl_out) < 0) - goto error; - if (H5Sclose(f_space_id) < 0) - goto error; - if (H5Dclose(dset_in) < 0) - goto error; - } /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead - *------------------------------------------------------------------------- - */ - else - { - hid_t pid; + * close + *------------------------------------------------------------------------- + */ + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Tclose(wtype_id) < 0) + goto error; + if (H5Pclose(dcpl_id) < 0) + goto error; + if (H5Pclose(dcpl_out) < 0) + goto error; + if (H5Sclose(f_space_id) < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; - /* create property to pass copy options */ - if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - goto error; + } + /*------------------------------------------------------------------------- + * we do not have request for filter/chunking use H5Ocopy instead + *------------------------------------------------------------------------- + */ + else + { + hid_t pid; - /* set options for object copy */ - if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - goto error; + /* create property to pass copy options */ + if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + goto error; - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - - if(H5Ocopy(fidin, /* Source file or group identifier */ - travt->objs[i].name, /* Name of the source object to be copied */ - fidout, /* Destination file or group identifier */ - travt->objs[i].name, /* Name of the destination object */ - pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - goto error; + /* set options for object copy */ + if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + goto error; - /* close property */ - if(H5Pclose(pid) < 0) - goto error; + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + + if(H5Ocopy(fidin, /* Source file or group identifier */ + travt->objs[i].name, /* Name of the source object to be copied */ + fidout, /* Destination file or group identifier */ + travt->objs[i].name, /* Name of the destination object */ + pid, /* Properties which apply to the copy */ + H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ + goto error; + /* close property */ + if(H5Pclose(pid) < 0) + goto error; + + + /*------------------------------------------------------------------------- + * copy attrs manually + *------------------------------------------------------------------------- + */ + if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) + goto error; + if(H5Dclose(dset_in) < 0) + goto error; + if(H5Dclose(dset_out) < 0) + goto error; - /*------------------------------------------------------------------------- - * copy attrs manually - *------------------------------------------------------------------------- - */ - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if(copy_attr(dset_in, dset_out, options) < 0) - goto error; - if(H5Dclose(dset_in) < 0) - goto error; - if(H5Dclose(dset_out) < 0) - goto error; + if (options->verbose) + printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - if (options->verbose) - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - - } /* end do we have request for filter/chunking */ + } /* end do we have request for filter/chunking */ - break; + break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_NAMED_DATATYPE: + * H5TRAV_TYPE_NAMED_DATATYPE + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_NAMED_DATATYPE: - if(options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); + if(options->verbose) + printf(FORMAT_OBJ, "type", travt->objs[i].name); - if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; + if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; - if((type_out = H5Tcopy(type_in)) < 0) - goto error; + /* Copy the datatype anonymously */ + if((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, + travt, options)) < 0) + goto error; - if((H5Tcommit2(fidout, travt->objs[i].name, type_out, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + /* Link in to group structure */ + if(H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, + H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if(copy_attr(type_in, type_out, options) < 0) - goto error; + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if(copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) + goto error; - if(H5Tclose(type_in) < 0) - goto error; - if(H5Tclose(type_out) < 0) - goto error; + if(H5Tclose(type_in) < 0) + goto error; + if(H5Tclose(type_out) < 0) + goto error; - - break; + + break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_LINK - * H5TRAV_TYPE_UDLINK - * - * Only handles external links; H5Lcopy will fail for other UD link types - * since we don't have creation or copy callbacks for them. - *------------------------------------------------------------------------- - */ - - case H5TRAV_TYPE_LINK: - case H5TRAV_TYPE_UDLINK: + * H5TRAV_TYPE_LINK + * H5TRAV_TYPE_UDLINK + * + * Only handles external links; H5Lcopy will fail for other UD link types + * since we don't have creation or copy callbacks for them. + *------------------------------------------------------------------------- + */ + + case H5TRAV_TYPE_LINK: + case H5TRAV_TYPE_UDLINK: { if(options->verbose) @@ -1051,8 +1116,8 @@ int do_copy_objects(hid_t fidin, } break; - default: - goto error; + default: + goto error; } /* switch */ /* free */ @@ -1064,6 +1129,9 @@ int do_copy_objects(hid_t fidin, } /* i */ + /* Finalize (link) the stack of named datatypes (if any) */ + named_datatype_free(&named_dt_head, 0); + return 0; error: @@ -1071,7 +1139,8 @@ error: H5Gclose(grp_in); H5Gclose(grp_out); H5Pclose(dcpl_id); - H5Pclose(gcpl_id); + H5Pclose(gcpl_in); + H5Pclose(gcpl_out); H5Sclose(f_space_id); H5Dclose(dset_in); H5Dclose(dset_out); @@ -1079,6 +1148,7 @@ error: H5Tclose(wtype_id); H5Tclose(type_in); H5Tclose(type_out); + named_datatype_free(&named_dt_head, 1); } H5E_END_TRY; /* free */ if (buf!=NULL) @@ -1090,24 +1160,26 @@ error: /*------------------------------------------------------------------------- - * Function: copy_attr - * - * Purpose: copy attributes located in LOC_IN, which is obtained either from - * loc_id = H5Gopen2( fid, name); - * loc_id = H5Dopen2( fid, name); - * loc_id = H5Topen2( fid, name); - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 28, 2003 - * - *------------------------------------------------------------------------- - */ +* Function: copy_attr +* +* Purpose: copy attributes located in LOC_IN, which is obtained either from +* loc_id = H5Gopen2( fid, name); +* loc_id = H5Dopen2( fid, name); +* loc_id = H5Topen2( fid, name); +* +* Return: 0, ok, -1 no +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: October, 28, 2003 +* +*------------------------------------------------------------------------- +*/ int copy_attr(hid_t loc_in, hid_t loc_out, + named_dt_t **named_dt_head_p, + trav_table_t *travt, pack_opt_t *options ) { @@ -1120,76 +1192,101 @@ int copy_attr(hid_t loc_in, void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ + htri_t is_named; /* Whether the datatype is named */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ char name[255]; H5O_info_t oinfo; /* object info */ int j; unsigned u; - + if(H5Oget_info(loc_in, &oinfo) < 0) goto error; - - /*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * copy all attributes *------------------------------------------------------------------------- */ - + for ( u = 0; u < (unsigned)oinfo.num_attrs; u++) { - + buf=NULL; - + /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - + /* get name */ if (H5Aget_name( attr_id, (size_t)255, name ) < 0) goto error; - + /* get the file datatype */ if ((ftype_id = H5Aget_type( attr_id )) < 0 ) goto error; - + + /* Check if the datatype is committed */ + if((is_named = H5Tcommitted(ftype_id)) < 0) + goto error; + if(is_named) { + hid_t fidout; + + /* Create out file id */ + if((fidout = H5Iget_file_id(loc_out)) < 0) + goto error; + + /* Copy named dt */ + if((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, + travt, options)) < 0) { + H5Fclose(fidout); + goto error; + } /* end if */ + + if(H5Fclose(fidout) < 0) + goto error; + } /* end if */ + /* get the dataspace handle */ if ((space_id = H5Aget_space( attr_id )) < 0 ) goto error; - + /* get dimensions */ if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 ) goto error; - + nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - - if (options->use_native==1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - + + /* wtype_id will have already been set if using a named dtype */ + if(!is_named) { + if (options->use_native==1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end if */ + if ((msize=H5Tget_size(wtype_id))==0) goto error; - - /*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * object references are a special case * we cannot just copy the buffers, but instead we recreate the reference * this is done on a second sweep of the file that just copies * the referenced objects *------------------------------------------------------------------------- */ - + if (H5T_REFERENCE==H5Tget_class(wtype_id)) { ; } else { - /*------------------------------------------------------------------------- - * read to memory - *------------------------------------------------------------------------- - */ - + /*------------------------------------------------------------------------- + * read to memory + *------------------------------------------------------------------------- + */ + buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { error_msg(progname, "cannot read into memory\n" ); @@ -1197,46 +1294,46 @@ int copy_attr(hid_t loc_in, } if(H5Aread(attr_id, wtype_id, buf) < 0) goto error; - - /*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * copy *------------------------------------------------------------------------- */ - - if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) + + if((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Awrite(attr_out, wtype_id, buf) < 0) goto error; - + /*close*/ if(H5Aclose(attr_out) < 0) goto error; - - + + if(buf) free(buf); - + } /*H5T_REFERENCE*/ - - + + if(options->verbose) printf(FORMAT_OBJ_ATTR, "attr", name); - + /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - + * close + *------------------------------------------------------------------------- + */ + if (H5Tclose(ftype_id) < 0) goto error; if (H5Tclose(wtype_id) < 0) goto error; if (H5Sclose(space_id) < 0) goto error; if (H5Aclose(attr_id) < 0) goto error; - + } /* u */ - - + + return 0; - + error: H5E_BEGIN_TRY { H5Tclose(ftype_id); @@ -1251,15 +1348,13 @@ error: } - - /*------------------------------------------------------------------------- - * Function: print_dataset_info - * - * Purpose: print name, filters, percentage compression of a dataset - * - *------------------------------------------------------------------------- - */ +* Function: print_dataset_info +* +* Purpose: print name, filters, percentage compression of a dataset +* +*------------------------------------------------------------------------- +*/ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, @@ -1276,27 +1371,27 @@ static void print_dataset_info(hid_t dcpl_id, size_t cd_nelmts; /* filter client number of values */ char f_objname[256]; /* filter objname */ int i; - - + + strcpy(strfilter,"\0"); - + /* get information about input filters */ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0) return; - + for(i = 0; i < nfilters; i++) { cd_nelmts = NELMTS(cd_values); - + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_objname), f_objname, NULL); - + switch(filtn) { default: break; - + case H5Z_FILTER_DEFLATE: strcat(strfilter,"GZIP "); - + #if defined (PRINT_DEBUG) { unsigned level=cd_values[0]; @@ -1305,10 +1400,10 @@ static void print_dataset_info(hid_t dcpl_id, } #endif break; - + case H5Z_FILTER_SZIP: strcat(strfilter,"SZIP "); - + #if defined (PRINT_DEBUG) { unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ @@ -1321,29 +1416,29 @@ static void print_dataset_info(hid_t dcpl_id, strcpy(temp,"NN) "); } strcat(strfilter,temp); - + #endif - + break; - + case H5Z_FILTER_SHUFFLE: strcat(strfilter,"SHUF "); break; - + case H5Z_FILTER_FLETCHER32: strcat(strfilter,"FLET "); break; - + case H5Z_FILTER_NBIT: strcat(strfilter,"NBIT "); break; - + case H5Z_FILTER_SCALEOFFSET: strcat(strfilter,"SCALEOFFSET "); break; } /* switch */ }/*i*/ - + if(!pr) printf(FORMAT_OBJ,"dset",objname ); else @@ -1357,19 +1452,152 @@ static void print_dataset_info(hid_t dcpl_id, } } + /*------------------------------------------------------------------------- - * Function: copy_user_block - * - * Purpose: copy user block from one file to another - * - * Return: 0, ok, -1 no - * - * Programmer: Peter Cao - * - * Date: October, 25, 2007 - * - *------------------------------------------------------------------------- - */ +* Function: copy_named_datatype +* +* Purpose: Copies the specified datatype anonymously, and returns an open +* id for that datatype in the output file. The first time this +* is called it scans every named datatype in travt into a +* private stack, afterwards it simply scans that stack. The id +* returned must be closed after it is no longer needed. +* named_datatype_free must be called before the program exits +* to free the stack. +* +* Programmer: Neil Fortner +* +* Date: April 14, 2009 +* +*------------------------------------------------------------------------- +*/ +static hid_t +copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) +{ + named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ + named_dt_t *dt_ret = NULL; /* Datatype to return */ + H5O_info_t oinfo; /* Object info of input dtype */ + hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ + + if(H5Oget_info(type_in, &oinfo) < 0) + goto error; + + if(*named_dt_head_p) { + /* Stack already exists, search for the datatype */ + while(dt && dt->addr_in != oinfo.addr) + dt = dt->next; + + dt_ret = dt; + } else { + /* Create the stack */ + size_t i; + + for(i=0; i<travt->nobjs; i++) + if(travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { + /* Push onto the stack */ + if(NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) + goto error; + dt->next = *named_dt_head_p; + *named_dt_head_p = dt; + + /* Update the address and id */ + dt->addr_in = travt->objs[i].objno; + dt->id_out = -1; + + /* Check if this type is the one requested */ + if(oinfo.addr == dt->addr_in) { + HDassert(!dt_ret); + dt_ret = dt; + } /* end if */ + } /* end if */ + } /* end else */ + + /* Handle the case that the requested datatype was not found. This is + * possible if the datatype was committed anonymously in the input file. */ + if(!dt_ret) { + /* Push the new datatype onto the stack */ + if(NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) + goto error; + dt_ret->next = *named_dt_head_p; + *named_dt_head_p = dt_ret; + + /* Update the address and id */ + dt_ret->addr_in = oinfo.addr; + dt_ret->id_out = -1; + } /* end if */ + + /* If the requested datatype does not yet exist in the output file, copy it + * anonymously */ + if(dt_ret->id_out < 0) { + if (options->use_native==1) + dt_ret->id_out = h5tools_get_native_type(type_in); + else + dt_ret->id_out = H5Tcopy(type_in); + if(dt_ret->id_out < 0) + goto error; + if(H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + } /* end if */ + + /* Set return value */ + ret_value = dt_ret->id_out; + + /* Increment the ref count on id_out, because the calling function will try + * to close it */ + if(H5Iinc_ref(ret_value) < 0) + goto error; + + return(ret_value); + +error: + return(-1); +} /* end copy_named_datatype */ + + +/*------------------------------------------------------------------------- +* Function: named_datatype_free +* +* Purpose: Frees the stack of named datatypes. +* +* Programmer: Neil Fortner +* +* Date: April 14, 2009 +* +*------------------------------------------------------------------------- +*/ +static int +named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) +{ + named_dt_t *dt = *named_dt_head_p; + + while(dt) { + /* Pop the datatype off the stack and free it */ + if(H5Tclose(dt->id_out) < 0 && !ignore_err) + goto error; + dt = dt->next; + HDfree(*named_dt_head_p); + *named_dt_head_p = dt; + } /* end while */ + + return 0; + +error: + return -1; +} /* end named_datatype_free */ + + +/*------------------------------------------------------------------------- +* Function: copy_user_block +* +* Purpose: copy user block from one file to another +* +* Return: 0, ok, -1 no +* +* Programmer: Peter Cao +* +* Date: October, 25, 2007 +* +*------------------------------------------------------------------------- +*/ static int copy_user_block(const char *infile, const char *outfile, hsize_t size) { @@ -1444,18 +1672,18 @@ done: /*------------------------------------------------------------------------- - * Function: print_user_block - * - * Purpose: print user block - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente - * - * Date: August, 20, 2008 - * - *------------------------------------------------------------------------- - */ +* Function: print_user_block +* +* Purpose: print user block +* +* Return: 0, ok, -1 no +* +* Programmer: Pedro Vicente +* +* Date: August, 20, 2008 +* +*------------------------------------------------------------------------- +*/ #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid) @@ -1472,25 +1700,25 @@ void print_user_block(const char *filename, hid_t fid) error_msg(progname, "failed to retrieve file creation property list\n"); goto done; } - + if(H5Pget_userblock(fcpl, &ub_size) < 0) { error_msg(progname, "failed to retrieve userblock size\n"); goto done; } - + if(H5Pclose(fcpl) < 0) { error_msg(progname, "failed to close property list\n"); goto done; } - + /* open file */ if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { goto done; } - + size = ub_size; /* read file */ @@ -1518,7 +1746,7 @@ void print_user_block(const char *filename, hid_t fid) goto done; } - + /* update size of userblock left to transfer */ size -= nread; } @@ -1526,7 +1754,7 @@ void print_user_block(const char *filename, hid_t fid) done: if(fh > 0) HDclose(fh); - + return; } diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 5038cbb..00d7c66 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -98,6 +98,11 @@ int aux_assign_obj(const char* name, /* object name from traverse lis for ( i=0; i<tmp.chunk.rank; i++) tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i]; break; + case H5D_LAYOUT_ERROR: + case H5D_COMPACT: + case H5D_CONTIGUOUS: + case H5D_NLAYOUTS: + break; default: break; }/*switch*/ @@ -112,6 +117,11 @@ int aux_assign_obj(const char* name, /* object name from traverse lis for ( i=0; i<tmp.chunk.rank; i++) tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i]; break; + case H5D_LAYOUT_ERROR: + case H5D_COMPACT: + case H5D_CONTIGUOUS: + case H5D_NLAYOUTS: + break; default: break; }/*switch*/ @@ -163,6 +173,11 @@ int aux_assign_obj(const char* name, /* object name from traverse lis for ( i=0; i<tmp.chunk.rank; i++) tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i]; break; + case H5D_LAYOUT_ERROR: + case H5D_COMPACT: + case H5D_CONTIGUOUS: + case H5D_NLAYOUTS: + break; default: break; }/*switch*/ @@ -296,14 +311,19 @@ int apply_filters(const char* name, /* object name from traverse list */ * determine the strip mine size. The strip mine is * a hyperslab whose size is manageable. */ + + sm_nbytes = msize; for ( i = rank; i > 0; --i) { - sm_size[i - 1] = MIN(dims[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(dims[i - 1], size); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); - + } for ( i = 0; i < rank; i++) diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index d684da8..154d6e5 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -95,7 +95,7 @@ obj_list_t* parse_filter(const char *str, } n++; - obj_list = malloc(n*sizeof(obj_list_t)); + obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { error_msg(progname, "could not allocate object list\n"); @@ -446,6 +446,8 @@ obj_list_t* parse_filter(const char *str, exit(1); } break; + default: + break; }; @@ -514,7 +516,7 @@ obj_list_t* parse_layout(const char *str, } n++; - obj_list=malloc(n*sizeof(obj_list_t)); + obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { error_msg(progname, "could not allocate object list\n"); diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 82e8250..cd725cd 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -74,7 +74,8 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ for(i = 0; i < travt->nobjs; i++) { - switch(travt->objs[i].type) { + switch(travt->objs[i].type) + { /*------------------------------------------------------------------------- * H5TRAV_TYPE_GROUP *------------------------------------------------------------------------- @@ -165,7 +166,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(nelmts) { - buf = (void *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf==NULL) { printf("cannot read into memory\n" ); goto error; @@ -173,7 +174,7 @@ int do_copy_refobjs(hid_t fidin, if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; - refbuf = HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL){ printf("cannot allocate memory\n" ); goto error; @@ -237,7 +238,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(nelmts) { - buf = (void *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { printf("cannot read into memory\n"); goto error; @@ -249,7 +250,7 @@ int do_copy_refobjs(hid_t fidin, * create output *------------------------------------------------------------------------- */ - refbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { printf("cannot allocate memory\n"); goto error; @@ -370,6 +371,10 @@ int do_copy_refobjs(hid_t fidin, /*nothing to do */ break; + case H5TRAV_TYPE_UNKNOWN: + case H5TRAV_TYPE_UDLINK: + goto error; + default: break; } /* end switch */ @@ -436,7 +441,8 @@ static int copy_refs_attr(hid_t loc_in, if(H5Oget_info(loc_in, &oinfo) < 0) goto error; - for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { + for(u = 0; u < (unsigned)oinfo.num_attrs; u++) + { /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- @@ -482,7 +488,8 @@ static int copy_refs_attr(hid_t loc_in, * we cannot just copy the buffers, but instead we recreate the reference *------------------------------------------------------------------------- */ - if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { + if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) + { hid_t refobj_id; hobj_ref_t *refbuf = NULL; unsigned k; @@ -494,23 +501,28 @@ static int copy_refs_attr(hid_t loc_in, *------------------------------------------------------------------------- */ - if (nelmts) { - buf = (void *)HDmalloc((unsigned)(nelmts * msize)); - if(buf == NULL) { + if (nelmts) + { + buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + if(buf == NULL) + { printf("cannot read into memory\n"); goto error; } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) goto error; - refbuf = HDcalloc((unsigned)nelmts, msize); - if(refbuf == NULL) { + refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + if(refbuf == NULL) + { printf( "cannot allocate memory\n" ); goto error; } /* end if */ - for(k = 0; k < nelmts; k++) { - H5E_BEGIN_TRY { + for(k = 0; k < nelmts; k++) + { + H5E_BEGIN_TRY + { if((refobj_id = H5Rdereference(attr_id, H5R_OBJECT, &buf[k])) < 0) goto error; } H5E_END_TRY; @@ -518,7 +530,8 @@ static int copy_refs_attr(hid_t loc_in, /* get the name. a valid name could only occur in the * second traversal of the file */ - if((refname = MapIdToName(refobj_id, travt)) != NULL) { + if((refname = MapIdToName(refobj_id, travt)) != NULL) + { /* create the reference */ if(H5Rcreate(&refbuf[k], fidout, refname, H5R_OBJECT, -1) < 0) goto error; @@ -552,7 +565,8 @@ static int copy_refs_attr(hid_t loc_in, * dataset region references *------------------------------------------------------------------------- */ - else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { + else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) + { hid_t refobj_id; hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */ hdset_reg_ref_t *buf = NULL; /* output buffer */ @@ -563,9 +577,11 @@ static int copy_refs_attr(hid_t loc_in, * read input to memory *------------------------------------------------------------------------- */ - if(nelmts) { - buf = (void *)HDmalloc((unsigned)(nelmts * msize)); - if(buf == NULL) { + if(nelmts) + { + buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + if(buf == NULL) + { printf( "cannot read into memory\n" ); goto error; } /* end if */ @@ -576,14 +592,17 @@ static int copy_refs_attr(hid_t loc_in, * create output *------------------------------------------------------------------------- */ - refbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ - if(refbuf == NULL) { + refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ + if(refbuf == NULL) + { printf( "cannot allocate memory\n" ); goto error; } /* end if */ - for(k = 0; k < nelmts; k++) { - H5E_BEGIN_TRY { + for(k = 0; k < nelmts; k++) + { + H5E_BEGIN_TRY + { if((refobj_id = H5Rdereference(attr_id, H5R_DATASET_REGION, &buf[k])) < 0) continue; } H5E_END_TRY; @@ -591,7 +610,8 @@ static int copy_refs_attr(hid_t loc_in, /* get the name. a valid name could only occur in the * second traversal of the file */ - if((refname = MapIdToName(refobj_id, travt)) != NULL) { + if((refname = MapIdToName(refobj_id, travt)) != NULL) + { hid_t region_id; /* region id of the referenced dataset */ if((region_id = H5Rget_region(attr_id, H5R_DATASET_REGION, &buf[k])) < 0) @@ -616,8 +636,10 @@ static int copy_refs_attr(hid_t loc_in, if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(nelmts) + { if(H5Awrite(attr_out, mtype_id, refbuf) < 0) goto error; + } if(H5Aclose(attr_out) < 0) goto error; @@ -670,8 +692,10 @@ static const char* MapIdToName(hid_t refobj_id, unsigned int i; /* linear search */ - for(i = 0; i < travt->nobjs; i++) { - if(travt->objs[i].type == H5O_TYPE_DATASET) { + for(i = 0; i < travt->nobjs; i++) + { + if(travt->objs[i].type == H5O_TYPE_DATASET) + { H5O_info_t ref_oinfo; /* Stat for the refobj id */ /* obtain information to identify the referenced object uniquely */ diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index a7454d6..92d758e 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -275,7 +275,7 @@ int has_layout(hid_t pid, } /*------------------------------------------------------------------------- - * Function: h5repack_cmpdcpl + * Function: h5repack_cmp_pl * * Purpose: compare 2 files for identical property lists of all objects * @@ -288,17 +288,20 @@ int has_layout(hid_t pid, *------------------------------------------------------------------------- */ -int h5repack_cmpdcpl(const char *fname1, +int h5repack_cmp_pl(const char *fname1, const char *fname2) { - hid_t fid1=-1; /* file ID */ - hid_t fid2=-1; /* file ID */ - hid_t dset1=-1; /* dataset ID */ - hid_t dset2=-1; /* dataset ID */ - hid_t dcpl1=-1; /* dataset creation property list ID */ - hid_t dcpl2=-1; /* dataset creation property list ID */ - trav_table_t *travt1=NULL; - trav_table_t *travt2=NULL; + hid_t fid1=-1; /* file ID */ + hid_t fid2=-1; /* file ID */ + hid_t dset1=-1; /* dataset ID */ + hid_t dset2=-1; /* dataset ID */ + hid_t gid=-1; /* group ID */ + hid_t dcpl1=-1; /* dataset creation property list ID */ + hid_t dcpl2=-1; /* dataset creation property list ID */ + hid_t gcplid=-1; /* group creation property list */ + unsigned crt_order_flag1; /* group creation order flag */ + unsigned crt_order_flag2; /* group creation order flag */ + trav_table_t *trav=NULL; int ret=1; unsigned int i; @@ -330,26 +333,57 @@ int h5repack_cmpdcpl(const char *fname1, * get file table list of objects *------------------------------------------------------------------------- */ - trav_table_init(&travt1); - trav_table_init(&travt2); - if(h5trav_gettable(fid1, travt1) < 0) + trav_table_init(&trav); + if(h5trav_gettable(fid1, trav) < 0) goto error; - if(h5trav_gettable(fid2, travt2) < 0) - goto error; - - + /*------------------------------------------------------------------------- * traverse the suppplied object list *------------------------------------------------------------------------- */ - - for(i = 0; i < travt1->nobjs; i++) + for(i = 0; i < trav->nobjs; i++) { - if(travt1->objs[i].type == H5TRAV_TYPE_DATASET) + + if(trav->objs[i].type == H5TRAV_TYPE_GROUP) + { + + if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if ((gcplid = H5Gget_create_plist(gid)) < 0) + goto error; + if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0) + goto error; + if (H5Pclose(gcplid) < 0) + goto error; + if (H5Gclose(gid) < 0) + goto error; + + if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if ((gcplid = H5Gget_create_plist(gid)) < 0) + goto error; + if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0) + goto error; + if (H5Pclose(gcplid) < 0) + goto error; + if (H5Gclose(gid) < 0) + goto error; + + if ( crt_order_flag1 != crt_order_flag2 ) + { + error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name); + goto error; + } + + } + + + + else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) { - if((dset1 = H5Dopen2(fid1, travt1->objs[i].name, H5P_DEFAULT)) < 0) + if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if((dset2 = H5Dopen2(fid2, travt1->objs[i].name, H5P_DEFAULT)) < 0) + if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) goto error; if((dcpl1 = H5Dget_create_plist(dset1)) < 0) goto error; @@ -365,7 +399,7 @@ int h5repack_cmpdcpl(const char *fname1, if(ret == 0) { - error_msg(progname, "property lists for <%s> are different\n",travt1->objs[i].name); + error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name); goto error; } @@ -389,8 +423,7 @@ int h5repack_cmpdcpl(const char *fname1, *------------------------------------------------------------------------- */ - trav_table_free(travt1); - trav_table_free(travt2); + trav_table_free(trav); /*------------------------------------------------------------------------- * close @@ -415,8 +448,9 @@ error: H5Dclose(dset2); H5Fclose(fid1); H5Fclose(fid2); - trav_table_free(travt1); - trav_table_free(travt2); + H5Pclose(gcplid); + H5Gclose(gid); + trav_table_free(trav); } H5E_END_TRY; return -1; diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 1a9422e..af4d671 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * +* the files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +* access to either file, you may request a copy from help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" #include "h5test.h" @@ -40,9 +40,11 @@ #define FNAME5 "h5repack_early.h5" #define FNAME5OUT "h5repack_early_out.h5" #define FNAME6 "h5repack_early2.h5" +#ifdef H5_HAVE_FILTER_SZIP /* SZIP filter */ #define FNAME7 "h5repack_szip.h5" #define FNAME7OUT "h5repack_szip_out.h5" +#endif /* GZIP filter */ #define FNAME8 "h5repack_deflate.h5" #define FNAME8OUT "h5repack_deflate_out.h5" @@ -70,13 +72,16 @@ /* File w/userblock */ #define FNAME16 "h5repack_ub.h5" #define FNAME16OUT "h5repack_ub_out.h5" +/* Named datatypes */ +#define FNAME17 "h5repack_named_dtypes.h5" +#define FNAME17OUT "h5repack_named_dtypes_out.h5" #define FNAME_UB "ublock.bin" const char *H5REPACK_FILENAMES[] = { - "h5repack_big_out", + "h5repack_big_out", NULL }; @@ -92,57 +97,57 @@ int d_status = EXIT_SUCCESS; #define CDIM1 DIM1/2 #define CDIM2 DIM2/2 #define RANK 2 -#define GBLL ((unsigned long long) 1024*1024*1024) /* Size of userblock (for userblock test) */ #define USERBLOCK_SIZE 2048 /*------------------------------------------------------------------------- - * prototypes - *------------------------------------------------------------------------- - */ -int make_all_objects(hid_t loc_id); -int make_attributes(hid_t loc_id); -int make_hlinks(hid_t loc_id); -int make_early(void); -int make_layout(hid_t loc_id); +* prototypes +*------------------------------------------------------------------------- +*/ +static int make_all_objects(hid_t loc_id); +static int make_attributes(hid_t loc_id); +static int make_hlinks(hid_t loc_id); +static int make_early(void); +static int make_layout(hid_t loc_id); #ifdef H5_HAVE_FILTER_SZIP -int make_szip(hid_t loc_id); +static int make_szip(hid_t loc_id); #endif /* H5_HAVE_FILTER_SZIP */ -int make_deflate(hid_t loc_id); -int make_shuffle(hid_t loc_id); -int make_fletcher32(hid_t loc_id); -int make_nbit(hid_t loc_id); -int make_scaleoffset(hid_t loc_id); -int make_all(hid_t loc_id); -int make_fill(hid_t loc_id); -int make_big(hid_t loc_id); -int make_testfiles(void); -void write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs ); -void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs ); -int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t type_id,void *buf ); -int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf); -int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t type_id,void *buf); -void make_dset_reg_ref(hid_t loc_id); -int make_external(hid_t loc_id); +static int make_deflate(hid_t loc_id); +static int make_shuffle(hid_t loc_id); +static int make_fletcher32(hid_t loc_id); +static int make_nbit(hid_t loc_id); +static int make_scaleoffset(hid_t loc_id); +static int make_all_filters(hid_t loc_id); +static int make_fill(hid_t loc_id); +static int make_big(hid_t loc_id); +static int make_testfiles(void); +static int write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs ); +static int write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs ); +static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t tid,void *buf ); +static int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf); +static int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t tid,void *buf); +static int make_dset_reg_ref(hid_t loc_id); +static int make_external(hid_t loc_id); static int make_userblock(void); static int verify_userblock( const char* filename); static int make_userblock_file(void); +static int make_named_dtype(hid_t loc_id); /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Executes h5repack tests - * - * Return: Success: zero - * Failure: 1 - * - * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> - * January, 6, 2004 - * - *------------------------------------------------------------------------- - */ +* Function: main +* +* Purpose: Executes h5repack tests +* +* Return: Success: zero +* Failure: 1 +* +* Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> +* January, 6, 2004 +* +*------------------------------------------------------------------------- +*/ int main (void) { @@ -151,20 +156,20 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; #endif - + /* initialize */ memset(&diff_options, 0, sizeof (diff_opt_t)); memset(&pack_options, 0, sizeof (pack_opt_t)); - + /* run tests */ puts("Testing h5repack:"); - + /* make the test files */ TESTING(" generating datasets"); if (make_testfiles() < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * Format of the tests: * @@ -177,7 +182,7 @@ int main (void) * file with fill values *------------------------------------------------------------------------- */ - + TESTING(" copy of datasets (fill values)"); if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -187,7 +192,7 @@ int main (void) GOERROR; if (h5repack_verify(FNAME0OUT,&pack_options)<=0) GOERROR; - if (h5repack_cmpdcpl(FNAME0,FNAME0OUT)<=0) + if (h5repack_cmp_pl(FNAME0,FNAME0OUT)<=0) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; @@ -207,13 +212,13 @@ int main (void) GOERROR; if (h5repack_verify(FNAME1OUT,&pack_options)<=0) GOERROR; - if (h5repack_cmpdcpl(FNAME1,FNAME1OUT)<=0) + if (h5repack_cmp_pl(FNAME1,FNAME1OUT)<=0) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - - + + /*------------------------------------------------------------------------- * file with attributes *------------------------------------------------------------------------- @@ -227,12 +232,12 @@ int main (void) GOERROR; if (h5repack_verify(FNAME2OUT,&pack_options)<=0) GOERROR; - if (h5repack_cmpdcpl(FNAME2,FNAME2OUT)<=0) + if (h5repack_cmp_pl(FNAME2,FNAME2OUT)<=0) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * file with hardlinks *------------------------------------------------------------------------- @@ -246,13 +251,13 @@ int main (void) GOERROR; if (h5repack_verify(FNAME3OUT,&pack_options)<=0) GOERROR; - if (h5repack_cmpdcpl(FNAME3,FNAME3OUT)<=0) + if (h5repack_cmp_pl(FNAME3,FNAME3OUT)<=0) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); - + /*------------------------------------------------------------------------- * alloc early test *------------------------------------------------------------------------- @@ -269,25 +274,25 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * the remaining files differ in the dcpl's *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * deflate *------------------------------------------------------------------------- */ TESTING(" adding deflate filter"); - + #ifdef H5_HAVE_FILTER_DEFLATE - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) @@ -306,16 +311,16 @@ int main (void) #else SKIPPED(); #endif - + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ - + TESTING(" adding deflate filter to all"); - + #ifdef H5_HAVE_FILTER_DEFLATE - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("GZIP=1",&pack_options) < 0) @@ -330,29 +335,29 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + /*------------------------------------------------------------------------- * SZIP *------------------------------------------------------------------------- */ - + TESTING(" adding szip filter"); - + #if defined (H5_HAVE_FILTER_SZIP) if (h5tools_can_encode(H5Z_FILTER_SZIP) >0) { szip_can_encode = 1; } - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ - + if (szip_can_encode) { if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -368,7 +373,7 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); } else { SKIPPED(); @@ -376,14 +381,14 @@ int main (void) #else SKIPPED(); #endif - - + + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ TESTING(" adding szip filter to all"); - + #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_init (&pack_options, 0) < 0) @@ -398,7 +403,7 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); } else { SKIPPED(); @@ -406,17 +411,17 @@ int main (void) #else SKIPPED(); #endif - - + + TESTING(" addding shuffle filter"); - + #ifdef H5_HAVE_FILTER_SHUFFLE - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) @@ -431,21 +436,21 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ - + TESTING(" addding shuffle filter to all"); - + #ifdef H5_HAVE_FILTER_SHUFFLE - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("SHUF",&pack_options) < 0) @@ -460,21 +465,21 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + TESTING(" adding checksum filter"); - + #ifdef H5_HAVE_FILTER_FLETCHER32 - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) @@ -489,22 +494,22 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ - - + + TESTING(" adding checksum filter to all"); - + #ifdef H5_HAVE_FILTER_FLETCHER32 - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("FLET",&pack_options) < 0) @@ -519,47 +524,47 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + TESTING(" filter queue fletcher, shuffle, deflate, szip"); - + /*------------------------------------------------------------------------- * add some filters *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0) GOERROR; - + #if defined (H5_HAVE_FILTER_FLETCHER32) if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) GOERROR; #endif - + #ifdef H5_HAVE_FILTER_SHUFFLE if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) GOERROR; #endif - + #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options) < 0) GOERROR; } #endif - + #ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_addfilter("dset1:GZIP=1",&pack_options) < 0) GOERROR; #endif - + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) GOERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) @@ -568,17 +573,17 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); - - + + TESTING(" adding layout chunked"); - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) @@ -592,13 +597,13 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ TESTING(" adding layout chunked to all"); - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) @@ -611,11 +616,11 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); - + TESTING(" adding layout contiguous"); - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- @@ -632,11 +637,11 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); - + TESTING(" adding layout contiguous to all"); - + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- @@ -653,16 +658,16 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); - + TESTING(" adding layout compact"); - + /*------------------------------------------------------------------------- * test an individual object option *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0) @@ -676,14 +681,14 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" adding layout compact to all"); - + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addlayout("COMPA",&pack_options) < 0) @@ -696,12 +701,12 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); - - + + TESTING(" layout compact to contiguous conversion"); - + /*------------------------------------------------------------------------- * layout compact to contiguous conversion *------------------------------------------------------------------------- @@ -719,9 +724,9 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout compact to chunk conversion"); - + /*------------------------------------------------------------------------- * layout compact to chunk conversion *------------------------------------------------------------------------- @@ -739,9 +744,9 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout compact to compact conversion"); - + /*------------------------------------------------------------------------- * layout compact to compact conversion *------------------------------------------------------------------------- @@ -759,7 +764,7 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout contiguous to compact conversion"); /*------------------------------------------------------------------------- * layout contiguous to compact conversion @@ -778,7 +783,7 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout contiguous to chunk conversion"); /*------------------------------------------------------------------------- * layout contiguous to chunk conversion @@ -797,9 +802,9 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout contiguous to contiguous conversion"); - + /*------------------------------------------------------------------------- * layout contiguous to contiguous conversion *------------------------------------------------------------------------- @@ -817,7 +822,7 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout chunked to compact conversion"); /*------------------------------------------------------------------------- * layout chunked to compact conversion @@ -836,9 +841,9 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout chunked to contiguous conversion"); - + /*------------------------------------------------------------------------- * layout chunked to contiguous conversion *------------------------------------------------------------------------- @@ -856,7 +861,7 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + TESTING(" layout chunked to chunk conversion"); /*------------------------------------------------------------------------- * layout chunked to chunked conversion @@ -875,8 +880,8 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - - + + /*------------------------------------------------------------------------- * the following tests assume the input files have filters * FNAME7 @@ -886,10 +891,10 @@ int main (void) * FNAME11 *------------------------------------------------------------------------- */ - - + + TESTING(" copy of szip filter"); - + #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_init (&pack_options, 0) < 0) @@ -900,11 +905,11 @@ int main (void) GOERROR; if (h5repack_verify(FNAME7OUT,&pack_options)<=0) GOERROR; - if (h5repack_cmpdcpl(FNAME7,FNAME7OUT)<=0) + if (h5repack_cmp_pl(FNAME7,FNAME7OUT)<=0) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); } else { SKIPPED(); @@ -912,9 +917,9 @@ int main (void) #else SKIPPED(); #endif - + TESTING(" removing szip filter"); - + #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_init (&pack_options, 0) < 0) @@ -929,7 +934,7 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); } else { SKIPPED(); @@ -937,10 +942,10 @@ int main (void) #else SKIPPED(); #endif - - + + TESTING(" copy of deflate filter"); - + #ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -952,15 +957,15 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + TESTING(" removing deflate filter"); - + #ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -974,16 +979,16 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - - + + + TESTING(" copy of shuffle filter"); - + #ifdef H5_HAVE_FILTER_SHUFFLE if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -995,14 +1000,14 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + TESTING(" removing shuffle filter"); - + #ifdef H5_HAVE_FILTER_SHUFFLE if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1016,14 +1021,14 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + TESTING(" copy of fletcher filter"); - + #ifdef H5_HAVE_FILTER_FLETCHER32 if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1035,14 +1040,14 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + TESTING(" removing fletcher filter"); - + #ifdef H5_HAVE_FILTER_FLETCHER32 if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1056,15 +1061,15 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + TESTING(" copy of nbit filter"); - + #ifdef H5_HAVE_FILTER_NBIT if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1076,14 +1081,14 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + TESTING(" removing nbit filter"); - + #ifdef H5_HAVE_FILTER_NBIT if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1097,15 +1102,15 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + TESTING(" adding nbit filter"); - + #ifdef H5_HAVE_FILTER_NBIT if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1119,15 +1124,15 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + TESTING(" copy of scaleoffset filter"); - + #ifdef H5_HAVE_FILTER_SCALEOFFSET if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1139,14 +1144,14 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + TESTING(" removing scaleoffset filter"); - + #ifdef H5_HAVE_FILTER_SCALEOFFSET if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1160,15 +1165,15 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + TESTING(" adding scaleoffset filter"); - + #ifdef H5_HAVE_FILTER_SCALEOFFSET if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1182,14 +1187,14 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - - + + + /*------------------------------------------------------------------------- * file with all filters * dset_all @@ -1199,14 +1204,14 @@ int main (void) * dset_fletcher32 *------------------------------------------------------------------------- */ - - + + TESTING(" filter conversion from deflate to szip"); - + #if defined (H5_HAVE_FILTER_SZIP) \ && defined (H5_HAVE_FILTER_DEFLATE) \ && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE) - + if (szip_can_encode) { if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1220,7 +1225,7 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); } else { SKIPPED(); @@ -1228,13 +1233,13 @@ int main (void) #else SKIPPED(); #endif - + TESTING(" filter conversion from szip to deflate"); - + #if defined (H5_HAVE_FILTER_SZIP) \ && defined (H5_HAVE_FILTER_DEFLATE) \ && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE) - + if (szip_can_encode) { if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1248,7 +1253,7 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); } else { SKIPPED(); @@ -1256,18 +1261,18 @@ int main (void) #else SKIPPED(); #endif - - + + /*------------------------------------------------------------------------- * test the NONE global option *------------------------------------------------------------------------- */ - + TESTING(" removing all filters"); - + #if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) \ && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE) - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("NONE",&pack_options) < 0) @@ -1280,12 +1285,12 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - + /*------------------------------------------------------------------------- * test a big file *------------------------------------------------------------------------- @@ -1302,7 +1307,7 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * test external dataset *------------------------------------------------------------------------- @@ -1319,7 +1324,7 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * test file with userblock *------------------------------------------------------------------------- @@ -1338,7 +1343,7 @@ int main (void) if(h5repack_end(&pack_options) < 0) GOERROR; PASSED(); - + /*------------------------------------------------------------------------- * test --latest options *------------------------------------------------------------------------- @@ -1363,17 +1368,17 @@ int main (void) if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - - + + /*------------------------------------------------------------------------- * test several global filters *------------------------------------------------------------------------- */ - + TESTING(" several global filters"); - + #if defined (H5_HAVE_FILTER_DEFLATE) && defined (H5_HAVE_FILTER_SHUFFLE) - + if (h5repack_init (&pack_options, 0) < 0) GOERROR; if (h5repack_addfilter("GZIP=1",&pack_options) < 0) @@ -1388,28 +1393,28 @@ int main (void) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; - + PASSED(); #else SKIPPED(); #endif - - + + /*------------------------------------------------------------------------- * test file with userblock *------------------------------------------------------------------------- */ TESTING(" file with added userblock"); - + #ifdef H5_HAVE_FILTER_DEFLATE - + if(h5repack_init(&pack_options, 0) < 0) GOERROR; - + /* add the options for a user block size and user block filename */ pack_options.ublock_size = USERBLOCK_SIZE; pack_options.ublock_filename = FNAME_UB; - + if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) @@ -1420,44 +1425,44 @@ int main (void) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; - - + + PASSED(); #else SKIPPED(); #endif - - + + /*------------------------------------------------------------------------- * test file with aligment *------------------------------------------------------------------------- */ TESTING(" file with aligment"); - + #ifdef H5_HAVE_FILTER_DEFLATE - + if(h5repack_init(&pack_options, 0) < 0) GOERROR; - + /* add the options for aligment */ pack_options.alignment = 1; pack_options.threshold = 1; - + if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) GOERROR; if(h5repack_verify(FNAME8OUT, &pack_options) <= 0) GOERROR; - - + + /* verify aligment */ { hsize_t threshold; hsize_t alignment; hid_t fapl; hid_t fid; - + if (( fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) GOERROR; if ((fapl = H5Fget_access_plist(fid)) < 0) @@ -1472,264 +1477,297 @@ int main (void) GOERROR; if (H5Fclose(fid) < 0) GOERROR; - + } - - + + if(h5repack_end(&pack_options) < 0) GOERROR; - - + + PASSED(); #else SKIPPED(); #endif - - - - - + + + /*------------------------------------------------------------------------- + * test file with userblock + *------------------------------------------------------------------------- + */ + TESTING(" file with committed datatypes"); + + if(h5repack_init(&pack_options, 0) < 0) + GOERROR; + + if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0) + GOERROR; + if(h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if(h5repack_verify(FNAME17OUT, &pack_options) <= 0) + GOERROR; + if(h5repack_end(&pack_options) < 0) + GOERROR; + + + PASSED(); + + + /*------------------------------------------------------------------------- * clean temporary test files *------------------------------------------------------------------------- */ { hid_t fapl; - + /* setup */ h5_reset(); fapl = h5_fileaccess(); h5_cleanup(H5REPACK_FILENAMES, fapl); - + } - + puts("All h5repack tests passed."); - + return 0; - + error: puts("***** H5REPACK TESTS FAILED *****"); return 1; - + } /*------------------------------------------------------------------------- - * Function: make_testfiles - * - * Purpose: make a test file with all types of HDF5 objects, - * datatypes and filters - * - *------------------------------------------------------------------------- - */ +* Function: make_testfiles +* +* Purpose: make a test file with all types of HDF5 objects, +* datatypes and filters +* +*------------------------------------------------------------------------- +*/ +static int make_testfiles(void) { - hid_t loc_id; - - + hid_t fid; + /*------------------------------------------------------------------------- * create a file for general copy test *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_fill(loc_id) < 0) + if (make_fill(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create another file for general copy test (all datatypes) *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_all_objects(loc_id) < 0) + if (make_all_objects(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file for attributes copy test *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_attributes(loc_id) < 0) + if (make_attributes(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file for hard links test *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_hlinks(loc_id) < 0) + if (make_hlinks(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file for layouts test *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_layout(loc_id) < 0) + if (make_layout(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file for the H5D_ALLOC_TIME_EARLY test *------------------------------------------------------------------------- */ if (make_early() < 0) goto out; - + /*------------------------------------------------------------------------- * create a file with the SZIP filter *------------------------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_SZIP - if((loc_id = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_szip(loc_id) < 0) + if (make_szip(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; #endif /* H5_HAVE_FILTER_SZIP */ - - + + /*------------------------------------------------------------------------- * create a file with the deflate filter *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_deflate(loc_id) < 0) + if (make_deflate(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with the shuffle filter *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_shuffle(loc_id) < 0) + if (make_shuffle(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with the fletcher32 filter *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_fletcher32(loc_id) < 0) + if (make_fletcher32(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with all the filters *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_all(loc_id) < 0) + if (make_all_filters(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with the nbit filter *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME12,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME12,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_nbit(loc_id) < 0) + if (make_nbit(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with the scaleoffset filter *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_scaleoffset(loc_id) < 0) + if (make_scaleoffset(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a big dataset *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_big(loc_id) < 0) + if (make_big(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with external dataset *------------------------------------------------------------------------- */ - if((loc_id = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) return -1; - if (make_external(loc_id) < 0) + if (make_external(fid) < 0) goto out; - if(H5Fclose(loc_id) < 0) + if(H5Fclose(fid) < 0) return -1; - + /*------------------------------------------------------------------------- * create a file with userblock *------------------------------------------------------------------------- */ if(make_userblock() < 0) goto out; - + /*------------------------------------------------------------------------- * create a userblock file *------------------------------------------------------------------------- */ if(make_userblock_file() < 0) goto out; - + + /*------------------------------------------------------------------------- + * create a file with named datatypes + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME17,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + return -1; + if (make_named_dtype(fid) < 0) + goto out; + if(H5Fclose(fid) < 0) + return -1; + return 0; - + out: - H5Fclose(loc_id); + H5Fclose(fid); return -1; } /*------------------------------------------------------------------------- - * Function: make_all_objects - * - * Purpose: make a test file with all types of HDF5 objects - * - *------------------------------------------------------------------------- - */ +* Function: make_all_objects +* +* Purpose: make a test file with all types of HDF5 objects +* +*------------------------------------------------------------------------- +*/ +static int make_all_objects(hid_t loc_id) { - hid_t dset_id; - hid_t group_id; - hid_t type_id; - hid_t root_id; - hid_t space_id; + hid_t did=-1; + hid_t gid=-1; + hid_t tid=-1; + hid_t rid=-1; + hid_t sid=-1; + hid_t gcplid=-1; hsize_t dims[1]={2}; - /* Compound datatype */ + /* compound datatype */ typedef struct s_t { int a; @@ -1737,124 +1775,186 @@ int make_all_objects(hid_t loc_id) } s_t; /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - space_id = H5Screate_simple(1, dims, NULL); - dset_id = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Sclose(space_id); + * H5G_DATASET + *------------------------------------------------------------------------- + */ + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + /*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - group_id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen2(loc_id, "/", H5P_DEFAULT); + * H5G_GROUP + *------------------------------------------------------------------------- + */ + if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Gclose(gid) < 0) + goto out; - /*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ + /* create a group "g2" with H5P_CRT_ORDER_TRACKED set */ + if ((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto out; + if (H5Pset_link_creation_order(gcplid, H5P_CRT_ORDER_TRACKED) < 0) + goto out; + if ((gid = H5Gcreate2(loc_id, "g2", H5P_DEFAULT, gcplid, H5P_DEFAULT)) < 0) + goto out; + if (H5Gclose(gid) < 0) + goto out; - /* Create a memory compound datatype */ - type_id = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT); + /*------------------------------------------------------------------------- + * H5G_TYPE + *------------------------------------------------------------------------- + */ - /* Commit compound datatype and close it */ - H5Tcommit2(loc_id, "type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Tclose(type_id); + /* create a compound datatype */ + if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_INT) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT) < 0) + goto out; + if (H5Tcommit2(loc_id, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; /*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ + * H5G_LINK + *------------------------------------------------------------------------- + */ - H5Lcreate_soft("dset", loc_id, "link", H5P_DEFAULT, H5P_DEFAULT); + if (H5Lcreate_soft("dset", loc_id, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; /*------------------------------------------------------------------------- - * H5G_UDLINK - *------------------------------------------------------------------------- - */ + * H5G_UDLINK + *------------------------------------------------------------------------- + */ /* Create an external link. Other UD links are not supported by h5repack */ - H5Lcreate_external("file", "path", loc_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT); + if (H5Lcreate_external("file", "path", loc_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; /*------------------------------------------------------------------------- - * write a series of datasetes - *------------------------------------------------------------------------- - */ + * write a series of datasetes at root + *------------------------------------------------------------------------- + */ - write_dset_in(root_id,"dset_referenced",loc_id,0); + if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0) + goto out; + if (write_dset_in(rid,"dset_referenced",loc_id,0) < 0) + goto out; + if (H5Gclose(rid) < 0) + goto out; - /* Close */ - H5Dclose(dset_id); - H5Gclose(group_id); - H5Gclose(root_id); + /* close */ + if (H5Dclose(did) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Pclose(gcplid) < 0) + goto out; return 0; + +out: + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Gclose(gid); + H5Gclose(rid); + H5Sclose(sid); + H5Tclose(tid); + H5Pclose(gcplid); + } H5E_END_TRY; + return -1; } /*------------------------------------------------------------------------- - * Function: make_attributes - * - * Purpose: make a test file with all types of attributes - * - *------------------------------------------------------------------------- - */ +* Function: make_attributes +* +* Purpose: make a test file with all types of attributes +* +*------------------------------------------------------------------------- +*/ +static int make_attributes(hid_t loc_id) { - hid_t dset_id; - hid_t group_id; - hid_t root_id; - hid_t space_id; + hid_t did=-1; + hid_t gid=-1; + hid_t rid=-1; + hid_t sid=-1; hsize_t dims[1]={2}; /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ - - space_id = H5Screate_simple(1, dims, NULL); - dset_id = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Sclose(space_id); + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- */ - group_id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen2(loc_id, "/", H5P_DEFAULT); + if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0) + goto out; /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group, and root group *------------------------------------------------------------------------- */ - write_attr_in(dset_id,"dset",loc_id,0); - write_attr_in(group_id,"dset",loc_id,0); - write_attr_in(root_id,"dset",loc_id,0); - - /* Close */ - H5Dclose(dset_id); - H5Gclose(group_id); - H5Gclose(root_id); + if ( write_attr_in(did,"dset",loc_id,0) < 0) + goto out; + if (write_attr_in(gid,"dset",loc_id,0) < 0) + goto out; + if (write_attr_in(rid,"dset",loc_id,0) < 0) + goto out; + /* close */ + if (H5Dclose(did) < 0) + goto out; + if (H5Gclose(gid) < 0) + goto out; + if (H5Gclose(rid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + return 0; + +out: + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Gclose(gid); + H5Gclose(rid); + H5Sclose(sid); + } H5E_END_TRY; + return -1; + } /*------------------------------------------------------------------------- - * Function: make_hlinks - * - * Purpose: make a test file with hard links - * - *------------------------------------------------------------------------- - */ +* Function: make_hlinks +* +* Purpose: make a test file with hard links +* +*------------------------------------------------------------------------- +*/ +static int make_hlinks(hid_t loc_id) { - hid_t group1_id; - hid_t group2_id; - hid_t group3_id; + hid_t g1id=-1; + hid_t g2id=-1; + hid_t g3id=-1; hsize_t dims[2]={3,2}; int buf[3][2]= {{1,1},{1,2},{2,2}}; @@ -1872,40 +1972,55 @@ int make_hlinks(hid_t loc_id) if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0) return -1; - /*------------------------------------------------------------------------- * create a group and some hard links to it *------------------------------------------------------------------------- */ - if((group1_id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - if((group2_id = H5Gcreate2(group1_id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - if((group3_id = H5Gcreate2(group2_id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; + if((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; - if(H5Lcreate_hard(loc_id, "g1", group2_id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0) - return -1; - if(H5Lcreate_hard(group1_id, "g2", group3_id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0) - return -1; + if(H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; + if(H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; - H5Gclose(group1_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + /* close */ + if (H5Gclose(g1id) < 0) + goto out; + if (H5Gclose(g2id) < 0) + goto out; + if (H5Gclose(g3id) < 0) + goto out; + return 0; + +out: + H5E_BEGIN_TRY + { + H5Gclose(g1id); + H5Gclose(g2id); + H5Gclose(g3id); + } H5E_END_TRY; + return -1; + } /*------------------------------------------------------------------------- - * Function: make_szip - * - * Purpose: make a dataset with the SZIP filter - * - *------------------------------------------------------------------------- - */ +* Function: make_szip +* +* Purpose: make a dataset with the SZIP filter +* +*------------------------------------------------------------------------- +*/ #ifdef H5_HAVE_FILTER_SZIP +static int make_szip(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -1916,8 +2031,8 @@ int make_szip(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - int szip_can_encode = 0; - + int szip_can_encode = 0; + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -1934,7 +2049,7 @@ int make_szip(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - + /*------------------------------------------------------------------------- * SZIP *------------------------------------------------------------------------- @@ -1956,14 +2071,14 @@ int make_szip(hid_t loc_id) { /* WARNING? SZIP is decoder only, can't generate test files */ } - + if(H5Sclose(sid) < 0) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -1976,12 +2091,13 @@ out: /*------------------------------------------------------------------------- - * Function: make_deflate - * - * Purpose: make a dataset with the deflate filter - * - *------------------------------------------------------------------------- - */ +* Function: make_deflate +* +* Purpose: make a dataset with the deflate filter +* +*------------------------------------------------------------------------- +*/ +static int make_deflate(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -1992,7 +2108,7 @@ int make_deflate(hid_t loc_id) hobj_ref_t bufref[1]; /* reference */ hsize_t dims1r[1]={1}; int i, j, n; - + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2000,7 +2116,7 @@ int make_deflate(hid_t loc_id) buf[i][j]=n++; } } - + /* create a space */ if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) return -1; @@ -2010,7 +2126,7 @@ int make_deflate(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - + /*------------------------------------------------------------------------- * GZIP *------------------------------------------------------------------------- @@ -2021,16 +2137,16 @@ int make_deflate(hid_t loc_id) goto out; if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0) goto out; - + /* create a reference to the dataset, test second seeep of file for references */ - + if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,-1) < 0) goto out; if (write_dset(loc_id,1,dims1r,"ref",H5T_STD_REF_OBJ,bufref) < 0) goto out; #endif - - + + /*------------------------------------------------------------------------- * close space and dcpl *------------------------------------------------------------------------- @@ -2039,9 +2155,9 @@ int make_deflate(hid_t loc_id) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2052,12 +2168,13 @@ out: /*------------------------------------------------------------------------- - * Function: make_shuffle - * - * Purpose: make a dataset with the shuffle filter - * - *------------------------------------------------------------------------- - */ +* Function: make_shuffle +* +* Purpose: make a dataset with the shuffle filter +* +*------------------------------------------------------------------------- +*/ +static int make_shuffle(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2066,7 +2183,7 @@ int make_shuffle(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2083,7 +2200,7 @@ int make_shuffle(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - + /*------------------------------------------------------------------------- * shuffle *------------------------------------------------------------------------- @@ -2095,8 +2212,8 @@ int make_shuffle(hid_t loc_id) if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0) goto out; #endif - - + + /*------------------------------------------------------------------------- * close space and dcpl *------------------------------------------------------------------------- @@ -2105,9 +2222,9 @@ int make_shuffle(hid_t loc_id) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2117,12 +2234,13 @@ out: } /*------------------------------------------------------------------------- - * Function: make_fletcher32 - * - * Purpose: make a dataset with the fletcher32 filter - * - *------------------------------------------------------------------------- - */ +* Function: make_fletcher32 +* +* Purpose: make a dataset with the fletcher32 filter +* +*------------------------------------------------------------------------- +*/ +static int make_fletcher32(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2131,7 +2249,7 @@ int make_fletcher32(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2148,8 +2266,8 @@ int make_fletcher32(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - - + + /*------------------------------------------------------------------------- * fletcher32 *------------------------------------------------------------------------- @@ -2164,7 +2282,7 @@ int make_fletcher32(hid_t loc_id) if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0) goto out; #endif - + /*------------------------------------------------------------------------- * close space and dcpl *------------------------------------------------------------------------- @@ -2173,9 +2291,9 @@ int make_fletcher32(hid_t loc_id) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2186,12 +2304,13 @@ out: /*------------------------------------------------------------------------- - * Function: make_nbit - * - * Purpose: make a dataset with the nbit filter - * - *------------------------------------------------------------------------- - */ +* Function: make_nbit +* +* Purpose: make a dataset with the nbit filter +* +*------------------------------------------------------------------------- +*/ +static int make_nbit(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2202,7 +2321,7 @@ int make_nbit(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2219,14 +2338,14 @@ int make_nbit(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - + dtid = H5Tcopy(H5T_NATIVE_INT); if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0) { H5Tclose(dtid); goto out; } - + #if defined H5_HAVE_FILTER_NBIT /* remove the filters from the dcpl */ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) @@ -2247,7 +2366,7 @@ int make_nbit(hid_t loc_id) goto out; } H5Dclose(dsid); - + if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) { H5Tclose(dtid); goto out; @@ -2262,7 +2381,7 @@ int make_nbit(hid_t loc_id) } H5Dclose(dsid); #endif - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -2273,9 +2392,9 @@ int make_nbit(hid_t loc_id) goto out; if (H5Tclose(dtid) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2286,12 +2405,13 @@ out: /*------------------------------------------------------------------------- - * Function: make_scaleoffset - * - * Purpose: make a dataset with the scaleoffset filter - * - *------------------------------------------------------------------------- - */ +* Function: make_scaleoffset +* +* Purpose: make a dataset with the scaleoffset filter +* +*------------------------------------------------------------------------- +*/ +static int make_scaleoffset(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2302,7 +2422,7 @@ int make_scaleoffset(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2319,9 +2439,9 @@ int make_scaleoffset(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - + dtid = H5Tcopy(H5T_NATIVE_INT); - + #if defined (H5_HAVE_FILTER_SCALEOFFSET) /* remove the filters from the dcpl */ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) { @@ -2352,7 +2472,7 @@ int make_scaleoffset(hid_t loc_id) H5Tclose(dtid); H5Dclose(dsid); #endif - + /*------------------------------------------------------------------------- * close space and dcpl *------------------------------------------------------------------------- @@ -2361,9 +2481,9 @@ int make_scaleoffset(hid_t loc_id) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2374,13 +2494,14 @@ out: /*------------------------------------------------------------------------- - * Function: make_all - * - * Purpose: make a file with all filters - * - *------------------------------------------------------------------------- - */ -int make_all(hid_t loc_id) +* Function: make_all_filters +* +* Purpose: make a file with all filters +* +*------------------------------------------------------------------------- +*/ +static +int make_all_filters(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ @@ -2399,7 +2520,7 @@ int make_all(hid_t loc_id) #if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; #endif - + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2414,26 +2535,28 @@ int make_all(hid_t loc_id) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) + if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto out; - + #if defined (H5_HAVE_FILTER_SHUFFLE) /* set the shuffle filter */ if (H5Pset_shuffle(dcpl) < 0) goto out; #endif - + #if defined (H5_HAVE_FILTER_FLETCHER32) /* set the checksum filter */ if (H5Pset_fletcher32(dcpl) < 0) goto out; #endif - + #if defined (H5_HAVE_FILTER_SZIP) - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) + { szip_can_encode = 1; } - if (szip_can_encode) { + if (szip_can_encode) + { /* set szip data */ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0) goto out; @@ -2441,16 +2564,16 @@ int make_all(hid_t loc_id) /* WARNING? SZIP is decoder only, can't generate test data using szip */ } #endif - + #if defined (H5_HAVE_FILTER_DEFLATE) /* set deflate data */ if(H5Pset_deflate(dcpl, 9) < 0) goto out; #endif - + if (make_dset(loc_id,"dset_all",sid,dcpl,buf) < 0) goto out; - + #if defined (H5_HAVE_FILTER_FLETCHER32) /* remove the filters from the dcpl */ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) @@ -2461,11 +2584,12 @@ int make_all(hid_t loc_id) if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0) goto out; #endif - - + + /* Make sure encoding is enabled */ #if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) { + if (szip_can_encode) + { /* remove the filters from the dcpl */ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) goto out; @@ -2474,12 +2598,13 @@ int make_all(hid_t loc_id) goto out; if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0) goto out; - } else { + } else + { /* WARNING? SZIP is decoder only, can't generate test dataset */ } #endif - - + + #if defined (H5_HAVE_FILTER_SHUFFLE) /* remove the filters from the dcpl */ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) @@ -2490,8 +2615,8 @@ int make_all(hid_t loc_id) if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0) goto out; #endif - - + + #if defined (H5_HAVE_FILTER_DEFLATE) /* remove the filters from the dcpl */ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) @@ -2502,40 +2627,43 @@ int make_all(hid_t loc_id) if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0) goto out; #endif - - - + + + #if defined (H5_HAVE_FILTER_NBIT) /* remove the filters from the dcpl */ - if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) + if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) goto out; /* set the shuffle filter */ - if(H5Pset_nbit(dcpl) < 0) + if (H5Pset_nbit(dcpl) < 0) + goto out; + if ((dtid = H5Tcopy(H5T_NATIVE_INT)) < 0) + goto out; + if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0) goto out; - dtid = H5Tcopy(H5T_NATIVE_INT); - H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)); if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto out; if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; - + /* close */ if(H5Tclose(dtid) < 0) return -1; if(H5Dclose(dsid) < 0) return -1; #endif - - + + if(H5Sclose(sid) < 0) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Pclose(dcpl); H5Sclose(sid); } H5E_END_TRY; @@ -2545,18 +2673,19 @@ out: /*------------------------------------------------------------------------- - * Function: make_early - * - * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test - * - *------------------------------------------------------------------------- - */ +* Function: make_early +* +* Purpose: create a file for the H5D_ALLOC_TIME_EARLY test +* +*------------------------------------------------------------------------- +*/ +static int make_early(void) { hsize_t dims[1] ={3000}; hsize_t cdims[1]={30}; hid_t fid=-1; - hid_t dset_id=-1; + hid_t did=-1; hid_t sid=-1; hid_t tid=-1; hid_t dcpl=-1; @@ -2564,37 +2693,38 @@ int make_early(void) char name[10]; int iter=100; - if((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) goto out; - if((sid = H5Screate_simple(1, dims, NULL)) < 0) + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) goto out; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_chunk(dcpl, 1, cdims) < 0) + if (H5Pset_chunk(dcpl, 1, cdims) < 0) goto out; - if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) + if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto out; - for(i = 0; i < iter; i++) { - if((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + for(i = 0; i < iter; i++) + { + if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; - if((dset_id = H5Dcreate2(fid, "early", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, "early", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto out; - if((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) + if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; sprintf(name, "%d", i); - if((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Tclose(tid) < 0) + if (H5Tclose(tid) < 0) goto out; - if(H5Dclose(dset_id) < 0) + if (H5Dclose(did) < 0) goto out; - if(H5Ldelete(fid, "early", H5P_DEFAULT) < 0) + if (H5Ldelete(fid, "early", H5P_DEFAULT) < 0) goto out; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) goto out; } @@ -2603,34 +2733,36 @@ int make_early(void) *------------------------------------------------------------------------- */ - if((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - for(i = 0; i < iter; i++) { - if((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) + for(i = 0; i < iter; i++) + { + if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; sprintf(name, "%d", i); - if((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Tclose(tid) < 0) + if (H5Tclose(tid) < 0) goto out; } - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) goto out; - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) goto out; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) goto out; return 0; out: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Tclose(tid); H5Pclose(dcpl); H5Sclose(sid); - H5Dclose(dset_id); + H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; return -1; @@ -2638,23 +2770,24 @@ out: /*------------------------------------------------------------------------- - * Function: make_layout - * - * Purpose: make several datasets with several layouts in location LOC_ID - * - *------------------------------------------------------------------------- - */ +* Function: make_layout +* +* Purpose: make several datasets with several layouts in location LOC_ID +* +*------------------------------------------------------------------------- +*/ +static int make_layout(hid_t loc_id) { - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ + hid_t dcpl=-1; /* dataset creation property list */ + hid_t sid=-1; /* dataspace ID */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; char name[6]; - - + + for (i=n=0; i<DIM1; i++) { for (j=0; j<DIM2; j++) @@ -2662,7 +2795,7 @@ int make_layout(hid_t loc_id) buf[i][j]=n++; } } - + /*------------------------------------------------------------------------- * make several dataset with no filters *------------------------------------------------------------------------- @@ -2673,8 +2806,8 @@ int make_layout(hid_t loc_id) if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf) < 0) return -1; } - - + + /*------------------------------------------------------------------------- * make several dataset with several layout options *------------------------------------------------------------------------- @@ -2687,7 +2820,7 @@ int make_layout(hid_t loc_id) { goto out; } - + /*------------------------------------------------------------------------- * H5D_COMPACT *------------------------------------------------------------------------- @@ -2698,7 +2831,7 @@ int make_layout(hid_t loc_id) { goto out; } - + /*------------------------------------------------------------------------- * H5D_CONTIGUOUS *------------------------------------------------------------------------- @@ -2709,7 +2842,7 @@ int make_layout(hid_t loc_id) { goto out; } - + /*------------------------------------------------------------------------- * H5D_CHUNKED *------------------------------------------------------------------------- @@ -2720,7 +2853,7 @@ int make_layout(hid_t loc_id) { goto out; } - + /*------------------------------------------------------------------------- * close space and dcpl *------------------------------------------------------------------------- @@ -2729,11 +2862,12 @@ int make_layout(hid_t loc_id) goto out; if(H5Pclose(dcpl) < 0) goto out; - + return 0; - + out: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Pclose(dcpl); H5Sclose(sid); } H5E_END_TRY; @@ -2741,12 +2875,13 @@ out: } /*------------------------------------------------------------------------- - * Function: make a file with an integer dataset with a fill value - * - * Purpose: test copy of fill values - * - *------------------------------------------------------------------------- - */ +* Function: make a file with an integer dataset with a fill value +* +* Purpose: test copy of fill values +* +*------------------------------------------------------------------------- +*/ +static int make_fill(hid_t loc_id) { hid_t did=-1; @@ -2755,7 +2890,7 @@ int make_fill(hid_t loc_id) hsize_t dims[2]={3,2}; int buf[3][2]= {{1,1},{1,2},{2,2}}; int fillvalue = 2; - + /*------------------------------------------------------------------------- * H5T_INTEGER, write a fill value *------------------------------------------------------------------------- @@ -2770,7 +2905,7 @@ int make_fill(hid_t loc_id) goto out; if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; - + /* close */ if(H5Sclose(sid) < 0) goto out; @@ -2778,9 +2913,9 @@ int make_fill(hid_t loc_id) goto out; if(H5Dclose(did) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2792,14 +2927,14 @@ out: } /*------------------------------------------------------------------------- - * Function: make_big - * - * Purpose: used in test read by hyperslabs. Creates a 128MB dataset. - * Only 1 1024Kb hyperslab is written. - * - *------------------------------------------------------------------------- - */ - +* Function: make_big +* +* Purpose: used in test read by hyperslabs. Creates a 128MB dataset. +* Only 1 1024Kb hyperslab is written. +* +*------------------------------------------------------------------------- +*/ +static int make_big(hid_t loc_id) { hid_t did=-1; @@ -2815,11 +2950,11 @@ int make_big(hid_t loc_id) size_t nelmts=(size_t)1024; signed char fillvalue=-1; signed char *buf=NULL; - + /* write one 1024 byte hyperslab */ hs_start[0] = 0; hs_size[0] = 1024; - + /* create */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; @@ -2837,18 +2972,18 @@ int make_big(hid_t loc_id) goto out; if((size = H5Tget_size(tid))<=0) goto out; - + /* initialize buffer to 0 */ buf=(signed char *) calloc( nelmts, size); - + if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) goto out; if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) goto out; - + free(buf); buf=NULL; - + /* close */ if(H5Sclose(f_sid) < 0) goto out; @@ -2858,9 +2993,9 @@ int make_big(hid_t loc_id) goto out; if(H5Dclose(did) < 0) goto out; - + return 0; - + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -2874,13 +3009,13 @@ out: /*------------------------------------------------------------------------- - * Function: make_external - * - * Purpose: create a external dataset - * - *------------------------------------------------------------------------- - */ - +* Function: make_external +* +* Purpose: create a external dataset +* +*------------------------------------------------------------------------- +*/ +static int make_external(hid_t loc_id) { hid_t did=-1; @@ -2890,10 +3025,10 @@ int make_external(hid_t loc_id) hsize_t cur_size[1]; /* data space current size */ hsize_t max_size[1]; /* data space maximum size */ hsize_t size; - + cur_size[0] = max_size[0] = 2; size = max_size[0] * sizeof(int); - + /* create */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; @@ -2905,7 +3040,7 @@ int make_external(hid_t loc_id) goto out; if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; - + /* close */ if(H5Sclose(sid) < 0) goto out; @@ -2913,11 +3048,12 @@ int make_external(hid_t loc_id) goto out; if(H5Dclose(did) < 0) goto out; - + return 0; - + out: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Pclose(dcpl); H5Sclose(sid); H5Dclose(did); @@ -2927,12 +3063,12 @@ out: } /*------------------------------------------------------------------------- - * Function: make_userblock - * - * Purpose: create a file for the userblock copying test - * - *------------------------------------------------------------------------- - */ +* Function: make_userblock +* +* Purpose: create a file for the userblock copying test +* +*------------------------------------------------------------------------- +*/ static int make_userblock(void) { @@ -2989,12 +3125,12 @@ out: } /* end make_userblock() */ /*------------------------------------------------------------------------- - * Function: verify_userblock - * - * Purpose: Verify that the userblock was copied correctly - * - *------------------------------------------------------------------------- - */ +* Function: verify_userblock +* +* Purpose: Verify that the userblock was copied correctly +* +*------------------------------------------------------------------------- +*/ static int verify_userblock( const char* filename) { @@ -3059,12 +3195,12 @@ out: /*------------------------------------------------------------------------- - * Function: make_userblock_file - * - * Purpose: create a file for the userblock add test - * - *------------------------------------------------------------------------- - */ +* Function: make_userblock_file +* +* Purpose: create a file for the userblock add test +* +*------------------------------------------------------------------------- +*/ static int make_userblock_file(void) { @@ -3099,44 +3235,43 @@ out: } /*------------------------------------------------------------------------- - * Function: write_dset_in - * - * Purpose: write datasets in LOC_ID - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 12, 2003 - * - *------------------------------------------------------------------------- - */ - - -void write_dset_in(hid_t loc_id, +* Function: write_dset_in +* +* Purpose: write datasets in LOC_ID +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: November 12, 2003 +* +*------------------------------------------------------------------------- +*/ + +static +int write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */) { - /* Compound datatype */ + /* compound datatype */ typedef struct s_t { char a; double b; } s_t; - + typedef enum { RED, - GREEN + GREEN } e_t; - - hid_t dset_id; - hid_t space_id; - hid_t type_id; - hid_t plist_id; - herr_t status; + + hid_t did=-1; + hid_t sid=-1; + hid_t tid=-1; + hid_t pid=-1; int val, i, j, k, n; float f; - + /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; hsize_t dims1r[1]={2}; @@ -3150,7 +3285,7 @@ void write_dset_in(hid_t loc_id, int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ int buf7[2]= {1,2}; /* integer */ float buf8[2]= {1,2}; /* float */ - + /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; hsize_t dims2r[2]={1,1}; @@ -3162,7 +3297,7 @@ void write_dset_in(hid_t loc_id, int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - + /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; hsize_t dims3r[3]={1,1,1}; @@ -3176,19 +3311,19 @@ void write_dset_in(hid_t loc_id, int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ float buf83[4][3][2]; /* float */ - - + + /*------------------------------------------------------------------------- * 1D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - - + + if (make_diffs) { for (i=0; i<2; i++) @@ -3197,37 +3332,45 @@ void write_dset_in(hid_t loc_id, buf1[i][j]='z'; } } - - - type_id = H5Tcopy(H5T_C_S1); - status = H5Tset_size(type_id, (size_t)2); - write_dset(loc_id,1,dims,"string",type_id,buf1); - status = H5Tclose(type_id); - - + + + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (H5Tset_size(tid, (size_t)2) < 0) + goto out; + if (write_dset(loc_id,1,dims,"string",tid,buf1) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /* create hard link */ - status = H5Lcreate_hard(loc_id, "string", H5L_SAME_LOC, "string_link", H5P_DEFAULT, H5P_DEFAULT); - + if (H5Lcreate_hard(loc_id, "string", H5L_SAME_LOC, "string_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) buf2[i]=buf2[1]=0; } - - type_id = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,1,dims,"bitfield",type_id,buf2); - status = H5Tclose(type_id); - + + if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) + goto out; + if (write_dset(loc_id,1,dims,"bitfield",tid,buf2) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -3235,18 +3378,22 @@ void write_dset_in(hid_t loc_id, buf3[i].a=0; buf3[i].b=0; } } - - type_id = H5Tcreate(H5T_OPAQUE, (size_t)1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,1,dims,"opaque",type_id,buf2); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) + goto out; + if (H5Tset_tag(tid, "1-byte opaque type") < 0) + goto out; + if (write_dset(loc_id,1,dims,"opaque",tid,buf2) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - - + + if (make_diffs) { for (i=0; i<2; i++) @@ -3254,13 +3401,18 @@ void write_dset_in(hid_t loc_id, buf45[i]=GREEN; } } - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,1,dims,"compound",type_id,buf3); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) + goto out; + if (write_dset(loc_id,1,dims,"compound",tid,buf3) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3270,31 +3422,39 @@ void write_dset_in(hid_t loc_id, buf4[1]=0; if (dset_name) { - status=H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1); - write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4); + if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1) < 0) + goto out; + if (write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4) < 0) + goto out; } - + /* Dataset region reference ( H5R_DATASET_REGION ) */ - make_dset_reg_ref(loc_id); - - + if (make_dset_reg_ref(loc_id) < 0) + goto out; + + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - write_dset(loc_id,1,dims,"enum",type_id,buf45); - status = H5Tclose(type_id); - + if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) + goto out; + if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + goto out; + if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + goto out; + if (write_dset(loc_id,1,dims,"enum",tid,buf45) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ - + buf5[0].len = 1; buf5[0].p = malloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; @@ -3302,29 +3462,35 @@ void write_dset_in(hid_t loc_id, buf5[1].p = malloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; - + if(make_diffs) { ((int *)buf5[0].p)[0] = 0; ((int *)buf5[1].p)[0] = 0; ((int *)buf5[1].p)[1] = 0; } - - space_id = H5Screate_simple(1, dims, NULL); - type_id = H5Tvlen_create(H5T_NATIVE_INT); - dset_id = H5Dcreate2(loc_id, "vlen", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); - assert(status >= 0); - status = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, buf5); - assert(status >= 0); - status = H5Dclose(dset_id); - status = H5Tclose(type_id); - status = H5Sclose(space_id); - + + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto out; + if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5) < 0) + goto out; + if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0) + goto out; + if (H5Dclose(did) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -3333,16 +3499,59 @@ void write_dset_in(hid_t loc_id, buf6[i][j]=0; } } - - type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(loc_id, 1, dims, "array", type_id, buf6); - status = H5Tclose(type_id); - + + if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) + goto out; + if (write_dset(loc_id, 1, dims, "array", tid, buf6) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + { + + double *dbuf; /* information to write */ + size_t size; + hsize_t sdims[] = {1}; + hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1}; + unsigned u; + + /* allocate and initialize array data to write */ + size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); + dbuf = (double*)malloc( size ); + + for( u = 0; u < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; u++) + dbuf[u] = u; + + if (make_diffs) + { + dbuf[5] = 0; + dbuf[6] = 0; + } + + /* create a type larger than H5TOOLS_MALLOCSIZE */ + if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) + goto out; + size = H5Tget_size(tid); + if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; +#if defined(WRITE_ARRAY) + H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); +#endif + + /* close */ + H5Dclose(did); + H5Tclose(tid); + H5Sclose(sid); + free( dbuf ); + } + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -3351,72 +3560,90 @@ void write_dset_in(hid_t loc_id, buf8[i]=0; } } - - write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); - - + + if (write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0) + goto out; + if (write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0) + goto out; + + /*------------------------------------------------------------------------- * 2D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf12, 'z', sizeof buf12); } - - - type_id = H5Tcopy(H5T_C_S1); - status = H5Tset_size(type_id, (size_t)2); - write_dset(loc_id,2,dims2,"string2D",type_id,buf12); - status = H5Tclose(type_id); - + + + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (H5Tset_size(tid, (size_t)2) < 0) + goto out; + if (write_dset(loc_id,2,dims2,"string2D",tid,buf12) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - - + + if (make_diffs) { memset(buf22,0,sizeof buf22); } - - type_id = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,2,dims2,"bitfield2D",type_id,buf22); - status = H5Tclose(type_id); - + + if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) + goto out; + if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - type_id = H5Tcreate(H5T_OPAQUE, (size_t)1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,2,dims2,"opaque2D",type_id,buf22); - status = H5Tclose(type_id); - + if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) + goto out; + if (H5Tset_tag(tid, "1-byte opaque type") < 0) + goto out; + if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf32,0,sizeof buf32); } - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,2,dims2,"compound2D",type_id,buf32); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) + goto out; + if (write_dset(loc_id,2,dims2,"compound2D",tid,buf32) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3424,373 +3651,478 @@ void write_dset_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - status = H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, -1); - write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42); + if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, -1) < 0) + goto out; + if (write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42) < 0) + goto out; } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - write_dset(loc_id,2,dims2,"enum2D",type_id,0); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) + goto out; + if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + goto out; + if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + goto out; + if (write_dset(loc_id,2,dims2,"enum2D",tid,0) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n = 0; for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) { + { + for(j = 0; j < 2; j++) + { int l; - + buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) + { if(make_diffs) ((int *)buf52[i][j].p)[l] = 0; else ((int *)buf52[i][j].p)[l] = n++; + } } - - space_id = H5Screate_simple(2, dims2, NULL); - type_id = H5Tvlen_create(H5T_NATIVE_INT); - dset_id = H5Dcreate2(loc_id, "vlen2D", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52); - assert(status >= 0); - status = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, buf52); - assert(status >= 0); - status = H5Dclose(dset_id); - status = H5Tclose(type_id); - status = H5Sclose(space_id); - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - memset(buf62,0,sizeof buf62); - } - - - type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(loc_id, 2, dims2, "array2D", type_id, buf62); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_INTEGER, write a fill value - *------------------------------------------------------------------------- - */ - - - if(make_diffs) { - memset(buf72, 0, sizeof buf72); - memset(buf82, 0, sizeof buf82); - } - - - plist_id = H5Pcreate(H5P_DATASET_CREATE); - space_id = H5Screate_simple(2, dims2, NULL); - dset_id = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, space_id, H5P_DEFAULT, plist_id, H5P_DEFAULT); - status = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72); - status = H5Pclose(plist_id); - status = H5Dclose(dset_id); - status = H5Sclose(space_id); - - /*------------------------------------------------------------------------- - * H5T_FLOAT - *------------------------------------------------------------------------- - */ - - write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - - - /*------------------------------------------------------------------------- - * 3D - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - memset(buf13,'z',sizeof buf13); + } + + if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) + goto out; + if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52) < 0) + goto out; + if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0) + goto out; + if (H5Dclose(did) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + if (make_diffs) + { + memset(buf62,0,sizeof buf62); + } + + + if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) + goto out; + if (write_dset(loc_id, 2, dims2, "array2D", tid, buf62) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_INTEGER, write a fill value + *------------------------------------------------------------------------- + */ + + + if(make_diffs) { + memset(buf72, 0, sizeof buf72); + memset(buf82, 0, sizeof buf82); + } + + + if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) + goto out; + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72) < 0) + goto out; + if (H5Pclose(pid) < 0) + goto out; + if (H5Dclose(did) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_FLOAT + *------------------------------------------------------------------------- + */ + + if (write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0) + goto out; + + + /*------------------------------------------------------------------------- + * 3D + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + + if (make_diffs) + { + memset(buf13,'z',sizeof buf13); + } + + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (H5Tset_size(tid, (size_t)2) < 0) + goto out; + if (write_dset(loc_id,3,dims3,"string3D",tid,buf13) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + + n=1; + for (i = 0; i < 4; i++) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 2; k++) { + if (make_diffs) buf23[i][j][k]=0; + else buf23[i][j][k]=n++; + } } - - type_id = H5Tcopy(H5T_C_S1); - status = H5Tset_size(type_id, (size_t)2); - write_dset(loc_id,3,dims3,"string3D",type_id,buf13); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) buf23[i][j][k]=0; - else buf23[i][j][k]=n++; + } + + + if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) + goto out; + if (write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) + goto out; + if (H5Tset_tag(tid, "1-byte opaque type") < 0) + goto out; + if (write_dset(loc_id,3,dims3,"opaque3D",tid,buf23) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + + n=1; + for (i = 0; i < 4; i++) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 2; k++) { + if (make_diffs) { + buf33[i][j][k].a=0; + buf33[i][j][k].b=0; + } + else { + buf33[i][j][k].a=n++; + buf33[i][j][k].b=n++; } } } - - - type_id = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,3,dims3,"bitfield3D",type_id,buf23); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - type_id = H5Tcreate(H5T_OPAQUE, (size_t)1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,3,dims3,"opaque3D",type_id,buf23); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) { - buf33[i][j][k].a=0; - buf33[i][j][k].b=0; - } - else { - buf33[i][j][k].a=n++; - buf33[i][j][k].b=n++; - } + } + + + if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) + goto out; + if (write_dset(loc_id,3,dims3,"compound3D",tid,buf33) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) + { + if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, -1) < 0) + goto out; + if (write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43) < 0) + goto out; + } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + + if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) + goto out; + if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + goto out; + if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + goto out; + if (write_dset(loc_id,3,dims3,"enum3D",tid,0) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for(i = 0; i < 4; i++) + { + for(j = 0; j < 3; j++) + { + for(k = 0; k < 2; k++) + { + int l; + + buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].len = i + 1; + for(l = 0; l < i + 1; l++) + { + if(make_diffs) + ((int *)buf53[i][j][k].p)[l] = 0; + else + ((int *)buf53[i][j][k].p)[l] = n++; } } } - - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,3,dims3,"compound3D",type_id,buf33); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if (dset_name) + } + + if ((sid = H5Screate_simple(3, dims3, NULL)) < 0) + goto out; + if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53) < 0) + goto out; + + if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0) + goto out; + + if (H5Dclose(did) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + + n = 1; + for(i = 0; i < 24; i++) + { + for(j = 0; j < (int)dimarray[0]; j++) { - status = H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, -1); - write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43); + if(make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; } - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - write_dset(loc_id,3,dims3,"enum3D",type_id,0); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - n = 0; - for(i = 0; i < 4; i++) - for(j = 0; j < 3; j++) - for(k = 0; k < 2; k++) { - int l; - - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; - for(l = 0; l < i + 1; l++) - if(make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; - else - ((int *)buf53[i][j][k].p)[l] = n++; + } + + if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) + goto out; + if (write_dset(loc_id, 3, dims3, "array3D", tid, buf63) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + n=1; f=1; + for (i = 0; i < 4; i++) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 2; k++) { + if (make_diffs) { + buf73[i][j][k]=0; + buf83[i][j][k]=0; } - - space_id = H5Screate_simple(3, dims3, NULL); - type_id = H5Tvlen_create(H5T_NATIVE_INT); - dset_id = H5Dcreate2(loc_id, "vlen3D", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53); - assert(status >= 0); - status = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, buf53); - assert(status >= 0); - status = H5Dclose(dset_id); - status = H5Tclose(type_id); - status = H5Sclose(space_id); - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - - n = 1; - for(i = 0; i < 24; i++) - for(j = 0; j < (int)dimarray[0]; j++) - if(make_diffs) - buf63[i][j] = 0; - else - buf63[i][j] = n++; - - type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(loc_id, 3, dims3, "array3D", type_id, buf63); - status = H5Tclose(type_id); - - /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0; - } - else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; - } - } - } - } - write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); -} + else { + buf73[i][j][k]=n++; + buf83[i][j][k]=f++; + } + } + } + } + if (write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0) + goto out; + if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0) + goto out; + + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Pclose(pid); + H5Sclose(sid); + H5Dclose(did); + H5Tclose(tid); + } H5E_END_TRY; + return -1; +} + /*------------------------------------------------------------------------- - * Function: make_dset_reg_ref - * - * Purpose: write dataset region references - * - *------------------------------------------------------------------------- - */ +* Function: make_dset_reg_ref +* +* Purpose: write dataset region references +* +*------------------------------------------------------------------------- +*/ #define SPACE1_RANK 1 #define SPACE1_DIM1 1 #define SPACE2_RANK 2 #define SPACE2_DIM1 10 #define SPACE2_DIM2 10 -#define NPOINTS 10 - -void make_dset_reg_ref(hid_t loc_id) +static +int make_dset_reg_ref(hid_t loc_id) { - hid_t dset1; /* Dataset ID */ - hid_t dset2; /* Dereferenced dataset ID */ - hid_t sid1; /* Dataspace ID #1 */ - hid_t sid2; /* Dataspace ID #2 */ + hid_t did1=-1; /* Dataset ID */ + hid_t did2=-1; /* Dereferenced dataset ID */ + hid_t sid1=-1; /* Dataspace ID #1 */ + hid_t sid2=-1; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hdset_reg_ref_t *wbuf; /* buffer to write to disk */ - int *dwbuf; /* Buffer for writing numeric data to disk */ + hdset_reg_ref_t *wbuf=NULL; /* buffer to write to disk */ + int *dwbuf=NULL; /* Buffer for writing numeric data to disk */ int i; /* counting variables */ - herr_t ret; /* Generic return value */ - + /* Allocate write & read buffers */ wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); dwbuf = (int *)malloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); - + /* Create dataspace for datasets */ - sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); - + if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) + goto out; + /* Create a dataset */ - dset2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - for(i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++) + if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + for (i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++) dwbuf[i] = i * 3; - + /* Write selection to disk */ - ret = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); - assert(ret >= 0); - - /* Close Dataset */ - ret = H5Dclose(dset2); - assert(ret >= 0); - + if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0) + goto out; + /* Create dataspace for the reference dataset */ - sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - + if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) + goto out; + /* Create a dataset */ - dset1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - /* Create references */ - + if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + /* Select 6x6 hyperslab for first reference */ start[0] = 2; start[1] = 2; stride[0] = 1; stride[1] = 1; count[0] = 6; count[1] = 6; block[0] = 1; block[1] = 1; - ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block); - assert(ret >= 0); - + if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0) + goto out; + + /* Store dataset region */ - ret = H5Rcreate(&wbuf[0], loc_id, "dsetreg", H5R_DATASET_REGION, sid2); - assert(ret >= 0); - + if (H5Rcreate(&wbuf[0], loc_id, "dsetreg", H5R_DATASET_REGION, sid2) < 0) + goto out; + /* Write selection to disk */ - ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); - assert(ret >= 0); - + if (H5Dwrite(did1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf) < 0) + goto out; + /* Close all objects */ - ret = H5Sclose(sid1); - assert(ret >= 0); - ret = H5Dclose(dset1); - assert(ret >= 0); - ret = H5Sclose(sid2); - assert(ret >= 0); - - free(wbuf); - free(dwbuf); + if (H5Sclose(sid1) < 0) + goto out; + if (H5Dclose(did1) < 0) + goto out; + if (H5Sclose(sid2) < 0) + goto out; + if (H5Dclose(did2) < 0) + goto out; + + if (wbuf) + free(wbuf); + if (dwbuf) + free(dwbuf); + + return 0; + +out: + H5E_BEGIN_TRY + { + + H5Sclose(sid1); + H5Sclose(sid2); + H5Dclose(did1); + H5Dclose(did2); + + } H5E_END_TRY; + return -1; } /*------------------------------------------------------------------------- - * Function: write_attr_in - * - * Purpose: write attributes in LOC_ID (dataset, group, named datatype) - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 12, 2003 - * - *------------------------------------------------------------------------- - */ - - -void write_attr_in(hid_t loc_id, +* Function: write_attr_in +* +* Purpose: write attributes in LOC_ID (dataset, group, named datatype) +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: November 12, 2003 +* +*------------------------------------------------------------------------- +*/ + +static +int write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t fid, /* for reference create */ int make_diffs /* flag to modify data buffers */) @@ -3801,20 +4133,19 @@ void write_attr_in(hid_t loc_id, char a; double b; } s_t; - + typedef enum { RED, - GREEN + GREEN } e_t; - - hid_t attr_id; - hid_t space_id; - hid_t type_id; - herr_t status; + + hid_t aid; + hid_t sid; + hid_t tid; int val, i, j, k, n; float f; - + /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; char buf1[2][2]= {"ab","de"}; /* string */ @@ -3827,7 +4158,7 @@ void write_attr_in(hid_t loc_id, int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ int buf7[2]= {1,2}; /* integer */ float buf8[2]= {1,2}; /* float */ - + /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ @@ -3839,7 +4170,7 @@ void write_attr_in(hid_t loc_id, int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - + /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", @@ -3853,18 +4184,18 @@ void write_attr_in(hid_t loc_id, int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ float buf83[4][3][2]; /* float */ - - + + /*------------------------------------------------------------------------- * 1D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -3885,16 +4216,20 @@ void write_attr_in(hid_t loc_id, [ 1 ] d z [ 1 ] e z */ - type_id = H5Tcopy(H5T_C_S1); - status = H5Tset_size(type_id, (size_t)2); - make_attr(loc_id,1,dims,"string",type_id,buf1); - status = H5Tclose(type_id); + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (H5Tset_size(tid, (size_t)2) < 0) + goto out; + if (make_attr(loc_id,1,dims,"string",tid,buf1) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -3912,15 +4247,18 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 */ - type_id = H5Tcopy(H5T_STD_B8LE); - make_attr(loc_id,1,dims,"bitfield",type_id,buf2); - status = H5Tclose(type_id); - + if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) + goto out; + if (make_attr(loc_id,1,dims,"bitfield",tid,buf2) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - + /* buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -3932,17 +4270,21 @@ void write_attr_in(hid_t loc_id, [ 0 ] 1 0 1 [ 1 ] 2 0 2 */ - - type_id = H5Tcreate(H5T_OPAQUE, (size_t)1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - make_attr(loc_id,1,dims,"opaque",type_id,buf2); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) + goto out; + if (H5Tset_tag(tid, "1-byte opaque type") < 0) + goto out; + if (make_attr(loc_id,1,dims,"opaque",tid,buf2) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -3950,7 +4292,7 @@ void write_attr_in(hid_t loc_id, buf3[i].a=0; buf3[i].b=0; } } - + /* buf3[2]= {{1,2},{3,4}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -3963,13 +4305,18 @@ void write_attr_in(hid_t loc_id, [ 1 ] 3 5 2 [ 1 ] 4 5 1 */ - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - make_attr(loc_id,1,dims,"compound",type_id,buf3); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) + goto out; + if (make_attr(loc_id,1,dims,"compound",tid,buf3) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3977,12 +4324,15 @@ void write_attr_in(hid_t loc_id, /* object references ( H5R_OBJECT */ if (dset_name) { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); - make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1) < 0) + goto out; + if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1) < 0) + goto out; + if (make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4) < 0) + goto out; } - - + + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- @@ -4004,19 +4354,24 @@ void write_attr_in(hid_t loc_id, [ 0 ] RED GREEN [ 1 ] RED GREEN */ - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - make_attr(loc_id,1,dims,"enum",type_id,buf45); - status = H5Tclose(type_id); + if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) + goto out; + if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + goto out; + if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + goto out; + if (make_attr(loc_id,1,dims,"enum",tid,buf45) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ - + buf5[0].len = 1; buf5[0].p = malloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; @@ -4024,7 +4379,7 @@ void write_attr_in(hid_t loc_id, buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; - + if(make_diffs) { ((int *)buf5[0].p)[0] = 0; @@ -4040,23 +4395,29 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 [ 1 ] 3 0 3 */ - - space_id = H5Screate_simple(1, dims, NULL); - type_id = H5Tvlen_create(H5T_NATIVE_INT); - attr_id = H5Acreate2(loc_id, "vlen", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(attr_id, type_id, buf5); - assert(status >= 0); - status = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, buf5); - assert(status >= 0); - status = H5Aclose(attr_id); - status = H5Tclose(type_id); - status = H5Sclose(space_id); - + + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto out; + if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + goto out; + if ((aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Awrite(aid, tid, buf5) < 0) + goto out; + if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0) + goto out; + if (H5Aclose(aid) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -4079,15 +4440,18 @@ void write_attr_in(hid_t loc_id, [ 1 ] 5 0 5 [ 1 ] 6 0 6 */ - type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - make_attr(loc_id, 1, dims, "array", type_id, buf6); - status = H5Tclose(type_id); + if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) + goto out; + if (make_attr(loc_id, 1, dims, "array", tid, buf6) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - + if(make_diffs) { for(i = 0; i < 2; i++) @@ -4096,7 +4460,7 @@ void write_attr_in(hid_t loc_id, buf8[i]=0; } } - + /* buf7[2]= {1,2}; buf8[2]= {1,2}; @@ -4111,15 +4475,17 @@ void write_attr_in(hid_t loc_id, [ 0 ] 1 0 1 [ 1 ] 2 0 2 */ - make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); + if (make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0) + goto out; + if (make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0) + goto out; + - /*------------------------------------------------------------------------- * 2D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -4128,7 +4494,7 @@ void write_attr_in(hid_t loc_id, { memset(buf12, 'z', sizeof buf12); } - + /* buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -4148,22 +4514,26 @@ void write_attr_in(hid_t loc_id, [ 2 1 ] k z [ 2 1 ] l z */ - - type_id = H5Tcopy(H5T_C_S1); - status = H5Tset_size(type_id, (size_t)2); - make_attr(loc_id,2,dims2,"string2D",type_id,buf12); - status = H5Tclose(type_id); - + + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (H5Tset_size(tid, (size_t)2) < 0) + goto out; + if (make_attr(loc_id,2,dims2,"string2D",tid,buf12) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf22,0,sizeof buf22); } - + /* buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -4177,17 +4547,20 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - - - type_id = H5Tcopy(H5T_STD_B8LE); - make_attr(loc_id,2,dims2,"bitfield2D",type_id,buf22); - status = H5Tclose(type_id); - + + + if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) + goto out; + if (make_attr(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - + /* buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -4201,11 +4574,15 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - type_id = H5Tcreate(H5T_OPAQUE, (size_t)1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - make_attr(loc_id,2,dims2,"opaque2D",type_id,buf22); - status = H5Tclose(type_id); - + if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) + goto out; + if (H5Tset_tag(tid, "1-byte opaque type") < 0) + goto out; + if (make_attr(loc_id,2,dims2,"opaque2D",tid,buf22) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- @@ -4214,7 +4591,7 @@ void write_attr_in(hid_t loc_id, { memset(buf32,0,sizeof buf32); } - + /* buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -4228,14 +4605,19 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - make_attr(loc_id,2,dims2,"compound2D",type_id,buf32); - status = H5Tclose(type_id); - + + + if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) + goto out; + if (make_attr(loc_id,2,dims2,"compound2D",tid,buf32) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -4247,12 +4629,14 @@ void write_attr_in(hid_t loc_id, { for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1) < 0) + goto out; } } - make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + if (make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42) < 0) + goto out; } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- @@ -4264,7 +4648,7 @@ void write_attr_in(hid_t loc_id, if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; } } - + /* Attribute: <enum2D> and <enum2D> position enum2D of </g1> enum2D of </g1> difference @@ -4276,18 +4660,23 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] RED GREEN [ 2 1 ] RED GREEN */ - - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - make_attr(loc_id,2,dims2,"enum2D",type_id,buf452); - status = H5Tclose(type_id); - + + if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) + goto out; + if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + goto out; + if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + goto out; + if (make_attr(loc_id,2,dims2,"enum2D",tid,buf452) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 3; i++) @@ -4302,7 +4691,7 @@ void write_attr_in(hid_t loc_id, else ((int *)buf52[i][j].p)[l] = n++; } } - + /* position vlen2D of </g1> vlen2D of </g1> difference ------------------------------------------------------------ @@ -4318,23 +4707,29 @@ void write_attr_in(hid_t loc_id, [ 2 1 ] 10 0 10 [ 2 1 ] 11 0 11 */ - - space_id = H5Screate_simple(2, dims2, NULL); - type_id = H5Tvlen_create(H5T_NATIVE_INT); - attr_id = H5Acreate2(loc_id, "vlen2D", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(attr_id, type_id, buf52); - assert(status >= 0); - status = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, buf52); - assert(status >= 0); - status = H5Aclose(attr_id); - status = H5Tclose(type_id); - status = H5Sclose(space_id); - + + if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) + goto out; + if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + goto out; + if ((aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Awrite(aid, tid, buf52) < 0) + goto out; + if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0) + goto out; + if (H5Aclose(aid) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf62,0,sizeof buf62); @@ -4365,15 +4760,18 @@ void write_attr_in(hid_t loc_id, [ 2 1 ] 17 0 17 [ 2 1 ] 18 0 18 */ - type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - make_attr(loc_id, 2, dims2, "array2D", type_id, buf62); - status = H5Tclose(type_id); - + if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) + goto out; + if (make_attr(loc_id, 2, dims2, "array2D", tid, buf62) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - + if(make_diffs) { HDmemset(buf72, 0, sizeof buf72); @@ -4400,93 +4798,99 @@ void write_attr_in(hid_t loc_id, [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - - make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); - make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - - + + if (make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72) < 0) + goto out; + if (make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0) + goto out; + + /*------------------------------------------------------------------------- * 3D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf13,'z',sizeof buf13); } - + /* buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", "rs","tu","vw","xz","AB","CD","EF","GH", "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; - - Attribute: <string3D> and <string3D> - position string3D of </g1> string3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] a z - [ 0 0 0 ] b z - [ 0 0 1 ] c z - [ 0 0 1 ] d z - [ 0 1 0 ] e z - [ 0 1 0 ] f z - [ 0 1 1 ] g z - [ 0 1 1 ] h z - [ 0 2 0 ] i z - [ 0 2 0 ] j z - [ 0 2 1 ] k z - [ 0 2 1 ] l z - [ 1 0 0 ] m z - [ 1 0 0 ] n z - [ 1 0 1 ] p z - [ 1 0 1 ] q z - [ 1 1 0 ] r z - [ 1 1 0 ] s z - [ 1 1 1 ] t z - [ 1 1 1 ] u z - [ 1 2 0 ] v z - [ 1 2 0 ] w z - [ 1 2 1 ] x z - [ 2 0 0 ] A z - [ 2 0 0 ] B z - [ 2 0 1 ] C z - [ 2 0 1 ] D z - [ 2 1 0 ] E z - [ 2 1 0 ] F z - [ 2 1 1 ] G z - [ 2 1 1 ] H z - [ 2 2 0 ] I z - [ 2 2 0 ] J z - [ 2 2 1 ] K z - [ 2 2 1 ] L z - [ 3 0 0 ] M z - [ 3 0 0 ] N z - [ 3 0 1 ] P z - [ 3 0 1 ] Q z - [ 3 1 0 ] R z - [ 3 1 0 ] S z - [ 3 1 1 ] T z - [ 3 1 1 ] U z - [ 3 2 0 ] V z - [ 3 2 0 ] W z - [ 3 2 1 ] X z - [ 3 2 1 ] Z z - */ - - type_id = H5Tcopy(H5T_C_S1); - status = H5Tset_size(type_id, (size_t)2); - make_attr(loc_id,3,dims3,"string3D",type_id,buf13); - status = H5Tclose(type_id); - + + Attribute: <string3D> and <string3D> + position string3D of </g1> string3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] a z + [ 0 0 0 ] b z + [ 0 0 1 ] c z + [ 0 0 1 ] d z + [ 0 1 0 ] e z + [ 0 1 0 ] f z + [ 0 1 1 ] g z + [ 0 1 1 ] h z + [ 0 2 0 ] i z + [ 0 2 0 ] j z + [ 0 2 1 ] k z + [ 0 2 1 ] l z + [ 1 0 0 ] m z + [ 1 0 0 ] n z + [ 1 0 1 ] p z + [ 1 0 1 ] q z + [ 1 1 0 ] r z + [ 1 1 0 ] s z + [ 1 1 1 ] t z + [ 1 1 1 ] u z + [ 1 2 0 ] v z + [ 1 2 0 ] w z + [ 1 2 1 ] x z + [ 2 0 0 ] A z + [ 2 0 0 ] B z + [ 2 0 1 ] C z + [ 2 0 1 ] D z + [ 2 1 0 ] E z + [ 2 1 0 ] F z + [ 2 1 1 ] G z + [ 2 1 1 ] H z + [ 2 2 0 ] I z + [ 2 2 0 ] J z + [ 2 2 1 ] K z + [ 2 2 1 ] L z + [ 3 0 0 ] M z + [ 3 0 0 ] N z + [ 3 0 1 ] P z + [ 3 0 1 ] Q z + [ 3 1 0 ] R z + [ 3 1 0 ] S z + [ 3 1 1 ] T z + [ 3 1 1 ] U z + [ 3 2 0 ] V z + [ 3 2 0 ] W z + [ 3 2 1 ] X z + [ 3 2 1 ] Z z + */ + + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (H5Tset_size(tid, (size_t)2) < 0) + goto out; + if (make_attr(loc_id,3,dims3,"string3D",tid,buf13) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ - + n=1; for (i = 0; i < 4; i++) { @@ -4499,7 +4903,7 @@ void write_attr_in(hid_t loc_id, } } } - + /* position bitfield3D of </g1> bitfield3D of </g1> difference ------------------------------------------------------------ @@ -4528,25 +4932,32 @@ void write_attr_in(hid_t loc_id, [ 3 2 0 ] 23 0 23 [ 3 2 1 ] 24 0 24 */ - - type_id = H5Tcopy(H5T_STD_B8LE); - make_attr(loc_id,3,dims3,"bitfield3D",type_id,buf23); - status = H5Tclose(type_id); - + + if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) + goto out; + if (make_attr(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - type_id = H5Tcreate(H5T_OPAQUE, (size_t)1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - make_attr(loc_id,3,dims3,"opaque3D",type_id,buf23); - status = H5Tclose(type_id); - + if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) + goto out; + if (H5Tset_tag(tid, "1-byte opaque type") < 0) + goto out; + if (make_attr(loc_id,3,dims3,"opaque3D",tid,buf23) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- */ - + n=1; for (i = 0; i < 4; i++) { @@ -4618,15 +5029,20 @@ void write_attr_in(hid_t loc_id, [ 3 2 1 ] 47 0 47 [ 3 2 1 ] 48 0 48 */ - - - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - make_attr(loc_id,3,dims3,"compound3D",type_id,buf33); - status = H5Tclose(type_id); - + + + + if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) + goto out; + if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) + goto out; + if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) + goto out; + if (make_attr(loc_id,3,dims3,"compound3D",tid,buf33) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -4639,17 +5055,19 @@ void write_attr_in(hid_t loc_id, for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1) < 0) + goto out; } } - make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + if (make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43) < 0) + goto out; } - + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - + for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) @@ -4667,7 +5085,7 @@ void write_attr_in(hid_t loc_id, } } } - + /* position enum3D of </g1> enum3D of </g1> difference ------------------------------------------------------------ @@ -4696,19 +5114,24 @@ void write_attr_in(hid_t loc_id, [ 3 2 0 ] GREEN RED [ 3 2 1 ] GREEN RED */ - - - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - make_attr(loc_id,3,dims3,"enum3D",type_id,buf453); - status = H5Tclose(type_id); - + + + if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) + goto out; + if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + goto out; + if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + goto out; + if (make_attr(loc_id,3,dims3,"enum3D",tid,buf453) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) @@ -4745,17 +5168,23 @@ void write_attr_in(hid_t loc_id, [ 1 1 0 ] 10 0 10 etc */ - space_id = H5Screate_simple(3, dims3, NULL); - type_id = H5Tvlen_create(H5T_NATIVE_INT); - attr_id = H5Acreate2(loc_id, "vlen3D", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(attr_id, type_id, buf53); - assert(status >= 0); - status = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, buf53); - assert(status >= 0); - status = H5Aclose(attr_id); - status = H5Tclose(type_id); - status = H5Sclose(space_id); - + if ((sid = H5Screate_simple(3, dims3, NULL)) < 0) + goto out; + if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + goto out; + if ((aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (H5Awrite(aid, tid, buf53) < 0) + goto out; + if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0) + goto out; + if (H5Aclose(aid) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- @@ -4781,11 +5210,14 @@ void write_attr_in(hid_t loc_id, [ 0 1 0 ] 7 0 7 etc */ - - type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - make_attr(loc_id, 3, dims3, "array3D", type_id, buf63); - status = H5Tclose(type_id); - + + if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) + goto out; + if (make_attr(loc_id, 3, dims3, "array3D", tid, buf63) < 0) + goto out; + if (H5Tclose(tid) < 0) + goto out; + /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- @@ -4810,7 +5242,7 @@ void write_attr_in(hid_t loc_id, } } } - + /* position integer3D of </g1> integer3D of </g1> difference ------------------------------------------------------------ @@ -4826,145 +5258,279 @@ void write_attr_in(hid_t loc_id, [ 1 1 1 ] 10 0 10 etc */ - make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + if (make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0) + goto out; + if (make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0) + goto out; + + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Aclose(aid); + H5Sclose(sid); + H5Tclose(tid); + } H5E_END_TRY; + return -1; } + /*------------------------------------------------------------------------- - * Function: make_dset - * - * Purpose: utility function to create and write a dataset in LOC_ID - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 12, 2003 - * - *------------------------------------------------------------------------- - */ +* Function: make_dset +* +* Purpose: utility function to create and write a dataset in LOC_ID +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: November 12, 2003 +* +*------------------------------------------------------------------------- +*/ +static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf) { - hid_t dsid; + hid_t did=-1; - /* create the dataset */ - if((dsid = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) return -1; - - /* write */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; - - /* close */ - if(H5Dclose(dsid) < 0) + if (H5Dclose(did) < 0) return -1; - return 0; out: H5E_BEGIN_TRY { - H5Dclose(dsid); + H5Dclose(did); } H5E_END_TRY; return -1; } /*------------------------------------------------------------------------- - * Function: write_dset - * - * Purpose: utility function to create and write a dataset in LOC_ID - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 12, 2003 - * - *------------------------------------------------------------------------- - */ - +* Function: write_dset +* +* Purpose: utility function to create and write a dataset in LOC_ID +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: November 12, 2003 +* +*------------------------------------------------------------------------- +*/ +static int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, - const char *dset_name, - hid_t type_id, - void *buf ) + int rank, + hsize_t *dims, + const char *dset_name, + hid_t tid, + void *buf ) { - hid_t dset_id; - hid_t space_id; + hid_t did=-1; + hid_t sid=-1; - /* Create a buf space */ - if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) return -1; + if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if (buf) + { + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto out; + } + if (H5Dclose(did) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; - /* Create a dataset */ - if((dset_id = H5Dcreate2(loc_id, dset_name, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; + return 0; - /* Write the buf */ - if(buf) - if(H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; +out: + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + return -1; +} - /* Close */ - if(H5Dclose(dset_id) < 0) - return -1; - if(H5Sclose(space_id) < 0) - return -1; + +/*------------------------------------------------------------------------- +* Function: make_attr +* +* Purpose: utility function to write an attribute in LOC_ID +* +* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* +* Date: November 12, 2003 +* +*------------------------------------------------------------------------- +*/ +static +int make_attr(hid_t loc_id, + int rank, + hsize_t *dims, + const char *attr_name, + hid_t tid, + void *buf) +{ + hid_t aid; + hid_t sid; + + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) + return -1; + if ((aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(buf) + { + if(H5Awrite(aid, tid, buf) < 0) + goto out; + } + if (H5Aclose(aid) < 0) + goto out; + if (H5Sclose(sid) < 0) + goto out; return 0; + +out: + H5E_BEGIN_TRY { + H5Aclose(aid); + H5Sclose(sid); + } H5E_END_TRY; + return -1; } /*------------------------------------------------------------------------- - * Function: write_attr - * - * Purpose: utility function to write an attribute in LOC_ID - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 12, 2003 - * - *------------------------------------------------------------------------- - */ - -int make_attr(hid_t loc_id, - int rank, - hsize_t *dims, - const char *attr_name, - hid_t type_id, - void *buf) +* Function: make_named_dtype +* +* Purpose: create a file with named datatypes in various configurations +* +*------------------------------------------------------------------------- +*/ +static +int make_named_dtype(hid_t loc_id) { - hid_t attr_id; - hid_t space_id; + hsize_t dims[1] ={3}; + hid_t did=-1; + hid_t aid=-1; + hid_t sid=-1; + hid_t tid=-1; + hid_t gid=-1; - /* create a space */ - if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) - return -1; + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto out; - /* create the attribute */ - if((attr_id = H5Acreate2(loc_id, attr_name, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + /* Create a dataset with an anonymous committed datatype as the first thing + * h5repack sees */ + if((tid = H5Tcopy(H5T_STD_I16LE)) < 0) + goto out; + if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; + if ((did = H5Dcreate2(loc_id, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; - /* write the buffer */ - if(buf) - if(H5Awrite(attr_id, type_id, buf) < 0) - goto out; + /* Create an attribute on that dataset that uses a committed datatype in + * a remote group */ + if((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Gclose(gid) < 0) + goto out; + if((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Gclose(gid) < 0) + goto out; + if((tid = H5Tcopy(H5T_STD_I16BE)) < 0) + goto out; + if(H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; + if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Aclose(aid) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; + if(H5Dclose(did) < 0) + goto out; - /* close */ - H5Aclose(attr_id); - H5Sclose(space_id); - return 0; + /* Create a dataset in the remote group that uses a committed datatype in + * the root group */ + if((tid = H5Tcopy(H5T_STD_I32LE)) < 0) + goto out; + if(H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; + if((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; -out: - H5E_BEGIN_TRY { - H5Aclose(attr_id); - H5Sclose(space_id); - } H5E_END_TRY; - return -1; -} + /* Create an attribute on the remote dataset that uses an anonymous + * committed datatype */ + if((tid = H5Tcopy(H5T_STD_I32BE)) < 0) + goto out; + if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; + if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Aclose(aid) < 0) + goto out; + /* Create another attribute that uses the same anonymous datatype */ + if((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Aclose(aid) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; + if(H5Dclose(did) < 0) + goto out; + + /* Create a dataset in the root group that uses the committed datatype in + * the root group */ + if((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0) + goto out; + if((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Dclose(did) < 0) + goto out; + + /* Create 2 attributes on the committed datatype that use that datatype */ + if((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Aclose(aid) < 0) + goto out; + if((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + if(H5Aclose(aid) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; + /* Close */ + if (H5Sclose(sid) < 0) + goto out; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Tclose(tid); + H5Aclose(aid); + H5Sclose(sid); + H5Dclose(did); + H5Gclose(gid); + } H5E_END_TRY; + return -1; +} /* end make_named_dtype() */ diff --git a/tools/h5repack/testfiles/h5repack_named_dtypes.h5 b/tools/h5repack/testfiles/h5repack_named_dtypes.h5 Binary files differnew file mode 100644 index 0000000..108bb9f --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_named_dtypes.h5 diff --git a/tools/h5repack/testfiles/h5repack_objs.h5 b/tools/h5repack/testfiles/h5repack_objs.h5 Binary files differindex 0a0c041..16d55da 100644 --- a/tools/h5repack/testfiles/h5repack_objs.h5 +++ b/tools/h5repack/testfiles/h5repack_objs.h5 diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index 3bcdd8c..48957c9 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -391,8 +391,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -520,7 +520,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 3f29521..669917c 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -380,8 +380,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -479,7 +479,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index ebf541e..5d026ea 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -273,12 +273,10 @@ hsize_t diff_array( void *_mem1, nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - #if H5_SIZEOF_LONG_DOUBLE !=0 else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); -#endif - +#endif break; case H5T_INTEGER: @@ -1842,7 +1840,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { if (ABS(temp1_float-temp2_float) > options->delta) @@ -1856,7 +1855,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + + } } /*------------------------------------------------------------------------- * !-d and -p @@ -1875,7 +1886,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_float,temp2_float); @@ -1906,7 +1918,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + + } } /*------------------------------------------------------------------------- @@ -1927,7 +1951,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_float,temp2_float); @@ -1959,7 +1984,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + + } } /*------------------------------------------------------------------------- @@ -1991,7 +2028,6 @@ hsize_t diff_datum(void *_mem1, int isnan1=0; int isnan2=0; - assert(type_size==sizeof(double)); memcpy(&temp1_double, mem1, sizeof(double)); @@ -2016,7 +2052,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { if (ABS(temp1_double-temp2_double) > options->delta) @@ -2030,8 +2067,20 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } /* NaN */ - } + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } + } /* options->d && !options->p */ /*------------------------------------------------------------------------- * !-d and -p @@ -2050,7 +2099,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_double,temp2_double); @@ -2082,7 +2132,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } } /*------------------------------------------------------------------------- @@ -2102,7 +2164,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_double,temp2_double); @@ -2135,7 +2198,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } } /*------------------------------------------------------------------------- @@ -2194,7 +2269,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { if (ABS(temp1_double-temp2_double) > options->delta) @@ -2228,7 +2304,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_double,temp2_double); @@ -2280,7 +2357,8 @@ hsize_t diff_datum(void *_mem1, isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_double,temp2_double); @@ -2791,7 +2869,8 @@ hsize_t diff_float(unsigned char *mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { if (ABS(temp1_float-temp2_float) > options->delta) { @@ -2803,7 +2882,19 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + + } mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) @@ -2831,8 +2922,8 @@ hsize_t diff_float(unsigned char *mem1, isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); } - - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_float,temp2_float); @@ -2863,7 +2954,19 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + + } mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) @@ -2893,7 +2996,8 @@ hsize_t diff_float(unsigned char *mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); } - if ( !isnan1 && !isnan2) + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) { PER(temp1_float,temp2_float); @@ -2925,7 +3029,19 @@ hsize_t diff_float(unsigned char *mem1, nfound++; } - } /* NaN */ + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + + } mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) @@ -2976,7 +3092,6 @@ hsize_t diff_float(unsigned char *mem1, } - /*------------------------------------------------------------------------- * Function: diff_double * @@ -2987,17 +3102,17 @@ hsize_t diff_float(unsigned char *mem1, *------------------------------------------------------------------------- */ hsize_t diff_double(unsigned char *mem1, - unsigned char *mem2, - hsize_t nelmts, - hsize_t hyper_start, - int rank, - hsize_t *dims, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *options, - const char *obj1, - const char *obj2, - int *ph) + unsigned char *mem2, + hsize_t nelmts, + hsize_t hyper_start, + int rank, + hsize_t *dims, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, + const char *obj2, + int *ph) { hsize_t nfound=0; /* number of differences found */ @@ -3006,18 +3121,48 @@ hsize_t diff_double(unsigned char *mem1, hsize_t i; double per; int both_zero; + int isnan1=0; + int isnan2=0; - /* -d and !-p */ + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - if (ABS(temp1_double-temp2_double) > options->delta) + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if ( options->do_nans ) + { + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); + } + + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) + { + if (ABS(temp1_double-temp2_double) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) { if ( print_data(options) ) { @@ -3026,59 +3171,91 @@ hsize_t diff_double(unsigned char *mem1, parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); } nfound++; + } mem1+=sizeof(double); mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; - } + } /* i */ } - /* !-d and -p */ + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ else if (!options->d && options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if ( options->do_nans ) { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - nfound++; + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); } + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) + { - else + PER(temp1_double,temp2_double); - if ( per > options->percent ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } nfound++; } - mem1+=sizeof(double); - mem2+=sizeof(double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } + mem1+=sizeof(double); + mem2+=sizeof(double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } - /* -d and -p */ + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ else if ( options->d && options->p) { @@ -3087,48 +3264,84 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if ( options->do_nans ) { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - nfound++; + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); } - else + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) + { + + PER(temp1_double,temp2_double); - if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } nfound++; } - mem1+=sizeof(double); - mem2+=sizeof(double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } + mem1+=sizeof(double); + mem2+=sizeof(double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ else { + + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); + if (equal_double(temp1_double,temp2_double,options)==FALSE) { if ( print_data(options) ) @@ -3144,14 +3357,22 @@ hsize_t diff_double(unsigned char *mem1, mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; + } /* nelmts */ + + + + } return nfound; } + + + /*------------------------------------------------------------------------- * Function: diff_ldouble * @@ -3162,19 +3383,19 @@ hsize_t diff_double(unsigned char *mem1, *------------------------------------------------------------------------- */ #if H5_SIZEOF_LONG_DOUBLE !=0 - + hsize_t diff_ldouble(unsigned char *mem1, - unsigned char *mem2, - hsize_t nelmts, - hsize_t hyper_start, - int rank, - hsize_t *dims, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *options, - const char *obj1, - const char *obj2, - int *ph) + unsigned char *mem2, + hsize_t nelmts, + hsize_t hyper_start, + int rank, + hsize_t *dims, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, + const char *obj2, + int *ph) { hsize_t nfound=0; /* number of differences found */ @@ -3183,79 +3404,141 @@ hsize_t diff_ldouble(unsigned char *mem1, hsize_t i; double per; int both_zero; + int isnan1=0; + int isnan2=0; - /* -d and !-p */ + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(long double)); memcpy(&temp2_double, mem2, sizeof(long double)); - if (ABS(temp1_double-temp2_double) > options->delta) + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if ( options->do_nans ) + { + isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); + } + + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) + { + if (ABS(temp1_double-temp2_double) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) { if ( print_data(options) ) { print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); } nfound++; + } mem1+=sizeof(long double); mem2+=sizeof(long double); if (options->n && nfound>=options->count) return nfound; - } + } /* i */ } - /* !-d and -p */ + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ else if (!options->d && options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(long double)); memcpy(&temp2_double, mem2, sizeof(long double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if ( options->do_nans ) { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - nfound++; + isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); } + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) + { - else + PER(temp1_double,temp2_double); - if ( per > options->percent ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(LD_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } nfound++; } - mem1+=sizeof(long double); - mem2+=sizeof(long double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } + mem1+=sizeof(long double); + mem2+=sizeof(long double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } - /* -d and -p */ + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ else if ( options->d && options->p) { @@ -3264,55 +3547,91 @@ hsize_t diff_ldouble(unsigned char *mem1, memcpy(&temp1_double, mem1, sizeof(long double)); memcpy(&temp2_double, mem2, sizeof(long double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if ( options->do_nans ) { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - nfound++; + isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); } - else + /* both not NaN, do the comparison */ + if ( isnan1==0 && isnan2==0) + { + + PER(temp1_double,temp2_double); - if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(LD_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } nfound++; } - mem1+=sizeof(long double); - mem2+=sizeof(long double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + + } + /* one is NaN, assume difference */ + else if ( isnan1==1 || isnan2==1) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + + } + mem1+=sizeof(long double); + mem2+=sizeof(long double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ else { + + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(long double)); memcpy(&temp2_double, mem2, sizeof(long double)); + if (equal_ldouble(temp1_double,temp2_double,options)==FALSE) { if ( print_data(options) ) { print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); } nfound++; } @@ -3321,15 +3640,24 @@ hsize_t diff_ldouble(unsigned char *mem1, mem2+=sizeof(long double); if (options->n && nfound>=options->count) return nfound; + } /* nelmts */ + + + + } return nfound; } - #endif /* H5_SIZEOF_LONG_DOUBLE */ + + + + + /*------------------------------------------------------------------------- * Function: diff_schar * @@ -5208,12 +5536,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) { return FALSE; - } - - /*------------------------------------------------------------------------- - * both are not NaNs, compare - *------------------------------------------------------------------------- - */ + } } BOTH_ZERO(value,expected) @@ -5274,13 +5597,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) { return FALSE; - } - - /*------------------------------------------------------------------------- - * both are not NaNs, compare - *------------------------------------------------------------------------- - */ - + } } BOTH_ZERO(value,expected) @@ -5344,13 +5661,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) { return FALSE; - } - - /*------------------------------------------------------------------------- - * both are not NaNs, compare - *------------------------------------------------------------------------- - */ - + } } BOTH_ZERO(value,expected) diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 4826a7f..0f53192 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -267,7 +267,7 @@ hsize_t diff_datasetid( hid_t did1, if (storage_size1==0 || storage_size2==0) { if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name); + parallel_print("Not comparable: <%s> or <%s> are empty datasets\n", obj1_name, obj2_name); can_compare=0; options->not_cmp=1; } @@ -317,7 +317,7 @@ hsize_t diff_datasetid( hid_t did1, { if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("<%s> has sign %s ", obj1_name, get_sign(sign1)); + parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } @@ -452,8 +452,12 @@ hsize_t diff_datasetid( hid_t did1, */ sm_nbytes = p_type_nbytes; - for (i = rank1; i > 0; --i) { - sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); + for (i = rank1; i > 0; --i) + { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(dims1[i - 1], size); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } @@ -694,7 +698,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( is_compound ) { - parallel_print("<%s> has a class %s and <%s> has a class %s\n", + parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n", obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); @@ -744,7 +748,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("<%s> and <%s> are of class %s\n", + parallel_print("Not comparable: <%s> and <%s> are of class %s\n", obj1_name,obj2_name,get_class(tclass2) ); } can_compare = 0; @@ -789,7 +793,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("<%s> has rank %d, dimensions ", obj1_name, rank1); + parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); parallel_print(", max dimensions "); print_dimensions(rank1,maxdim1); @@ -832,7 +836,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ { if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("<%s> has rank %d, dimensions ", obj1_name, rank1); + parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); if (maxdim1 && maxdim2) { @@ -891,7 +895,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("<%s> has %d members ", obj1_name, nmembs1); + parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1); parallel_print("<%s> has %d members ", obj2_name, nmembs2); parallel_print("\n"); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 6d3b0df..f28d9c5 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1651,9 +1651,12 @@ static herr_t h5tools_dump_simple_subset(FILE *stream, sm_nbytes = p_type_nbytes = H5Tget_size(p_type); if (ctx.ndims > 0) - for (i = ctx.ndims; i > 0; --i) { - sm_size[i - 1] = MIN(total_size[i - 1], H5TOOLS_BUFSIZE - / sm_nbytes); + for (i = ctx.ndims; i > 0; --i) + { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(total_size[i - 1], size); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index de1e2c3..03e6efd 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -117,7 +117,7 @@ init_ref_path_table(void) HDassert(thefile > 0); /* Create skip list to store reference path information */ - if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16))==NULL) + if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR))==NULL) return (-1); /* Iterate over objects in this file */ diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index 98f2d1d..4e95b43 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -411,8 +411,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -554,7 +554,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/tools/testfiles/tall-2A.h5.xml b/tools/testfiles/tall-2A.h5.xml index 314ab4e..ce9df3a 100644 --- a/tools/testfiles/tall-2A.h5.xml +++ b/tools/testfiles/tall-2A.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -A tall.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Attribute Name="attr1"> <hdf5:Dataspace> diff --git a/tools/testfiles/tall.h5.xml b/tools/testfiles/tall.h5.xml index 3747193..e8d39a4 100644 --- a/tools/testfiles/tall.h5.xml +++ b/tools/testfiles/tall.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tall.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Attribute Name="attr1"> <hdf5:Dataspace> diff --git a/tools/testfiles/tarray1.h5.xml b/tools/testfiles/tarray1.h5.xml index 8e68659..cff79e3 100644 --- a/tools/testfiles/tarray1.h5.xml +++ b/tools/testfiles/tarray1.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tarray1.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tarray2.h5.xml b/tools/testfiles/tarray2.h5.xml index b03f44b..f851c18 100644 --- a/tools/testfiles/tarray2.h5.xml +++ b/tools/testfiles/tarray2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tarray2.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tarray3.h5.xml b/tools/testfiles/tarray3.h5.xml index 5f0959e..a620a5e 100644 --- a/tools/testfiles/tarray3.h5.xml +++ b/tools/testfiles/tarray3.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tarray3.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tarray6.h5.xml b/tools/testfiles/tarray6.h5.xml index 2b32f99..5be8371 100644 --- a/tools/testfiles/tarray6.h5.xml +++ b/tools/testfiles/tarray6.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tarray6.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tarray7.h5.xml b/tools/testfiles/tarray7.h5.xml index c7aa380..4fb02c4 100644 --- a/tools/testfiles/tarray7.h5.xml +++ b/tools/testfiles/tarray7.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tarray7.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tattr.h5.xml b/tools/testfiles/tattr.h5.xml index d5ad730..bfde477 100644 --- a/tools/testfiles/tattr.h5.xml +++ b/tools/testfiles/tattr.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tattr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Attribute Name="attr1"> <hdf5:Dataspace> diff --git a/tools/testfiles/tbitfields.h5.xml b/tools/testfiles/tbitfields.h5.xml index 56c4cd0..28da284 100644 --- a/tools/testfiles/tbitfields.h5.xml +++ b/tools/testfiles/tbitfields.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tbitfields.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="typetests" OBJ-XID="xid_1344" H5Path="/typetests" Parents="xid_696" H5ParentPaths="/" > <hdf5:Dataset Name="bitfield_1" OBJ-XID="xid_1720" H5Path= "/typetests/bitfield_1" Parents="xid_1344" H5ParentPaths="/typetests"> diff --git a/tools/testfiles/tcompound.h5.xml b/tools/testfiles/tcompound.h5.xml index c6de351..ed255e7 100644 --- a/tools/testfiles/tcompound.h5.xml +++ b/tools/testfiles/tcompound.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tcompound.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:NamedDataType Name="#6632" OBJ-XID="xid_18446744073709551614" Parents="xid_696" H5ParentPaths="/"> <hdf5:DataType> diff --git a/tools/testfiles/tcompound2.h5.xml b/tools/testfiles/tcompound2.h5.xml index e0b087c..53e9312 100644 --- a/tools/testfiles/tcompound2.h5.xml +++ b/tools/testfiles/tcompound2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tcompound2.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:NamedDataType Name="#9560" OBJ-XID="xid_18446744073709551614" Parents="xid_696" H5ParentPaths="/"> <hdf5:DataType> diff --git a/tools/testfiles/tcompound_complex.h5.xml b/tools/testfiles/tcompound_complex.h5.xml index 693a5b8..99c1bff 100644 --- a/tools/testfiles/tcompound_complex.h5.xml +++ b/tools/testfiles/tcompound_complex.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tcompound_complex.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="CompoundComplex" OBJ-XID="xid_976" H5Path= "/CompoundComplex" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tdatareg.h5.xml b/tools/testfiles/tdatareg.h5.xml index b488409..d7dfad8 100644 --- a/tools/testfiles/tdatareg.h5.xml +++ b/tools/testfiles/tdatareg.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tdatareg.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_1284" H5Path= "/Dataset1" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tdset.h5.xml b/tools/testfiles/tdset.h5.xml index 990e788..7aedaf5 100644 --- a/tools/testfiles/tdset.h5.xml +++ b/tools/testfiles/tdset.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tdset.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="dset1" OBJ-XID="xid_976" H5Path= "/dset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tdset2.h5.xml b/tools/testfiles/tdset2.h5.xml index 33686e3..3bcaef0 100644 --- a/tools/testfiles/tdset2.h5.xml +++ b/tools/testfiles/tdset2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tdset2.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="dset1" OBJ-XID="xid_744" H5Path= "/dset1" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tempty-dtd-2.h5.xml b/tools/testfiles/tempty-dtd-2.h5.xml index 70f2567..bf5a5d2 100644 --- a/tools/testfiles/tempty-dtd-2.h5.xml +++ b/tools/testfiles/tempty-dtd-2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -u tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://hdfgroup.org/DTDs/HDF5-File.dtd"> +<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://www.hdfgroup.org/DTDs/HDF5-File.dtd"> <HDF5-File> <RootGroup OBJ-XID="xid_928" H5Path="/"> <Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> diff --git a/tools/testfiles/tempty-dtd.h5.xml b/tools/testfiles/tempty-dtd.h5.xml index a9bf259..8d15505 100644 --- a/tools/testfiles/tempty-dtd.h5.xml +++ b/tools/testfiles/tempty-dtd.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml --use-dtd tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://hdfgroup.org/DTDs/HDF5-File.dtd"> +<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://www.hdfgroup.org/DTDs/HDF5-File.dtd"> <HDF5-File> <RootGroup OBJ-XID="xid_928" H5Path="/"> <Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> diff --git a/tools/testfiles/tempty-nons-2.h5.xml b/tools/testfiles/tempty-nons-2.h5.xml index 94239b4..c9dc971 100644 --- a/tools/testfiles/tempty-nons-2.h5.xml +++ b/tools/testfiles/tempty-nons-2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml --xml-ns=: tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<HDF5-File xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<HDF5-File xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <RootGroup OBJ-XID="xid_928" H5Path="/"> <Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> <StorageLayout> diff --git a/tools/testfiles/tempty-nons.h5.xml b/tools/testfiles/tempty-nons.h5.xml index 2a4d9ab..25536d9 100644 --- a/tools/testfiles/tempty-nons.h5.xml +++ b/tools/testfiles/tempty-nons.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -X : tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<HDF5-File xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<HDF5-File xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <RootGroup OBJ-XID="xid_928" H5Path="/"> <Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> <StorageLayout> diff --git a/tools/testfiles/tempty-ns-2.h5.xml b/tools/testfiles/tempty-ns-2.h5.xml index 6102b39..4851e5c 100644 --- a/tools/testfiles/tempty-ns-2.h5.xml +++ b/tools/testfiles/tempty-ns-2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml --xml-ns=thing: tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<thing:HDF5-File xmlns:thing="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<thing:HDF5-File xmlns:thing="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <thing:RootGroup OBJ-XID="xid_928" H5Path="/"> <thing:Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> <thing:StorageLayout> diff --git a/tools/testfiles/tempty-ns.h5.xml b/tools/testfiles/tempty-ns.h5.xml index 9a1ba94..01ae896 100644 --- a/tools/testfiles/tempty-ns.h5.xml +++ b/tools/testfiles/tempty-ns.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -X thing: tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<thing:HDF5-File xmlns:thing="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<thing:HDF5-File xmlns:thing="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <thing:RootGroup OBJ-XID="xid_928" H5Path="/"> <thing:Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> <thing:StorageLayout> diff --git a/tools/testfiles/tempty.h5.xml b/tools/testfiles/tempty.h5.xml index 5c642d6..4ff8c95 100644 --- a/tools/testfiles/tempty.h5.xml +++ b/tools/testfiles/tempty.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tempty.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tenum.h5.xml b/tools/testfiles/tenum.h5.xml index d3e01e5..d8adc1b 100644 --- a/tools/testfiles/tenum.h5.xml +++ b/tools/testfiles/tenum.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tenum.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:NamedDataType Name="enum normal" OBJ-XID="xid_976" H5Path="/enum normal" Parents="xid_928" H5ParentPaths="/"> <hdf5:DataType> diff --git a/tools/testfiles/textlink.h5.xml b/tools/testfiles/textlink.h5.xml index 0ea7084..f6666a8 100644 --- a/tools/testfiles/textlink.h5.xml +++ b/tools/testfiles/textlink.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml textlink.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:ExternalLink LinkName="extlink1" OBJ-XID="xid_18446744073709551614" H5SourcePath="/extlink1" TargetFilename="filename" TargetPath="objname" Parents="xid_96" H5ParentPaths="/" /> <hdf5:ExternalLink LinkName="extlink2" OBJ-XID="xid_18446744073709551613" H5SourcePath="/extlink2" TargetFilename="anotherfile" TargetPath="anotherobj" Parents="xid_96" H5ParentPaths="/" /> diff --git a/tools/testfiles/tgroup.h5.xml b/tools/testfiles/tgroup.h5.xml index 4df9638..00f5a0b 100644 --- a/tools/testfiles/tgroup.h5.xml +++ b/tools/testfiles/tgroup.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tgroup.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="g1" OBJ-XID="xid_1344" H5Path="/g1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Group Name="g1.1" OBJ-XID="xid_3616" H5Path="/g1/g1.1" Parents="xid_1344" H5ParentPaths="/g1" > diff --git a/tools/testfiles/thlink.h5.xml b/tools/testfiles/thlink.h5.xml index c2737b9..19bc816 100644 --- a/tools/testfiles/thlink.h5.xml +++ b/tools/testfiles/thlink.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml thlink.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Dataset Name="dset1" OBJ-XID="xid_808" H5Path= "/dset1" Parents="xid_96" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tloop.h5.xml b/tools/testfiles/tloop.h5.xml index eba827e..d8a5080 100644 --- a/tools/testfiles/tloop.h5.xml +++ b/tools/testfiles/tloop.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tloop.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="g1" OBJ-XID="xid_1344" H5Path="/g1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Group Name="g1.1" OBJ-XID="xid_2320" H5Path="/g1/g1.1" Parents="xid_1344" H5ParentPaths="/g1" > diff --git a/tools/testfiles/tloop2.h5.xml b/tools/testfiles/tloop2.h5.xml index 2eb8e29..73ac4e0 100644 --- a/tools/testfiles/tloop2.h5.xml +++ b/tools/testfiles/tloop2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tloop2.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="g1" OBJ-XID="xid_1344" H5Path="/g1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Group Name="g1.1" OBJ-XID="xid_2320" H5Path="/g1/g1.1" Parents="xid_1344" H5ParentPaths="/g1" > diff --git a/tools/testfiles/tmany.h5.xml b/tools/testfiles/tmany.h5.xml index 93a0610..59b856f 100644 --- a/tools/testfiles/tmany.h5.xml +++ b/tools/testfiles/tmany.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tmany.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Group Name="g1" OBJ-XID="xid_800" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" > <hdf5:Group Name="g1.1" OBJ-XID="xid_1832" H5Path="/g1/g1.1" Parents="xid_800" H5ParentPaths="/g1" > diff --git a/tools/testfiles/tname-amp.h5.xml b/tools/testfiles/tname-amp.h5.xml index 26df9f5..b443f22 100644 --- a/tools/testfiles/tname-amp.h5.xml +++ b/tools/testfiles/tname-amp.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tname-amp.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Attribute Name="attr1&withamp"> <hdf5:Dataspace> diff --git a/tools/testfiles/tname-apos.h5.xml b/tools/testfiles/tname-apos.h5.xml index 34fca8b..f60fa48 100644 --- a/tools/testfiles/tname-apos.h5.xml +++ b/tools/testfiles/tname-apos.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tname-apos.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Attribute Name="attr1'withapos"> <hdf5:Dataspace> diff --git a/tools/testfiles/tname-gt.h5.xml b/tools/testfiles/tname-gt.h5.xml index a30a30c..43d9a50 100644 --- a/tools/testfiles/tname-gt.h5.xml +++ b/tools/testfiles/tname-gt.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tname-gt.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Attribute Name="attr1>withgt"> <hdf5:Dataspace> diff --git a/tools/testfiles/tname-lt.h5.xml b/tools/testfiles/tname-lt.h5.xml index 4be63e1..4e948c9 100644 --- a/tools/testfiles/tname-lt.h5.xml +++ b/tools/testfiles/tname-lt.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tname-lt.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Attribute Name="attr1<withlt"> <hdf5:Dataspace> diff --git a/tools/testfiles/tname-quot.h5.xml b/tools/testfiles/tname-quot.h5.xml index 65e46ef..e148630 100644 --- a/tools/testfiles/tname-quot.h5.xml +++ b/tools/testfiles/tname-quot.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tname-quot.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Attribute Name="attr1"withquot"> <hdf5:Dataspace> diff --git a/tools/testfiles/tname-sp.h5.xml b/tools/testfiles/tname-sp.h5.xml index fbc790c..231d0d5 100644 --- a/tools/testfiles/tname-sp.h5.xml +++ b/tools/testfiles/tname-sp.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tname-sp.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Attribute Name="attr1 withspace"> <hdf5:Dataspace> diff --git a/tools/testfiles/tnamed_dtype_attr.h5.xml b/tools/testfiles/tnamed_dtype_attr.h5.xml index 2e3cfa3..ebba88b 100644 --- a/tools/testfiles/tnamed_dtype_attr.h5.xml +++ b/tools/testfiles/tnamed_dtype_attr.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tnamed_dtype_attr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Dataset Name="Dataset" OBJ-XID="xid_1256" H5Path= "/Dataset" Parents="xid_96" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tnestedcomp.h5.xml b/tools/testfiles/tnestedcomp.h5.xml index 30ee392..a2f928b 100644 --- a/tools/testfiles/tnestedcomp.h5.xml +++ b/tools/testfiles/tnestedcomp.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tnestedcomp.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="ArrayOfStructures" OBJ-XID="xid_744" H5Path= "/ArrayOfStructures" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tnodata.h5.xml b/tools/testfiles/tnodata.h5.xml index 8b9b3a1..762475e 100644 --- a/tools/testfiles/tnodata.h5.xml +++ b/tools/testfiles/tnodata.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tnodata.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="dset1" OBJ-XID="xid_744" H5Path= "/dset1" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tobjref.h5.xml b/tools/testfiles/tobjref.h5.xml index 327291e..825cb27 100644 --- a/tools/testfiles/tobjref.h5.xml +++ b/tools/testfiles/tobjref.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tobjref.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="Dataset3" OBJ-XID="xid_2348" H5Path= "/Dataset3" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/topaque.h5.xml b/tools/testfiles/topaque.h5.xml index 0889251..3f44ace 100644 --- a/tools/testfiles/topaque.h5.xml +++ b/tools/testfiles/topaque.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml topaque.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="opaque test" OBJ-XID="xid_744" H5Path= "/opaque test" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/torderattr1.h5.xml b/tools/testfiles/torderattr1.h5.xml index fcbe444..15481fc 100644 --- a/tools/testfiles/torderattr1.h5.xml +++ b/tools/testfiles/torderattr1.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -H --sort_by=name --sort_order=ascending torderattr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Attribute Name="a"> <hdf5:Dataspace> diff --git a/tools/testfiles/torderattr2.h5.xml b/tools/testfiles/torderattr2.h5.xml index 5f2b434..ef28140 100644 --- a/tools/testfiles/torderattr2.h5.xml +++ b/tools/testfiles/torderattr2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -H --sort_by=name --sort_order=descending torderattr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Attribute Name="c"> <hdf5:Dataspace> diff --git a/tools/testfiles/torderattr3.h5.xml b/tools/testfiles/torderattr3.h5.xml index 6488711..e9e131a 100644 --- a/tools/testfiles/torderattr3.h5.xml +++ b/tools/testfiles/torderattr3.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Attribute Name="a"> <hdf5:Dataspace> diff --git a/tools/testfiles/torderattr4.h5.xml b/tools/testfiles/torderattr4.h5.xml index c6fa0ad..2f4a2ed 100644 --- a/tools/testfiles/torderattr4.h5.xml +++ b/tools/testfiles/torderattr4.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:Attribute Name="c"> <hdf5:Dataspace> diff --git a/tools/testfiles/tref-escapes-at.h5.xml b/tools/testfiles/tref-escapes-at.h5.xml index b7a1158..6d683f1 100644 --- a/tools/testfiles/tref-escapes-at.h5.xml +++ b/tools/testfiles/tref-escapes-at.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tref-escapes-at.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="Group1" OBJ-XID="xid_1344" H5Path="/Group1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Dataset Name="Dataset space" OBJ-XID="xid_3716" H5Path= "/Group1/Dataset space" Parents="xid_1344" H5ParentPaths="/Group1"> diff --git a/tools/testfiles/tref-escapes.h5.xml b/tools/testfiles/tref-escapes.h5.xml index de42418..6d43069 100644 --- a/tools/testfiles/tref-escapes.h5.xml +++ b/tools/testfiles/tref-escapes.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tref-escapes.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="Group1" OBJ-XID="xid_1344" H5Path="/Group1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Dataset Name="Dataset space" OBJ-XID="xid_1720" H5Path= "/Group1/Dataset space" Parents="xid_1344" H5ParentPaths="/Group1"> diff --git a/tools/testfiles/tref.h5.xml b/tools/testfiles/tref.h5.xml index 6b093de..8a39acf 100644 --- a/tools/testfiles/tref.h5.xml +++ b/tools/testfiles/tref.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tref.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="Group1" OBJ-XID="xid_1344" H5Path="/Group1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_1720" H5Path= "/Group1/Dataset1" Parents="xid_1344" H5ParentPaths="/Group1"> diff --git a/tools/testfiles/tsaf.h5.xml b/tools/testfiles/tsaf.h5.xml index 3f4ef38..11808e3 100644 --- a/tools/testfiles/tsaf.h5.xml +++ b/tools/testfiles/tsaf.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tsaf.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name=".DSL_METADATA" OBJ-XID="xid_744" H5Path= "/.DSL_METADATA" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tslink.h5.xml b/tools/testfiles/tslink.h5.xml index 97d49d6..f31f425 100644 --- a/tools/testfiles/tslink.h5.xml +++ b/tools/testfiles/tslink.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tslink.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:SoftLink LinkName="slink1" OBJ-XID="xid_18446744073709551614" H5SourcePath="/slink1" TargetPath="somevalue" Parents="xid_696" H5ParentPaths="/" /> <hdf5:SoftLink LinkName="slink2" OBJ-XID="xid_18446744073709551613" H5SourcePath="/slink2" TargetPath="linkvalue" Parents="xid_696" H5ParentPaths="/" /> diff --git a/tools/testfiles/tstr.h5.xml b/tools/testfiles/tstr.h5.xml index 4ee36db..aa429a8 100644 --- a/tools/testfiles/tstr.h5.xml +++ b/tools/testfiles/tstr.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tstr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="comp1" OBJ-XID="xid_2520" H5Path= "/comp1" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tstr2.h5.xml b/tools/testfiles/tstr2.h5.xml index 277d9ae..62283be 100644 --- a/tools/testfiles/tstr2.h5.xml +++ b/tools/testfiles/tstr2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tstr2.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Group Name="g1" OBJ-XID="xid_1344" H5Path="/g1" Parents="xid_696" H5ParentPaths="/" > <hdf5:Dataset Name="dset1" OBJ-XID="xid_1720" H5Path= "/g1/dset1" Parents="xid_1344" H5ParentPaths="/g1"> diff --git a/tools/testfiles/tstring-at.h5.xml b/tools/testfiles/tstring-at.h5.xml index bd6e412..29e2b90 100644 --- a/tools/testfiles/tstring-at.h5.xml +++ b/tools/testfiles/tstring-at.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tstring-at.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_696" H5Path="/"> <hdf5:Dataset Name="dset1" OBJ-XID="xid_744" H5Path= "/dset1" Parents="xid_696" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tstring.h5.xml b/tools/testfiles/tstring.h5.xml index 945f61a..d83ea0e 100644 --- a/tools/testfiles/tstring.h5.xml +++ b/tools/testfiles/tstring.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tstring.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="dset1" OBJ-XID="xid_976" H5Path= "/dset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tudlink.h5.xml b/tools/testfiles/tudlink.h5.xml index 43bf34e..bc55a83 100644 --- a/tools/testfiles/tudlink.h5.xml +++ b/tools/testfiles/tudlink.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tudlink.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_96" H5Path="/"> <hdf5:UserDefined LinkName="udlink1" OBJ-XID="xid_18446744073709551614" H5SourcePath="/udlink1" LinkClass="187" Parents="xid_96" H5ParentPaths="/" /> <hdf5:UserDefined LinkName="udlink2" OBJ-XID="xid_18446744073709551613" H5SourcePath="/udlink2" LinkClass="187" Parents="xid_96" H5ParentPaths="/" /> diff --git a/tools/testfiles/tvldtypes1.h5.xml b/tools/testfiles/tvldtypes1.h5.xml index 8facbec..34eb276 100644 --- a/tools/testfiles/tvldtypes1.h5.xml +++ b/tools/testfiles/tvldtypes1.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tvldtypes1.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1.0" OBJ-XID="xid_976" H5Path= "/Dataset1.0" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tvldtypes2.h5.xml b/tools/testfiles/tvldtypes2.h5.xml index c741845..d7e644c 100644 --- a/tools/testfiles/tvldtypes2.h5.xml +++ b/tools/testfiles/tvldtypes2.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tvldtypes2.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tvldtypes3.h5.xml b/tools/testfiles/tvldtypes3.h5.xml index d1122ad..627b2ca 100644 --- a/tools/testfiles/tvldtypes3.h5.xml +++ b/tools/testfiles/tvldtypes3.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tvldtypes3.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tvldtypes4.h5.xml b/tools/testfiles/tvldtypes4.h5.xml index 8433f48..de2a476 100644 --- a/tools/testfiles/tvldtypes4.h5.xml +++ b/tools/testfiles/tvldtypes4.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tvldtypes4.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tvldtypes5.h5.xml b/tools/testfiles/tvldtypes5.h5.xml index c4f1eb1..92d5f0c 100644 --- a/tools/testfiles/tvldtypes5.h5.xml +++ b/tools/testfiles/tvldtypes5.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tvldtypes5.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Dataset Name="Dataset" OBJ-XID="xid_976" H5Path= "/Dataset" Parents="xid_928" H5ParentPaths="/"> <hdf5:StorageLayout> diff --git a/tools/testfiles/tvlstr.h5.xml b/tools/testfiles/tvlstr.h5.xml index 98a3b30..5999abd 100644 --- a/tools/testfiles/tvlstr.h5.xml +++ b/tools/testfiles/tvlstr.h5.xml @@ -2,7 +2,7 @@ Expected output for 'h5dump --xml tvlstr.h5' ############################# <?xml version="1.0" encoding="UTF-8"?> -<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd"> +<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5-File http://www.hdfgroup.org/DTDs/HDF5-File.xsd"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> <hdf5:Attribute Name="test_scalar"> <hdf5:Dataspace> |