From 2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Mon, 31 Aug 1998 14:21:23 -0500 Subject: [svn-r635] Changes since 19980831 ---------------------- ./Makefile.in Running `make distclean' will not fail if one of the subdirectories has already been cleaned. ./config/BlankForm ./config/irix5.3 Cleaned it up more. Added better support/documentation for systems that have more than one compiler. ./config/alpha-dec-osf4.0 [NEW] Added a new config file as a result of testing on Jim Reus's machine. ./test/chunk.c Scaled down the testing range so we can actually run it interactively. ./tools/h5import.c Included to get rid of warning for close(). ./src/H5detect.c Seg-faults on Linux for some reason when NDEBUG is defined, so I just undef it at the top of the source. ./test/big.c Added a fflush(). ./tools/h5ls.c The `-d' flag now works even when `-v' isn't specified. ./examples/h5_chunk_read.c ./examples/h5_compound.c ./examples/h5_extend_write.c ./examples/h5_group.c ./examples/h5_read.c ./examples/h5_write.c Indented according to hdf5 standards. Fixed compiler warnings --- Makefile.in | 18 +-- README | 2 +- config/BlankForm | 101 ++++++++++--- config/alpha-dec-osf4.0 | 104 +++++++++++++ config/irix5.3 | 58 ++++---- examples/h5_chunk_read.c | 324 ++++++++++++++++++++-------------------- examples/h5_compound.c | 263 ++++++++++++++++----------------- examples/h5_extend_write.c | 304 +++++++++++++++++++------------------- examples/h5_group.c | 205 +++++++++++++------------- examples/h5_read.c | 198 +++++++++++++------------ examples/h5_write.c | 116 ++++++++------- src/.distdep | 360 ++++++++++++++++++++++----------------------- src/H5detect.c | 2 + test/big.c | 1 + test/chunk.c | 12 +- tools/h5import.c | 1 + tools/h5ls.c | 2 +- 17 files changed, 1128 insertions(+), 943 deletions(-) create mode 100644 config/alpha-dec-osf4.0 diff --git a/Makefile.in b/Makefile.in index f7d947f..bb94c74 100644 --- a/Makefile.in +++ b/Makefile.in @@ -76,23 +76,23 @@ H5Tinit.c: clean mostlyclean: @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ + (cd $$d && $(MAKE) $@); \ done distclean: @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ + (cd $$d && $(MAKE) $@); \ done - $(RM) config/commence config/conclude config/depend - $(RM) config.cache config.log config.status src/H5config.h - $(RM) Makefile - $(CP) Makefile.dist Makefile + -$(RM) config/commence config/conclude config/depend + -$(RM) config.cache config.log config.status src/H5config.h + -$(RM) Makefile + -$(CP) Makefile.dist Makefile maintainer-clean: @echo "This command is intented for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@SETX@; for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE) $@) || exit 1; \ + (cd $$d && $(MAKE) $@); \ done - $(RM) config.cache config.log config.status src/H5config.h - $(RM) configure src/H5config.h.in + -$(RM) config.cache config.log config.status src/H5config.h + -$(RM) configure src/H5config.h.in diff --git a/README b/README index 03b9406..cf0f44c 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is hdf5-1.0.75 released on Fri Aug 28 16:07:31 EDT 1998 +This is hdf5-1.0.75 released on Mon Aug 31 11:01:09 CDT 1998 Please refer to the INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/config/BlankForm b/config/BlankForm index 5ff807b..6b76385 100644 --- a/config/BlankForm +++ b/config/BlankForm @@ -9,31 +9,96 @@ # Compiler flags. The CPPFLAGS values should not include package debug # flags like `-DH5G_DEBUG' since these are added with the # `--enable-debug' switch of configure. +#---------------------------------------------------------------------------- -# Sometimes a particular compiler must be used. If that's the case -# then uncomment the following line. Otherwise the main configure -# script will try to detect the compiler automatically. -#CC=gcc -# What must *always* be present for things to compile correctly? -#CFLAGS="$CFLAGS -ansi" -#CPPFLAGS="$CPPFLAGS -I." +# Choosing a C Compiler +# --------------------- +# +# Configre will use the value of environment variable `CC' if it is +# set. If not then configure checks for a working GNU `gcc' followed +# by other common compiler names. If a default compiler is desired +# then uncomment the following line, replacing `gcc' with the name of +# the default compiler. -# What compiler flags should be used for code development? -DEBUG_CFLAGS=-g -DEBUG_CPPFLAGS= +#CC=${CC:-gcc} -# What compiler flags should be used for building a production -# library? -PROD_CFLAGS=-O -PROD_CPPFLAGS= -# What compiler flags enable code profiling? -PROFILE_CFLAGS=-pg -PROFILE_CPPFLAGS= -#---------------------------------------------------------------------------- +# C Compiler and Preprocessor Flags +# --------------------------------- +# +# Flags that end with `_CFLAGS' are always passed to the compiler. +# Flags that end with `_CPPFLAGS' are passed to the compiler when +# compiling but not when linking. +# +# DEBUG_CFLAGS Flags to pass to the compiler to create a +# DEBUG_CPPFLAGS library suitable for use with debugging +# tools. Usually this list will exclude +# optimization switches (like `-O') and include +# switches that turn on symbolic debugging +# support (like `-g'). +# +# PROD_CFLAGS Flags to pass to the compiler to create a +# PROD_CPPFLAGS production version of the library. These +# usualy exclude symbolic debugging switches +# (like `-g') and include optimization switches +# (like `-O'). +# +# PROFILE_CFLAGS Flags to pass to the compiler to create a +# PROFILE_CPPFLAGS library suitable for performance testing (like +# `-pg'). This may or may not include debugging +# or production flags. +# +# CFLAGS Flags can be added to this variable which +# might already be partially initialized. These +# flags will always be passed to the compiler +# and should include switches to turn on full +# warnings. HDF5 attempts to be ANSI and Posix +# compliant and employ good programming +# practices resulting in few if any +# warnings. +# +# Note: Warning flags do not have to be added to CFLAGS +# variable if the compiler is the GNU gcc +# compiler or a descendent of gcc. +# +# Note: The CFLAGS should contains *something* or else +# configure will probably add `-g'. For most +# systems this isn't a problem but some systems +# will disable optimizations in favor of the +# `-g'. +# +# + +case "$CC" in + *gcc*) + CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-mcpu=pentiumpro -march=pentiumpro -O3 -finline-functions -malign-double -fomit-frame-pointer -fschedule-insns2" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + *) + CFLAGS="$CFLAGS -ansi" + DEBUG_FLAGS="-g" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; +esac + + + +# Overriding Configure Tests +# -------------------------- +# # Values for overriding configuration tests when cross compiling. # This includes compiling on some machines where the serial front end # compiles for a parallel back end. diff --git a/config/alpha-dec-osf4.0 b/config/alpha-dec-osf4.0 new file mode 100644 index 0000000..4c9d0db --- /dev/null +++ b/config/alpha-dec-osf4.0 @@ -0,0 +1,104 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. +#---------------------------------------------------------------------------- + + +# Choosing a C Compiler +# --------------------- +# +# Configre will use the value of environment variable `CC' if it is +# set. If not then configure checks for a working GNU `gcc' followed +# by other common compiler names. If a default compiler is desired +# then uncomment the following line, replacing `gcc' with the name of +# the default compiler. + +#CC=${CC:-gcc} + + + + +# C Compiler and Preprocessor Flags +# --------------------------------- +# +# Flags that end with `_CFLAGS' are always passed to the compiler. +# Flags that end with `_CPPFLAGS' are passed to the compiler when +# compiling but not when linking. +# +# DEBUG_CFLAGS Flags to pass to the compiler to create a +# DEBUG_CPPFLAGS library suitable for use with debugging +# tools. Usually this list will exclude +# optimization switches (like `-O') and include +# switches that turn on symbolic debugging +# support (like `-g'). +# +# PROD_CFLAGS Flags to pass to the compiler to create a +# PROD_CPPFLAGS production version of the library. These +# usualy exclude symbolic debugging switches +# (like `-g') and include optimization switches +# (like `-O'). +# +# PROFILE_CFLAGS Flags to pass to the compiler to create a +# PROFILE_CPPFLAGS library suitable for performance testing (like +# `-pg'). This may or may not include debugging +# or production flags. +# +# CFLAGS Flags can be added to this variable which +# might already be partially initialized. These +# flags will always be passed to the compiler +# and should include switches to turn on full +# warnings. HDF5 attempts to be ANSI and Posix +# compliant and employ good programming +# practices resulting in few if any +# warnings. Note: warning flags do not have to +# be added to this variable if the compiler is +# the GNU gcc compiler or a descendent of gcc. +# + +case "$CC" in + *gcc*) + CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O3" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + *) + #CFLAGS="$CFLAGS" + DEBUG_CFLAGS="-g" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-g0 -fast -tune host" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; +esac + + + +# Overriding Configure Tests +# -------------------------- +# +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} + +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} diff --git a/config/irix5.3 b/config/irix5.3 index acc375e..cba1bbd 100644 --- a/config/irix5.3 +++ b/config/irix5.3 @@ -3,6 +3,11 @@ # This file is part of the HDF5 build script. It is processed shortly # after configure starts and defines, among other things, flags for # the various compile modes. +# +# Modifications: +# Robb Matzke, 1998-08-31 +# Removed `-ansi' from the CFLAGS because it caused sigaction() +# to not be compiled. #---------------------------------------------------------------------------- @@ -13,38 +18,27 @@ # Sometimes a particular compiler must be used. If that's the case # then uncomment the following line. Otherwise the main configure # script will try to detect the compiler automatically. -CC=cc +CC=${CC:-cc} RANLIB=: -# What must *always* be present for things to compile correctly? -CFLAGS="$CFLAGS -ansi -fullwarn -woff 799" -#CPPFLAGS="$CPPFLAGS -I." - -# What compiler flags should be used for code development? -DEBUG_CFLAGS=-g -DEBUG_CPPFLAGS= - -# What compiler flags should be used for building a production -# library? -PROD_CFLAGS=-O -PROD_CPPFLAGS= - -# What compiler flags enable code profiling? -PROFILE_CFLAGS=-pg -PROFILE_CPPFLAGS= - - -#---------------------------------------------------------------------------- -# Values for overriding configuration tests when cross compiling. -# This includes compiling on some machines where the serial front end -# compiles for a parallel back end. - -# Set this to `yes' or `no' depending on whether the target is big -# endian or little endian. -#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} - -# Set this to the width required by printf() to print type `long -# long'. For instance, if the format would be `%lld' then set it to -# `ll' or if the format would be `%qd' set it to `q'. -#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} +case $CC in + *gcc*) + CFLAGS="$CFLAGS -ansi" + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS="-DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O3 -finline-functions" + PROD_CPPFLAGS= + PROFILE_CFLAGS=-pg + PROFILE_CPPFLAGS= + ;; + *) + CFLAGS="$CFLAGS -fullwarn -prototypes -woff 799" + DEBUG_CFLAGS=-g + DEBUG_CPPFLAGS= + PROD_CFLAGS=-O + PROD_CPPFLAGS= + PROFILE_CFLAGS=-pg + PROFILE_CPPFLAGS= + ;; +esac diff --git a/examples/h5_chunk_read.c b/examples/h5_chunk_read.c index 681febc..0ee70db 100644 --- a/examples/h5_chunk_read.c +++ b/examples/h5_chunk_read.c @@ -12,177 +12,177 @@ #define NX 10 #define NY 5 -main () +int +main (void) { - hid_t file; /* handles */ - hid_t datatype, dataset; - hid_t filespace; - hid_t memspace; - hid_t cparms; - H5T_class_t class; /* data type class */ - size_t elem_size; /* size of the data element - stored in file */ - hsize_t dims[2]; /* dataset and chunk dimensions */ - hsize_t chunk_dims[2]; - hsize_t col_dims[1]; - size_t size[2]; - hsize_t count[2]; - hsize_t offset[2]; - - herr_t status, status_n; - - int data_out[NX][NY]; /* buffer for dataset to be read */ - int chunk_out[2][5]; /* buffer for chunk to be read */ - int column[10]; /* buffer for column to be read */ - int i, j, rank, rank_chunk; + hid_t file; /* handles */ + hid_t dataset; + hid_t filespace; + hid_t memspace; + hid_t cparms; + hsize_t dims[2]; /* dataset and chunk dimensions*/ + hsize_t chunk_dims[2]; + hsize_t col_dims[1]; + hsize_t count[2]; + hsize_t offset[2]; + + herr_t status, status_n; + + int data_out[NX][NY]; /* buffer for dataset to be read */ + int chunk_out[2][5]; /* buffer for chunk to be read */ + int column[10]; /* buffer for column to be read */ + int rank, rank_chunk; + hsize_t i, j; + -/* - * Open the file and the dataset. - */ -file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); -dataset = H5Dopen(file, DATASETNAME); - -/* - * Get dataset rank and dimension. - */ + /* + * Open the file and the dataset. + */ + file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen(file, DATASETNAME); -filespace = H5Dget_space(dataset); /* Get filespace handle first. */ -rank = H5Sextent_ndims(filespace); -status_n = H5Sextent_dims(filespace, dims, NULL); -printf("dataset rank %d, dimensions %d x %d \n", rank, dims[0], dims[1]); - -/* - * Get creation properties list. - */ -cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */ - -/* - * Check if dataset is chunked. - */ - if (H5D_CHUNKED == H5Pget_layout(cparms)) { - -/* - * Get chunking information: rank and dimensions - */ -rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims); -printf("chunk rank %d, dimensions %d x %d \n", rank_chunk, - chunk_dims[0], chunk_dims[1]); -} + /* + * Get dataset rank and dimension. + */ + + filespace = H5Dget_space(dataset); /* Get filespace handle first. */ + rank = H5Sextent_ndims(filespace); + status_n = H5Sextent_dims(filespace, dims, NULL); + printf("dataset rank %d, dimensions %lu x %lu\n", + rank, (unsigned long)(dims[0]), (unsigned long)(dims[1])); + + /* + * Get creation properties list. + */ + cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */ + + /* + * Check if dataset is chunked. + */ + if (H5D_CHUNKED == H5Pget_layout(cparms)) { + + /* + * Get chunking information: rank and dimensions + */ + rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims); + printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, + (unsigned long)(chunk_dims[0]), (unsigned long)(chunk_dims[1])); + } -/* - * Define the memory space to read dataset. - */ -memspace = H5Screate_simple(RANK,dims,NULL); + /* + * Define the memory space to read dataset. + */ + memspace = H5Screate_simple(RANK,dims,NULL); -/* - * Read dataset back and display. - */ -status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, - H5P_DEFAULT, data_out); + /* + * Read dataset back and display. + */ + status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, data_out); printf("\n"); printf("Dataset: \n"); -for (j = 0; j < dims[0]; j++) { - for (i = 0; i < dims[1]; i++) printf("%d ", data_out[j][i]); + for (j = 0; j < dims[0]; j++) { + for (i = 0; i < dims[1]; i++) printf("%d ", data_out[j][i]); + printf("\n"); + } + + /* + * dataset rank 2, dimensions 10 x 5 + * chunk rank 2, dimensions 2 x 5 + + * Dataset: + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + */ + + /* + * Read the third column from the dataset. + * First define memory dataspace, then define hyperslab + * and read it into column array. + */ + col_dims[0] = 10; + memspace = H5Screate_simple(RANKC, col_dims, NULL); + + /* + * Define the column (hyperslab) to read. + */ + offset[0] = 0; + offset[1] = 2; + count[0] = 10; + count[1] = 1; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, + count, NULL); + status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, column); printf("\n"); -} - -/* - dataset rank 2, dimensions 10 x 5 - chunk rank 2, dimensions 2 x 5 - - Dataset: - 1 1 1 3 3 - 1 1 1 3 3 - 1 1 1 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 -*/ - -/* - * Read the third column from the dataset. - * First define memory dataspace, then define hyperslab - * and read it into column array. - */ -col_dims[0] = 10; -memspace = H5Screate_simple(RANKC, col_dims, NULL); - -/* - * Define the column (hyperslab) to read. - */ -offset[0] = 0; -offset[1] = 2; -count[0] = 10; -count[1] = 1; -status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, - count, NULL); -status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, - H5P_DEFAULT, column); -printf("\n"); -printf("Third column: \n"); -for (i = 0; i < 10; i++) { - printf("%d \n", column[i]); -} - -/* - - Third column: - 1 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 -*/ - -/* - * Define the memory space to read a chunk. - */ -memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL); - -/* - * Define chunk in the file (hyperslab) to read. - */ -offset[0] = 2; -offset[1] = 0; -count[0] = chunk_dims[0]; -count[1] = chunk_dims[1]; -status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, - count, NULL); - -/* - * Read chunk back and display. - */ -status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, - H5P_DEFAULT, chunk_out); + printf("Third column: \n"); + for (i = 0; i < 10; i++) { + printf("%d \n", column[i]); + } + + /* + * Third column: + * 1 + * 1 + * 1 + * 0 + * 0 + * 0 + * 0 + * 0 + * 0 + * 0 + */ + + /* + * Define the memory space to read a chunk. + */ + memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL); + + /* + * Define chunk in the file (hyperslab) to read. + */ + offset[0] = 2; + offset[1] = 0; + count[0] = chunk_dims[0]; + count[1] = chunk_dims[1]; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, + count, NULL); + + /* + * Read chunk back and display. + */ + status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, chunk_out); printf("\n"); printf("Chunk: \n"); -for (j = 0; j < chunk_dims[0]; j++) { - for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]); - printf("\n"); -} -/* - Chunk: - 1 1 1 0 0 - 2 0 0 0 0 -*/ - -/* - * Close/release resources. - */ -H5Pclose(cparms); -H5Dclose(dataset); -H5Sclose(filespace); -H5Sclose(memspace); -H5Fclose(file); - + for (j = 0; j < chunk_dims[0]; j++) { + for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]); + printf("\n"); + } + /* + * Chunk: + * 1 1 1 0 0 + * 2 0 0 0 0 + */ + + /* + * Close/release resources. + */ + H5Pclose(cparms); + H5Dclose(dataset); + H5Sclose(filespace); + H5Sclose(memspace); + H5Fclose(file); + + return 0; } diff --git a/examples/h5_compound.c b/examples/h5_compound.c index 1641ee6..00cfe34 100644 --- a/examples/h5_compound.c +++ b/examples/h5_compound.c @@ -11,142 +11,143 @@ #define LENGTH 10 #define RANK 1 -main() - +int +main(void) { - -/* First structure and dataset*/ -typedef struct s1_t { - int a; - float b; - double c; -} s1_t; -s1_t s1[LENGTH]; -hid_t s1_tid; /* File datatype hadle */ - -/* Second structure (subset of s1_t) and dataset*/ -typedef struct s2_t { - double c; - int a; -} s2_t; -s2_t s2[LENGTH]; -hid_t s2_tid; /* Memory datatype handle */ - -/* Third "structure" ( will be used to read float field of s1) */ -hid_t s3_tid; /* Memory datatype handle */ -float s3[LENGTH]; - -int i; -hid_t file, datatype, dataset, space; /* Handles */ -herr_t status; -hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */ - - -/* - * Initialize the data - */ - for (i = 0; i< LENGTH; i++) { + /* First structure and dataset*/ + typedef struct s1_t { + int a; + float b; + double c; + } s1_t; + s1_t s1[LENGTH]; + hid_t s1_tid; /* File datatype hadle */ + + /* Second structure (subset of s1_t) and dataset*/ + typedef struct s2_t { + double c; + int a; + } s2_t; + s2_t s2[LENGTH]; + hid_t s2_tid; /* Memory datatype handle */ + + /* Third "structure" ( will be used to read float field of s1) */ + hid_t s3_tid; /* Memory datatype handle */ + float s3[LENGTH]; + + int i; + hid_t file, dataset, space; /* Handles */ + herr_t status; + hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */ + + + /* + * Initialize the data + */ + for (i = 0; i< LENGTH; i++) { s1[i].a = i; s1[i].b = i*i; s1[i].c = 1./(i+1); -} - -/* - * Create the data space. - */ -space = H5Screate_simple(RANK, dim, NULL); - -/* - * Create the file. - */ -file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/* - * Create the memory data type. - */ -s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); -H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); -H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); -H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); - -/* - * Create the dataset. - */ -dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT); - -/* - * Wtite data to the dataset; - */ -status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); - -/* - * Release resources - */ -H5Tclose(s1_tid); -H5Sclose(space); -H5Dclose(dataset); -H5Fclose(file); + } + + /* + * Create the data space. + */ + space = H5Screate_simple(RANK, dim, NULL); + + /* + * Create the file. + */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create the memory data type. + */ + s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); + H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); + + /* + * Create the dataset. + */ + dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT); + + /* + * Wtite data to the dataset; + */ + status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); + + /* + * Release resources + */ + H5Tclose(s1_tid); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(file); -/* - * Open the file and the dataset. - */ -file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + /* + * Open the file and the dataset. + */ + file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); -dataset = H5Dopen(file, DATASETNAME); - -/* - * Create a data type for s2 - */ -s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t)); - -H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE); -H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT); - -/* - * Read two fields c and a from s1 dataset. Fields in the file - * are found by their names "c_name" and "a_name". - */ -status = H5Dread(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2); - -/* - * Display the fields - */ -printf("\n"); -printf("Field c : \n"); -for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c); -printf("\n"); - -printf("\n"); -printf("Field a : \n"); -for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a); -printf("\n"); - -/* - * Create a data type for s3. - */ -s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(float)); - -status = H5Tinsert(s3_tid, "b_name", 0, H5T_NATIVE_FLOAT); - -/* - * Read field b from s1 dataset. Field in the file is found by its name. - */ -status = H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3); - -/* - * Display the field - */ -printf("\n"); -printf("Field b : \n"); -for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]); -printf("\n"); - -/* - * Release resources - */ -H5Tclose(s2_tid); -H5Tclose(s3_tid); -H5Dclose(dataset); -H5Fclose(file); + dataset = H5Dopen(file, DATASETNAME); + + /* + * Create a data type for s2 + */ + s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t)); + + H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT); + + /* + * Read two fields c and a from s1 dataset. Fields in the file + * are found by their names "c_name" and "a_name". + */ + status = H5Dread(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2); + + /* + * Display the fields + */ + printf("\n"); + printf("Field c : \n"); + for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c); + printf("\n"); + + printf("\n"); + printf("Field a : \n"); + for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a); + printf("\n"); + + /* + * Create a data type for s3. + */ + s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(float)); + + status = H5Tinsert(s3_tid, "b_name", 0, H5T_NATIVE_FLOAT); + + /* + * Read field b from s1 dataset. Field in the file is found by its name. + */ + status = H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3); + + /* + * Display the field + */ + printf("\n"); + printf("Field b : \n"); + for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]); + printf("\n"); + + /* + * Release resources + */ + H5Tclose(s2_tid); + H5Tclose(s3_tid); + H5Dclose(dataset); + H5Fclose(file); + + return 0; } diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c index 6b20a1e..af061bc 100644 --- a/examples/h5_extend_write.c +++ b/examples/h5_extend_write.c @@ -13,155 +13,159 @@ #define NX 10 #define NY 5 -main () +int +main (void) { - hid_t file; /* handles */ - hid_t datatype, dataspace, dataset; - hid_t filespace; - hid_t cparms; - hsize_t dims[2] = { 3, 3}; /* dataset dimensions - at the creation time */ - hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */ - hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */ - hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */ - - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={2, 5}; - hsize_t size[2]; - hssize_t offset[2]; - - herr_t status; - - int data1[3][3] = { 1, 1, 1, /* data to write */ - 1, 1, 1, - 1, 1, 1 }; - - int data2[7] = { 2, 2, 2, 2, 2, 2, 2}; - - int data3[2][2] = { 3, 3, - 3, 3}; - -/* - * Create the data space with ulimited dimensions. - */ -dataspace = H5Screate_simple(RANK, dims, maxdims); - -/* - * Create a new file. If file exists its contents will be overwritten. - */ -file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/* - * Modify dataset creation properties, i.e. enable chunking. - */ -cparms = H5Pcreate (H5P_DATASET_CREATE); -status = H5Pset_chunk( cparms, RANK, chunk_dims); - -/* - * Create a new dataset within the file using cparms - * creation properties. - */ -dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace, - cparms); - -/* - * Extend the dataset. This call assures that dataset is at least 3 x 3. - */ -size[0] = 3; -size[1] = 3; -status = H5Dextend (dataset, size); - -/* - * Select a hyperslab. - */ -filespace = H5Dget_space (dataset); -offset[0] = 0; -offset[1] = 0; -status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, - dims1, NULL); - -/* - * Write the data to the hyperslab. - */ -status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, - H5P_DEFAULT, data1); - -/* - * Extend the dataset. Dataset becomes 10 x 3. - */ -dims[0] = dims1[0] + dims2[0]; -size[0] = dims[0]; -size[1] = dims[1]; -status = H5Dextend (dataset, size); - -/* - * Select a hyperslab. - */ -filespace = H5Dget_space (dataset); -offset[0] = 3; -offset[1] = 0; -status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, - dims2, NULL); - -/* - * Define memory space - */ -dataspace = H5Screate_simple(RANK, dims2, NULL); - -/* - * Write the data to the hyperslab. - */ -status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, - H5P_DEFAULT, data2); - -/* - * Extend the dataset. Dataset becomes 10 x 5. - */ -dims[1] = dims1[1] + dims3[1]; -size[0] = dims[0]; -size[1] = dims[1]; -status = H5Dextend (dataset, size); - -/* - * Select a hyperslab - */ -filespace = H5Dget_space (dataset); -offset[0] = 0; -offset[1] = 3; -status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, - dims3, NULL); - -/* - * Define memory space. - */ -dataspace = H5Screate_simple(RANK, dims3, NULL); - -/* - * Write the data to the hyperslab. - */ -status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, - H5P_DEFAULT, data3); - -/* - * Resulting dataset - * - 3 3 3 2 2 - 3 3 3 2 2 - 3 3 3 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - 2 0 0 0 0 - */ -/* - * Close/release resources. - */ -H5Dclose(dataset); -H5Sclose(dataspace); -H5Sclose(filespace); -H5Fclose(file); - + hid_t file; /* handles */ + hid_t dataspace, dataset; + hid_t filespace; + hid_t cparms; + hsize_t dims[2] = { 3, 3}; /* + * dataset dimensions + * at the creation time + */ + hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */ + hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */ + hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */ + + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={2, 5}; + hsize_t size[2]; + hssize_t offset[2]; + + herr_t status; + + int data1[3][3] = { {1, 1, 1}, /* data to write */ + {1, 1, 1}, + {1, 1, 1} }; + + int data2[7] = { 2, 2, 2, 2, 2, 2, 2}; + + int data3[2][2] = { {3, 3}, + {3, 3} }; + + /* + * Create the data space with ulimited dimensions. + */ + dataspace = H5Screate_simple(RANK, dims, maxdims); + + /* + * Create a new file. If file exists its contents will be overwritten. + */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Modify dataset creation properties, i.e. enable chunking. + */ + cparms = H5Pcreate (H5P_DATASET_CREATE); + status = H5Pset_chunk( cparms, RANK, chunk_dims); + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace, + cparms); + + /* + * Extend the dataset. This call assures that dataset is at least 3 x 3. + */ + size[0] = 3; + size[1] = 3; + status = H5Dextend (dataset, size); + + /* + * Select a hyperslab. + */ + filespace = H5Dget_space (dataset); + offset[0] = 0; + offset[1] = 0; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, + dims1, NULL); + + /* + * Write the data to the hyperslab. + */ + status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data1); + + /* + * Extend the dataset. Dataset becomes 10 x 3. + */ + dims[0] = dims1[0] + dims2[0]; + size[0] = dims[0]; + size[1] = dims[1]; + status = H5Dextend (dataset, size); + + /* + * Select a hyperslab. + */ + filespace = H5Dget_space (dataset); + offset[0] = 3; + offset[1] = 0; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, + dims2, NULL); + + /* + * Define memory space + */ + dataspace = H5Screate_simple(RANK, dims2, NULL); + + /* + * Write the data to the hyperslab. + */ + status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data2); + + /* + * Extend the dataset. Dataset becomes 10 x 5. + */ + dims[1] = dims1[1] + dims3[1]; + size[0] = dims[0]; + size[1] = dims[1]; + status = H5Dextend (dataset, size); + + /* + * Select a hyperslab + */ + filespace = H5Dget_space (dataset); + offset[0] = 0; + offset[1] = 3; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, + dims3, NULL); + + /* + * Define memory space. + */ + dataspace = H5Screate_simple(RANK, dims3, NULL); + + /* + * Write the data to the hyperslab. + */ + status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data3); + + /* + * Resulting dataset + * + * 3 3 3 2 2 + * 3 3 3 2 2 + * 3 3 3 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + */ + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(dataspace); + H5Sclose(filespace); + H5Fclose(file); + + return 0; } diff --git a/examples/h5_group.c b/examples/h5_group.c index 6e34e98..1c5ab12 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -10,108 +10,109 @@ #define FILE "DIR.h5" #define RANK 2 -main() +int +main(void) { - hid_t file, dir; - hid_t dataset, dataspace; - - herr_t status; - hsize_t dims[2]; - hsize_t size[1]; - -/* - * Create a file. - */ -file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/* - * Create two groups in a file. - */ -dir = H5Gcreate(file, "/IntData", 0); -status = H5Gclose(dir); - -dir = H5Gcreate(file,"/FloatData", 0); -status = H5Gclose(dir); - -/* - * Create dataspace for the character string - */ -size[0] = 80; -dataspace = H5Screate_simple(1, size, NULL); - -/* - * Create dataset "String" in the root group. - */ -dataset = H5Dcreate(file, "String", H5T_NATIVE_CHAR, dataspace, H5P_DEFAULT); -H5Dclose(dataset); - -/* - * Create dataset "String" in the /IntData group. - */ -dataset = H5Dcreate(file, "/IntData/String", H5T_NATIVE_CHAR, dataspace, - H5P_DEFAULT); -H5Dclose(dataset); - -/* - * Create dataset "String" in the /FloatData group. - */ -dataset = H5Dcreate(file, "/FloatData/String", H5T_NATIVE_CHAR, dataspace, - H5P_DEFAULT); -H5Sclose(dataspace); -H5Dclose(dataset); - -/* - * Create IntArray dataset in the /IntData group by specifying full path. - */ -dims[0] = 2; -dims[1] = 3; -dataspace = H5Screate_simple(RANK, dims, NULL); -dataset = H5Dcreate(file, "/IntData/IntArray", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT); -H5Sclose(dataspace); -H5Dclose(dataset); - -/* - * Set current group to /IntData and attach to the dataset String. - */ - -status = H5Gset (file, "/IntData"); -dataset = H5Dopen(file, "String"); -if (dataset > 0) printf("String dataset in /IntData group is found\n"); -H5Dclose(dataset); - -/* - * Set current group to /FloatData. - */ -status = H5Gset (file, "/FloatData"); - -/* - * Create two datasets FlatArray and DoubleArray. - */ - -dims[0] = 5; -dims[1] = 10; -dataspace = H5Screate_simple(RANK, dims, NULL); -dataset = H5Dcreate(file, "FloatArray", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT); -H5Sclose(dataspace); -H5Dclose(dataset); - -dims[0] = 4; -dims[1] = 6; -dataspace = H5Screate_simple(RANK, dims, NULL); -dataset = H5Dcreate(file, "DoubleArray", H5T_NATIVE_DOUBLE, dataspace, - H5P_DEFAULT); -H5Sclose(dataspace); -H5Dclose(dataset); - -/* - * Attach to /FloatData/String dataset. - */ - -dataset = H5Dopen(file, "/FloatData/String"); -if (dataset > 0) printf("/FloatData/String dataset is found\n"); -H5Dclose(dataset); -H5Fclose(file); - + hid_t file, dir; + hid_t dataset, dataspace; + + herr_t status; + hsize_t dims[2]; + hsize_t size[1]; + + /* + * Create a file. + */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create two groups in a file. + */ + dir = H5Gcreate(file, "/IntData", 0); + status = H5Gclose(dir); + + dir = H5Gcreate(file,"/FloatData", 0); + status = H5Gclose(dir); + + /* + * Create dataspace for the character string + */ + size[0] = 80; + dataspace = H5Screate_simple(1, size, NULL); + + /* + * Create dataset "String" in the root group. + */ + dataset = H5Dcreate(file, "String", H5T_NATIVE_CHAR, dataspace, + H5P_DEFAULT); + H5Dclose(dataset); + + /* + * Create dataset "String" in the /IntData group. + */ + dataset = H5Dcreate(file, "/IntData/String", H5T_NATIVE_CHAR, dataspace, + H5P_DEFAULT); + H5Dclose(dataset); + + /* + * Create dataset "String" in the /FloatData group. + */ + dataset = H5Dcreate(file, "/FloatData/String", H5T_NATIVE_CHAR, dataspace, + H5P_DEFAULT); + H5Sclose(dataspace); + H5Dclose(dataset); + + /* + * Create IntArray dataset in the /IntData group by specifying full path. + */ + dims[0] = 2; + dims[1] = 3; + dataspace = H5Screate_simple(RANK, dims, NULL); + dataset = H5Dcreate(file, "/IntData/IntArray", H5T_NATIVE_INT, dataspace, + H5P_DEFAULT); + H5Sclose(dataspace); + H5Dclose(dataset); + + /* + * Set current group to /IntData and attach to the dataset String. + */ + status = H5Gset (file, "/IntData"); + dataset = H5Dopen(file, "String"); + if (dataset > 0) printf("String dataset in /IntData group is found\n"); + H5Dclose(dataset); + + /* + * Set current group to /FloatData. + */ + status = H5Gset (file, "/FloatData"); + + /* + * Create two datasets FlatArray and DoubleArray. + */ + dims[0] = 5; + dims[1] = 10; + dataspace = H5Screate_simple(RANK, dims, NULL); + dataset = H5Dcreate(file, "FloatArray", H5T_NATIVE_FLOAT, dataspace, + H5P_DEFAULT); + H5Sclose(dataspace); + H5Dclose(dataset); + + dims[0] = 4; + dims[1] = 6; + dataspace = H5Screate_simple(RANK, dims, NULL); + dataset = H5Dcreate(file, "DoubleArray", H5T_NATIVE_DOUBLE, dataspace, + H5P_DEFAULT); + H5Sclose(dataspace); + H5Dclose(dataset); + + /* + * Attach to /FloatData/String dataset. + */ + dataset = H5Dopen(file, "/FloatData/String"); + if (dataset > 0) printf("/FloatData/String dataset is found\n"); + H5Dclose(dataset); + H5Fclose(file); + + return 0; } diff --git a/examples/h5_read.c b/examples/h5_read.c index 51bf381..599ba59 100644 --- a/examples/h5_read.c +++ b/examples/h5_read.c @@ -17,114 +17,120 @@ #define RANK 2 #define RANK_OUT 3 -main () +int +main (void) { - hid_t file, dataset; /* handles */ - hid_t datatype, dataspace; - hid_t memspace; - H5T_class_t class; /* data type class */ - H5T_order_t order; /* data order */ - size_t size; /* size of the data element - stored in file */ - hsize_t dimsm[3]; /* memory space dimensions */ - hsize_t dims_out[2]; /* dataset dimensions */ - herr_t status; + hid_t file, dataset; /* handles */ + hid_t datatype, dataspace; + hid_t memspace; + H5T_class_t class; /* data type class */ + H5T_order_t order; /* data order */ + size_t size; /* + * size of the data element + * stored in file + */ + hsize_t dimsm[3]; /* memory space dimensions */ + hsize_t dims_out[2]; /* dataset dimensions */ + herr_t status; - int data_out[NX][NY][NZ ]; /* output buffer */ + int data_out[NX][NY][NZ ]; /* output buffer */ - hsize_t count[2]; /* size of the hyperslab in the file */ - hsize_t offset[2]; /* hyperslab offset in the file */ - hsize_t count_out[3]; /* size of the hyperslab in memory */ - hsize_t offset_out[3]; /* hyperslab offset in memory */ - int i, j, k, status_n, rank; + hsize_t count[2]; /* size of the hyperslab in the file */ + hsize_t offset[2]; /* hyperslab offset in the file */ + hsize_t count_out[3]; /* size of the hyperslab in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ + int i, j, k, status_n, rank; -for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) { - for (k = 0; k < NZ ; k++) - data_out[j][i][k] = 0; - } -} + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + for (k = 0; k < NZ ; k++) + data_out[j][i][k] = 0; + } + } -/* - * Open the file and the dataset. - */ -file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); -dataset = H5Dopen(file, DATASETNAME); + /* + * Open the file and the dataset. + */ + file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen(file, DATASETNAME); -/* - * Get datatype and dataspace handles and then query - * dataset class, order, size, rank and dimensions. - */ + /* + * Get datatype and dataspace handles and then query + * dataset class, order, size, rank and dimensions. + */ + datatype = H5Dget_type(dataset); /* datatype handle */ + class = H5Tget_class(datatype); + if (class == H5T_INTEGER) printf("Data set has INTEGER type \n"); + order = H5Tget_order(datatype); + if (order == H5T_ORDER_LE) printf("Little endian order \n"); -datatype = H5Dget_type(dataset); /* datatype handle */ -class = H5Tget_class(datatype); -if (class == H5T_INTEGER) printf("Data set has INTEGER type \n"); -order = H5Tget_order(datatype); -if (order == H5T_ORDER_LE) printf("Little endian order \n"); + size = H5Tget_size(datatype); + printf(" Data size is %d \n", size); -size = H5Tget_size(datatype); -printf(" Data size is %d \n", size); + dataspace = H5Dget_space(dataset); /* dataspace handle */ + rank = H5Sextent_ndims(dataspace); + status_n = H5Sextent_dims(dataspace, dims_out, NULL); + printf("rank %d, dimensions %lu x %lu \n", rank, + (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1])); -dataspace = H5Dget_space(dataset); /* dataspace handle */ -rank = H5Sextent_ndims(dataspace); -status_n = H5Sextent_dims(dataspace, dims_out, NULL); -printf("rank %d, dimensions %d x %d \n", rank, dims_out[0], dims_out[1]); - -/* - * Define hyperslab in the datatset. - */ -offset[0] = 1; -offset[1] = 2; -count[0] = NX_SUB; -count[1] = NY_SUB; -status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, - count, NULL); + /* + * Define hyperslab in the datatset. + */ + offset[0] = 1; + offset[1] = 2; + count[0] = NX_SUB; + count[1] = NY_SUB; + status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, + count, NULL); -/* - * Define the memory dataspace. - */ -dimsm[0] = NX; -dimsm[1] = NY; -dimsm[2] = NZ ; -memspace = H5Screate_simple(RANK_OUT,dimsm,NULL); + /* + * Define the memory dataspace. + */ + dimsm[0] = NX; + dimsm[1] = NY; + dimsm[2] = NZ ; + memspace = H5Screate_simple(RANK_OUT,dimsm,NULL); -/* - * Define memory hyperslab. - */ -offset_out[0] = 3; -offset_out[1] = 0; -offset_out[2] = 0; -count_out[0] = NX_SUB; -count_out[1] = NY_SUB; -count_out[2] = 1; -status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, - count_out, NULL); + /* + * Define memory hyperslab. + */ + offset_out[0] = 3; + offset_out[1] = 0; + offset_out[2] = 0; + count_out[0] = NX_SUB; + count_out[1] = NY_SUB; + count_out[2] = 1; + status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, + count_out, NULL); -/* - * Read data from hyperslab in the file into the hyperslab in - * memory and display. - */ -status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace, - H5P_DEFAULT, data_out); -for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]); - printf("\n"); -} - /* 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 3 4 5 6 0 0 0 - 4 5 6 7 0 0 0 - 5 6 7 8 0 0 0 - 0 0 0 0 0 0 0 */ + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace, + H5P_DEFAULT, data_out); + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]); + printf("\n"); + } + /* + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 3 4 5 6 0 0 0 + * 4 5 6 7 0 0 0 + * 5 6 7 8 0 0 0 + * 0 0 0 0 0 0 0 + */ -/* - * Close/release resources. - */ -H5Tclose(datatype); -H5Dclose(dataset); -H5Sclose(dataspace); -H5Sclose(memspace); -H5Fclose(file); + /* + * Close/release resources. + */ + H5Tclose(datatype); + H5Dclose(dataset); + H5Sclose(dataspace); + H5Sclose(memspace); + H5Fclose(file); + return 0; } diff --git a/examples/h5_write.c b/examples/h5_write.c index c57fc7c..7611950 100644 --- a/examples/h5_write.c +++ b/examples/h5_write.c @@ -11,69 +11,73 @@ #define NY 6 #define RANK 2 -main () +int +main (void) { - hid_t file, dataset; /* file and dataset handles */ - hid_t datatype, dataspace; /* handles */ - hsize_t dimsf[2]; /* dataset dimensions */ - herr_t status; - int data[NX][NY]; /* data to write */ - int i, j; + hid_t file, dataset; /* file and dataset handles */ + hid_t datatype, dataspace; /* handles */ + hsize_t dimsf[2]; /* dataset dimensions */ + herr_t status; + int data[NX][NY]; /* data to write */ + int i, j; -/* - * Data and output buffer initialization. - */ + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + */ -for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) - data[j][i] = i + j; -} - /* 0 1 2 3 4 5 - 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 */ + /* + * Create a new file using H5F_ACC_TRUNC access, + * default file creation properties, and default file + * access properties. + */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -/* - * Create a new file using H5F_ACC_TRUNC access, - * default file creation properties, and default file - * access properties. - */ -file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + /* + * Describe the size of the array and create the data space for fixed + * size dataset. + */ + dimsf[0] = NX; + dimsf[1] = NY; + dataspace = H5Screate_simple(RANK, dimsf, NULL); -/* - * Describe the size of the array and create the data space for fixed - * size dataset. - */ -dimsf[0] = NX; -dimsf[1] = NY; -dataspace = H5Screate_simple(RANK, dimsf, NULL); + /* + * Define datatype for the data in the file. + * We will store little endian INT numbers. + */ + datatype = H5Tcopy(H5T_NATIVE_INT); + status = H5Tset_order(datatype, H5T_ORDER_LE); -/* - * Define datatype for the data in the file. - * We will store little endian INT numbers. - */ -datatype = H5Tcopy(H5T_NATIVE_INT); -status = H5Tset_order(datatype, H5T_ORDER_LE); -/* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ -dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, - H5P_DEFAULT); + /* + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ + dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, + H5P_DEFAULT); -/* - * Write the data to the dataset using default transfer properties. - */ -status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data); + /* + * Write the data to the dataset using default transfer properties. + */ + status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data); -/* - * Close/release resources. - */ -H5Sclose(dataspace); -H5Tclose(datatype); -H5Dclose(dataset); -H5Fclose(file); + /* + * Close/release resources. + */ + H5Sclose(dataspace); + H5Tclose(datatype); + H5Dclose(dataset); + H5Fclose(file); + return 0; } diff --git a/src/.distdep b/src/.distdep index a021579..e37772b 100644 --- a/src/.distdep +++ b/src/.distdep @@ -91,39 +91,6 @@ H5Gent.o: \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h -H5Gnode.o: \ - H5Gnode.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Gpkg.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h H5Gstab.o: \ H5Gstab.c \ H5private.h \ @@ -540,24 +507,6 @@ H5AC.o: \ H5Dpublic.h \ H5Eprivate.h \ H5Epublic.h -H5B.o: \ - H5B.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ - H5MMprivate.h H5Ffamily.o: \ H5Ffamily.c \ H5private.h \ @@ -566,24 +515,6 @@ H5Ffamily.o: \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h -H5HL.o: \ - H5HL.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ - H5MMprivate.h H5Omtime.o: \ H5Omtime.c \ H5private.h \ @@ -643,19 +574,6 @@ H5E.o: \ H5Iprivate.h \ H5Ipublic.h \ H5Eprivate.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h H5MF.o: \ H5MF.c \ H5private.h \ @@ -804,70 +722,63 @@ H5TB.o: \ H5Iprivate.h \ H5Ipublic.h \ H5Eprivate.h -H5Fmpio.o: \ - H5Fmpio.c \ +H5Smpio.o: \ + H5Smpio.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5MMprivate.h \ - H5MMpublic.h -H5O.o: \ - H5O.c \ + H5Tpublic.h +H5Spoint.o: \ + H5Spoint.c \ H5private.h \ H5public.h \ H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ + H5Ipublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h -H5Smpio.o: \ - H5Smpio.c \ + H5HGpublic.h +H5Sselect.o: \ + H5Sselect.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ @@ -882,19 +793,17 @@ H5Smpio.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h -H5Spoint.o: \ - H5Spoint.c \ + H5Tpublic.h \ + H5Zprivate.h \ + H5Zpublic.h +H5G.o: \ + H5G.c \ H5private.h \ H5public.h \ H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ + H5Aprivate.h \ + H5Apublic.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ @@ -902,38 +811,52 @@ H5Spoint.o: \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Dprivate.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ - H5HGpublic.h -H5Sselect.o: \ - H5Sselect.c \ - H5private.h \ - H5public.h \ - H5config.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ H5Eprivate.h \ H5Epublic.h \ + H5Gpkg.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5HLprivate.h \ + H5HLpublic.h +H5R.o: \ + H5R.c \ + H5Rprivate.h \ + H5Rpublic.h \ H5Ipublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5private.h \ + H5Fprivate.h \ + H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h H5A.o: \ H5A.c \ H5private.h \ @@ -967,6 +890,24 @@ H5A.o: \ H5Ppublic.h \ H5Apkg.h \ H5Aprivate.h +H5B.o: \ + H5B.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h H5D.o: \ H5D.c \ H5private.h \ @@ -1033,49 +974,29 @@ H5F.o: \ H5Epublic.h \ H5MMprivate.h \ H5MMpublic.h -H5G.o: \ - H5G.c \ +H5Flow.o: \ + H5Flow.c \ H5private.h \ H5public.h \ H5config.h \ - H5Aprivate.h \ - H5Apublic.h \ + H5Eprivate.h \ + H5Epublic.h \ H5Ipublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Dprivate.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ + H5MMprivate.h \ + H5MMpublic.h +H5Fmpio.o: \ + H5Fmpio.c \ + H5private.h \ + H5public.h \ + H5config.h \ H5Eprivate.h \ H5Epublic.h \ - H5Gpkg.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5HLprivate.h \ - H5HLpublic.h -H5R.o: \ - H5R.c \ - H5Rprivate.h \ - H5Rpublic.h \ H5Ipublic.h \ - H5public.h \ - H5config.h \ H5Dprivate.h \ H5Dpublic.h \ - H5private.h \ H5Fprivate.h \ H5Fpublic.h \ H5Gprivate.h \ @@ -1092,22 +1013,32 @@ H5R.o: \ H5Spublic.h \ H5Zprivate.h \ H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h -H5T.o: \ - H5T.c \ + H5MMprivate.h \ + H5MMpublic.h +H5Gnode.o: \ + H5Gnode.c \ H5private.h \ H5public.h \ H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ + H5ACprivate.h \ + H5ACpublic.h \ H5Fprivate.h \ H5Fpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Gpkg.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ @@ -1116,12 +1047,53 @@ H5T.o: \ H5Tpublic.h \ H5Sprivate.h \ H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Iprivate.h \ + H5Zprivate.h +H5HL.o: \ + H5HL.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ H5Eprivate.h \ H5Epublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ H5MMprivate.h +H5O.o: \ + H5O.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h H5S.o: \ H5S.c \ H5private.h \ @@ -1145,3 +1117,31 @@ H5S.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h +H5T.o: \ + H5T.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Iprivate.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h diff --git a/src/H5detect.c b/src/H5detect.c index 1236a5b..944b73f 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -29,6 +29,7 @@ static const char *FileHeader = "\n\ * *------------------------------------------------------------------------- */ +#undef NDEBUG #include #include #include @@ -599,6 +600,7 @@ bit_cmp(int nbytes, int *perm, void *_a, void *_b) if ((aa & 1) != (bb & 1)) return i * 8 + j; } assert("INTERNAL ERROR" && 0); + abort(); } } return -1; diff --git a/test/big.c b/test/big.c index 1ad79a2..53240e1 100644 --- a/test/big.c +++ b/test/big.c @@ -177,6 +177,7 @@ writer (int wrt_n) FILE *out = fopen(DNAME, "w"); printf("%-70s", "Writing large dataset"); + fflush(stdout); /* * Make sure that `hsize_t' is large enough to represent the entire data diff --git a/test/chunk.c b/test/chunk.c index 60a8850..704c396 100644 --- a/test/chunk.c +++ b/test/chunk.c @@ -40,17 +40,17 @@ #define RM_CACHE_STRT 25 #define RM_CACHE_END 25 #define RM_CACHE_DELT 5 -#define RM_START 0.20 +#define RM_START 0.50 #define RM_END 5.00 -#define RM_DELTA 0.0025 +#define RM_DELTA 0.50 /* Diagonal test */ #define DIAG_CACHE_STRT 25 #define DIAG_CACHE_END 25 #define DIAG_CACHE_DELT 5 -#define DIAG_START 0.20 +#define DIAG_START 0.50 #define DIAG_END 5.00 -#define DIAG_DELTA 0.0025 +#define DIAG_DELTA 0.50 static size_t nio_g; static hid_t fapl_g = -1; @@ -299,6 +299,8 @@ main (void) create_dataset (); f = fopen ("x-gnuplot", "w"); + printf("Test %8s %8s %8s\n", "CacheSz", "ChunkSz", "Effic"); + printf("--------- -------- -------- --------\n"); #if 1 /* @@ -345,7 +347,7 @@ main (void) fclose (d); fprintf (f, "pause -1\n"); #endif - + #if 1 /* * Test row-major writing of the dataset with various sizes of request diff --git a/tools/h5import.c b/tools/h5import.c index dd88ba6..9fc2454 100644 --- a/tools/h5import.c +++ b/tools/h5import.c @@ -13,6 +13,7 @@ #include #include #include +#include /*------------------------------------------------------------------------- diff --git a/tools/h5ls.c b/tools/h5ls.c index 13e4830..a311c5b 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -386,8 +386,8 @@ list (hid_t group, const char *name, void __unused__ *cd) H5Gget_comment(group, name, sizeof(comment), comment); strcpy(comment+sizeof(comment)-4, "..."); if (comment[0]) printf(" %-10s %s\n", "Comment:", comment); - if (dispatch_g[sb.type].list2) (dispatch_g[sb.type].list2)(obj); } + if (dispatch_g[sb.type].list2) (dispatch_g[sb.type].list2)(obj); /* * Close the object. -- cgit v0.12