diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-02-21 20:30:34 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-02-21 20:30:34 (GMT) |
commit | 51b8c63864c72de9a7b40c00673fe07510fec27e (patch) | |
tree | 298e9a2584860a24f55d2bce1fc60faed2bef2dd /hl | |
parent | c4f785bc93c5f4e8677b325c321e0f9ed41c3baa (diff) | |
parent | c5ab2285639a801f87a77987db1a0b609a020314 (diff) | |
download | hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.zip hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.gz hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.bz2 |
Merge develop
Diffstat (limited to 'hl')
35 files changed, 1465 insertions, 1097 deletions
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 2a71b47..bef034c 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -19,7 +19,7 @@ endif () #-- Build the Unit testing if requested if (NOT HDF5_EXTERNALLY_CONFIGURED) - if (BUILD_TESTING) + if (BUILD_TESTING AND HDF5_TEST_SERIAL) add_subdirectory (test) endif () endif () diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 50e08e8..4bd4807 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -23,6 +23,6 @@ else () endif () set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_CPP AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/hl/c++/examples/Makefile.am b/hl/c++/examples/Makefile.am index ce719f5..592e8da 100644 --- a/hl/c++/examples/Makefile.am +++ b/hl/c++/examples/Makefile.am @@ -33,8 +33,8 @@ CXX_API=yes # Where to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c++ -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl +EXAMPLEDIR=$(examplesdir)/hl/c++ +EXAMPLETOPDIR=$(examplesdir)/hl # How to build programs using h5c++ $(EXTRA_PROG): $(H5CPP) diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in index eb688a1..43831f5 100644 --- a/hl/c++/examples/run-hlc++-ex.sh.in +++ b/hl/c++/examples/run-hlc++-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c++ examples from source files # -# installed in .../share/hdf5_examples/hl/c++ using h5c++. The # +# installed in @examplesdir@/hl/c++ using h5c++. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -29,9 +29,33 @@ # Initializations EXIT_SUCCESS=0 EXIT_FAILURE=1 + +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../..}" +prefix="${prefix:-../../${prefix_relto_examplesdir}}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index cfb24a8..429e5c7 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -24,4 +24,6 @@ else () endif () set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) -include (CMakeTests.cmake) +if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 86c1770..44115e5 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -39,8 +39,6 @@ foreach (example ${examples}) set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) endforeach () -if (BUILD_TESTING) - +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) - endif () diff --git a/hl/examples/Makefile.am b/hl/examples/Makefile.am index 29e1a48..cc2d671 100644 --- a/hl/examples/Makefile.am +++ b/hl/examples/Makefile.am @@ -25,8 +25,8 @@ endif # Example directory # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl +EXAMPLEDIR=$(examplesdir)/hl/c +EXAMPLETOPDIR=$(examplesdir)/hl INSTALL_SCRIPT_FILES = run-hlc-ex.sh INSTALL_TOP_SCRIPT_FILES = run-hl-ex.sh diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in index f51b165..e6d0cc9 100644 --- a/hl/examples/run-hlc-ex.sh.in +++ b/hl/examples/run-hlc-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c examples from source files installed # -# in .../share/hdf5_examples/hl/c using h5cc or h5pc. The order for running # +# in @examplesdir@/hl/c using h5cc or h5pc. The order for running # # programs with RunTest in the MAIN section below is taken from the Makefile. # # The order is important since some of the test programs use data files created # # by earlier test programs. Any future additions should be placed accordingly. # @@ -29,9 +29,32 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../..}" +prefix="${prefix:-../../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index e41b8fe..449194e 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -52,6 +52,6 @@ foreach (example ${examples}) endif () endforeach () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_FORTRAN AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am index d383f9a..b81cc6f 100644 --- a/hl/fortran/examples/Makefile.am +++ b/hl/fortran/examples/Makefile.am @@ -51,8 +51,8 @@ endif # Tell automake how to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/fortran -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl +EXAMPLEDIR=$(examplesdir)/hl/fortran +EXAMPLETOPDIR=$(examplesdir)/hl # List dependencies for each example. Normally, automake would take # care of this for us, but if we tell automake about the programs it diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in index 5f12ef0..d7de8e3 100644 --- a/hl/fortran/examples/run-hlfortran-ex.sh.in +++ b/hl/fortran/examples/run-hlfortran-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the fortran examples from source files # -# installed in .../share/hdf5_examples/hl/fortran using h5fc or h5pfc. The # +# installed in @examplesdir@/hl/fortran using h5fc or h5pfc. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../..}" +prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index e532fff..91ec669 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -164,7 +164,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" INTERFACE - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/static>" ) target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} PUBLIC @@ -201,7 +201,7 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" INTERFACE - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/shared>" ) target_compile_definitions(${HDF5_HL_F90_LIBSH_TARGET} PUBLIC diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index c152142..369692d 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -61,4 +61,6 @@ foreach (h5_test ${H5_TESTS}) ADD_H5_FORTRAN_EXE(${h5_test}) endforeach () -include (CMakeTests.cmake) +if (HDF5_TEST_FORTRAN AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 067992f..63fb461 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -140,10 +140,10 @@ herr_t H5DSattach_scale(hid_t did, hobj_ref_t ref_j; /* iterator reference */ hvl_t *buf = NULL; /* VL buffer to store in the attribute */ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */ - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; H5I_type_t it1, it2; int i; - size_t len; + size_t len; int found_ds=0; htri_t is_scale; @@ -156,20 +156,26 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* the dataset cannot be a DS dataset */ - if ( is_scale == 1) + if (is_scale == 1) return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - return FAIL; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + return FAIL; + if(!token_cmp) + return FAIL; + } /* end if */ /* get ID type */ if ((it1 = H5Iget_type(did)) < 0) @@ -177,7 +183,7 @@ herr_t H5DSattach_scale(hid_t did, if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; - if (H5I_DATASET!=it1 || H5I_DATASET!=it2) + if (H5I_DATASET != it1 || H5I_DATASET != it2) return FAIL; /* the DS dataset cannot have dimension scales */ @@ -202,19 +208,19 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* scalar rank */ - if (rank==0) - rank=1; + if (rank == 0) + rank = 1; /* close dataset space */ if (H5Sclose(sid) < 0) return FAIL; /* parameter range checking */ - if (idx>(unsigned)rank-1) + if (idx > (unsigned)rank-1) return FAIL; /*------------------------------------------------------------------------- @@ -275,7 +281,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* close */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) + if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; if(H5Sclose(sid) < 0) goto out; @@ -324,16 +330,22 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* get info for DS in the parameter list */ - if(H5Oget_info2(dsid, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0) goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0) goto out; /* same object, so this DS scale is already in this DIM IDX */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - found_ds = 1; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + goto out; + if(!token_cmp) + found_ds = 1; + } /* end if */ /* close the dereferenced dataset */ if(H5Dclose(dsid_j) < 0) @@ -361,7 +373,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* close */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) + if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; if(H5Sclose(sid) < 0) goto out; @@ -508,7 +520,7 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ - if((is_ds=H5DSis_scale(dsid)) < 0) + if((is_ds = H5DSis_scale(dsid)) < 0) return FAIL; if(is_ds == 0) { @@ -586,7 +598,7 @@ herr_t H5DSdetach_scale(hid_t did, int i; size_t j; hssize_t ii; - H5O_info_t did_oi, dsid_oi, tmp_oi; + H5O_info2_t did_oi, dsid_oi, tmp_oi; int found_dset = 0, found_ds = 0; int have_ds = 0; htri_t is_scale; @@ -598,7 +610,7 @@ herr_t H5DSdetach_scale(hid_t did, /* check for valid types of identifiers */ - if(H5I_DATASET!=H5Iget_type(did) || H5I_DATASET!=H5Iget_type(dsid)) + if(H5I_DATASET != H5Iget_type(did) || H5I_DATASET != H5Iget_type(dsid)) return FAIL; if((is_scale = H5DSis_scale(did)) < 0) @@ -609,16 +621,22 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &did_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &did_oi, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &dsid_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &dsid_oi, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ - if(did_oi.fileno == dsid_oi.fileno && did_oi.addr == dsid_oi.addr) - return FAIL; + if(did_oi.fileno == dsid_oi.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &did_oi.token, &dsid_oi.token, &token_cmp) < 0) + return FAIL; + if(!token_cmp) + return FAIL; + } /* end if */ /*------------------------------------------------------------------------- @@ -626,7 +644,7 @@ herr_t H5DSdetach_scale(hid_t did, *------------------------------------------------------------------------- */ /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST)) < 0) + if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0) return FAIL; if (has_dimlist == 0) @@ -637,7 +655,7 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ @@ -645,7 +663,7 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* parameter range checking */ - if (idx>(unsigned)rank-1) + if (idx > (unsigned)rank-1) return FAIL; /*------------------------------------------------------------------------- @@ -696,7 +714,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0) goto out; /* Close the dereferenced dataset */ @@ -704,30 +722,35 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* same object, reset */ - if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr) - { - /* If there are more than one reference in the VL element - and the reference we found is not the last one, - copy the last one to replace the found one since the order - of the references doesn't matter according to the spec; - reduce the size of the VL element by 1; - if the length of the element becomes 0, free the pointer - and reset to NULL */ - - size_t len = buf[idx].len; - - if(j < len - 1) - ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; - len = --buf[idx].len; - if(len == 0) { - HDfree(buf[idx].p); - buf[idx].p = NULL; - } - /* Since a reference to a dim. scale can be inserted only once, - we do not need to continue the search if it is found */ - found_ds = 1; - break; - } + if(dsid_oi.fileno == tmp_oi.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &dsid_oi.token, &tmp_oi.token, &token_cmp) < 0) + goto out; + if(!token_cmp) { + /* If there are more than one reference in the VL element + and the reference we found is not the last one, + copy the last one to replace the found one since the order + of the references doesn't matter according to the spec; + reduce the size of the VL element by 1; + if the length of the element becomes 0, free the pointer + and reset to NULL */ + + size_t len = buf[idx].len; + + if(j < len - 1) + ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; + len = --buf[idx].len; + if(len == 0) { + HDfree(buf[idx].p); + buf[idx].p = NULL; + } + /* Since a reference to a dim. scale can be inserted only once, + we do not need to continue the search if it is found */ + found_ds = 1; + break; + } /* end if */ + } /* end if */ } /* j */ } /* if */ @@ -753,7 +776,7 @@ herr_t H5DSdetach_scale(hid_t did, } /* close */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) + if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; if(H5Sclose(sid) < 0) goto out; @@ -795,7 +818,7 @@ herr_t H5DSdetach_scale(hid_t did, if(H5Aread(aid, ntid, dsbuf) < 0) goto out; - for(ii=0; ii<nelmts; ii++) { + for(ii = 0; ii < nelmts; ii++) { /* First check if we have the same dimension index */ if(idx == dsbuf[ii].dim_idx) { /* get the reference to the dataset */ @@ -806,7 +829,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this dataset */ - if(H5Oget_info2(did_i, &tmp_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did_i, &tmp_oi, H5O_INFO_BASIC) < 0) goto out; /* close the dereferenced dataset */ @@ -814,13 +837,19 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* same object, reset. we want to detach only for this DIM */ - if(did_oi.fileno == tmp_oi.fileno && did_oi.addr == tmp_oi.addr) { - /* copy the last one to replace the one which is found */ - dsbuf[ii] = dsbuf[nelmts-1]; - nelmts--; - found_dset=1; - break; - } /* if */ + if(did_oi.fileno == tmp_oi.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &did_oi.token, &tmp_oi.token, &token_cmp) < 0) + goto out; + if(!token_cmp) { + /* copy the last one to replace the one which is found */ + dsbuf[ii] = dsbuf[nelmts-1]; + nelmts--; + found_dset=1; + break; + } /* end if */ + } /* end if */ } /* if we have the same dimension index */ } /* ii */ @@ -896,7 +925,7 @@ out: dsbuf = NULL; } if(buf) { - /* Failure occured before H5Dvlen_reclaim was called; + /* Failure occured before H5Treclaim was called; free the pointers allocated when we read data in */ for(i = 0; i < rank; i++) { if(buf[i].p) @@ -954,7 +983,7 @@ htri_t H5DSis_attached(hid_t did, hvl_t *buf = NULL; /* VL buffer to store in the attribute */ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */ hid_t did_i; /* dataset ID in REFERENCE_LIST */ - H5O_info_t oi1, oi2, oi3, oi4; + H5O_info2_t oi1, oi2, oi3, oi4; H5I_type_t it1, it2; int i; int found_dset=0, found_ds=0; @@ -973,16 +1002,22 @@ htri_t H5DSis_attached(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - return FAIL; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + return FAIL; + if(!token_cmp) + return FAIL; + } /* end if */ /* get ID type */ if ((it1 = H5Iget_type(did)) < 0) @@ -990,7 +1025,7 @@ htri_t H5DSis_attached(hid_t did, if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; - if (H5I_DATASET!=it1 || H5I_DATASET!=it2) + if (H5I_DATASET != it1 || H5I_DATASET != it2) return FAIL; /*------------------------------------------------------------------------- @@ -1040,7 +1075,7 @@ htri_t H5DSis_attached(hid_t did, goto out; /* read */ - if (H5Aread(aid,tid,buf) < 0) + if (H5Aread(aid, tid, buf) < 0) goto out; /* iterate all the REFs in this dimension IDX */ @@ -1050,20 +1085,26 @@ htri_t H5DSis_attached(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0) goto out; /* get info for DS in the parameter list */ - if(H5Oget_info2(dsid, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0) goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0) goto out; /* same object */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - found_ds = 1; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + goto out; + if(!token_cmp) + found_ds = 1; + } /* end if */ /* close the dereferenced dataset */ if (H5Dclose(dsid_j) < 0) @@ -1073,7 +1114,7 @@ htri_t H5DSis_attached(hid_t did, /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; if (H5Sclose(sid) < 0) goto out; @@ -1123,7 +1164,7 @@ htri_t H5DSis_attached(hid_t did, if (dsbuf == NULL) goto out; - if (H5Aread(aid,ntid,dsbuf) < 0) + if (H5Aread(aid, ntid, dsbuf) < 0) goto out; /*------------------------------------------------------------------------- @@ -1131,7 +1172,7 @@ htri_t H5DSis_attached(hid_t did, *------------------------------------------------------------------------- */ - for(i=0; i<nelmts; i++) + for(i = 0; i < nelmts; i++) { /* get the reference */ ref = dsbuf[i].ref; @@ -1140,20 +1181,26 @@ htri_t H5DSis_attached(hid_t did, if (ref) { /* get the dataset id */ - if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0) goto out; /* get info for dataset in the parameter list */ - if(H5Oget_info2(did, &oi3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oi3, H5O_INFO_BASIC) < 0) goto out; /* get info for this dataset */ - if(H5Oget_info2(did_i, &oi4, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did_i, &oi4, H5O_INFO_BASIC) < 0) goto out; /* same object */ - if(oi3.fileno == oi4.fileno && oi3.addr == oi4.addr && idx==dsbuf[i].dim_idx) - found_dset=1; + if(oi3.fileno == oi4.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi3.token, &oi4.token, &token_cmp) < 0) + goto out; + if(!token_cmp && (idx == dsbuf[i].dim_idx)) + found_dset=1; + } /* end if */ /* close the dereferenced dataset */ if (H5Dclose(did_i) < 0) @@ -1373,7 +1420,7 @@ herr_t H5DSiterate_scales(hid_t did, } /* if */ /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if (H5Treclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; if (H5Sclose(sid) < 0) goto out; @@ -1391,7 +1438,7 @@ herr_t H5DSiterate_scales(hid_t did, out: H5E_BEGIN_TRY { if(buf) { - H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf); + H5Treclaim(tid,sid,H5P_DEFAULT,buf); HDfree(buf); } H5Sclose(sid); @@ -2095,7 +2142,7 @@ int H5DSget_num_scales(hid_t did, nscales = (int)buf[idx].len; /* close */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) + if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; if(H5Sclose(sid) < 0) goto out; diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index bb72ce6..1caa881 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1360,7 +1360,7 @@ out: */ static herr_t -find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_data) +find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_data) { /* Define a default zero value for return. This will cause the iterator to continue if * the dataset is not found yet. @@ -1407,13 +1407,18 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d * *------------------------------------------------------------------------- */ - +/* H5Literate wants a non-const pointer but we have a const pointer in the API + * call. It's safe to ignore this because we control the callback, don't + * modify the op_data buffer (i.e.: dset_name) during the traversal, and the + * library never modifies that buffer. + */ +H5_GCC_DIAG_OFF(cast-qual) herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) { - return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); + return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); } - +H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- * @@ -2033,13 +2038,18 @@ herr_t H5LTfind_attribute( hid_t loc_id, const char* attr_name ) * *------------------------------------------------------------------------- */ - +/* H5Aiterate wants a non-const pointer but we have a const pointer in the API + * call. It's safe to ignore this because we control the callback, don't + * modify the op_data buffer (i.e.: attr_name) during the traversal, and the + * library never modifies that buffer. + */ +H5_GCC_DIAG_OFF(cast-qual) herr_t H5LT_find_attribute( hid_t loc_id, const char* attr_name ) { return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_attr, (void *)attr_name); } - +H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 2219263..4094cd8 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -30,11 +30,17 @@ #define yy_create_buffer H5LTyy_create_buffer #define yy_delete_buffer H5LTyy_delete_buffer -#define yy_flex_debug H5LTyy_flex_debug +#define yy_scan_buffer H5LTyy_scan_buffer +#define yy_scan_string H5LTyy_scan_string +#define yy_scan_bytes H5LTyy_scan_bytes #define yy_init_buffer H5LTyy_init_buffer #define yy_flush_buffer H5LTyy_flush_buffer #define yy_load_buffer_state H5LTyy_load_buffer_state #define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yypush_buffer_state H5LTyypush_buffer_state +#define yypop_buffer_state H5LTyypop_buffer_state +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#define yy_flex_debug H5LTyy_flex_debug #define yyin H5LTyyin #define yyleng H5LTyyleng #define yylex H5LTyylex @@ -49,12 +55,246 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define H5LTyy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer H5LTyy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define H5LTyy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer H5LTyy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define H5LTyy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer H5LTyy_scan_buffer +#endif + +#ifdef yy_scan_string +#define H5LTyy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string H5LTyy_scan_string +#endif + +#ifdef yy_scan_bytes +#define H5LTyy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes H5LTyy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define H5LTyy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer H5LTyy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define H5LTyy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer H5LTyy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define H5LTyy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state H5LTyy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define H5LTyy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define H5LTyypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state H5LTyypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define H5LTyypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state H5LTyypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define H5LTyyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#endif + +#ifdef yylex +#define H5LTyylex_ALREADY_DEFINED +#else +#define yylex H5LTyylex +#endif + +#ifdef yyrestart +#define H5LTyyrestart_ALREADY_DEFINED +#else +#define yyrestart H5LTyyrestart +#endif + +#ifdef yylex_init +#define H5LTyylex_init_ALREADY_DEFINED +#else +#define yylex_init H5LTyylex_init +#endif + +#ifdef yylex_init_extra +#define H5LTyylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra H5LTyylex_init_extra +#endif + +#ifdef yylex_destroy +#define H5LTyylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy H5LTyylex_destroy +#endif + +#ifdef yyget_debug +#define H5LTyyget_debug_ALREADY_DEFINED +#else +#define yyget_debug H5LTyyget_debug +#endif + +#ifdef yyset_debug +#define H5LTyyset_debug_ALREADY_DEFINED +#else +#define yyset_debug H5LTyyset_debug +#endif + +#ifdef yyget_extra +#define H5LTyyget_extra_ALREADY_DEFINED +#else +#define yyget_extra H5LTyyget_extra +#endif + +#ifdef yyset_extra +#define H5LTyyset_extra_ALREADY_DEFINED +#else +#define yyset_extra H5LTyyset_extra +#endif + +#ifdef yyget_in +#define H5LTyyget_in_ALREADY_DEFINED +#else +#define yyget_in H5LTyyget_in +#endif + +#ifdef yyset_in +#define H5LTyyset_in_ALREADY_DEFINED +#else +#define yyset_in H5LTyyset_in +#endif + +#ifdef yyget_out +#define H5LTyyget_out_ALREADY_DEFINED +#else +#define yyget_out H5LTyyget_out +#endif + +#ifdef yyset_out +#define H5LTyyset_out_ALREADY_DEFINED +#else +#define yyset_out H5LTyyset_out +#endif + +#ifdef yyget_leng +#define H5LTyyget_leng_ALREADY_DEFINED +#else +#define yyget_leng H5LTyyget_leng +#endif + +#ifdef yyget_text +#define H5LTyyget_text_ALREADY_DEFINED +#else +#define yyget_text H5LTyyget_text +#endif + +#ifdef yyget_lineno +#define H5LTyyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno H5LTyyget_lineno +#endif + +#ifdef yyset_lineno +#define H5LTyyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno H5LTyyset_lineno +#endif + +#ifdef yywrap +#define H5LTyywrap_ALREADY_DEFINED +#else +#define yywrap H5LTyywrap +#endif + +#ifdef yyalloc +#define H5LTyyalloc_ALREADY_DEFINED +#else +#define yyalloc H5LTyyalloc +#endif + +#ifdef yyrealloc +#define H5LTyyrealloc_ALREADY_DEFINED +#else +#define yyrealloc H5LTyyrealloc +#endif + +#ifdef yyfree +#define H5LTyyfree_ALREADY_DEFINED +#else +#define yyfree H5LTyyfree +#endif + +#ifdef yytext +#define H5LTyytext_ALREADY_DEFINED +#else +#define yytext H5LTyytext +#endif + +#ifdef yyleng +#define H5LTyyleng_ALREADY_DEFINED +#else +#define yyleng H5LTyyleng +#endif + +#ifdef yyin +#define H5LTyyin_ALREADY_DEFINED +#else +#define yyin H5LTyyin +#endif + +#ifdef yyout +#define H5LTyyout_ALREADY_DEFINED +#else +#define yyout H5LTyyout +#endif + +#ifdef yy_flex_debug +#define H5LTyy_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug H5LTyy_flex_debug +#endif + +#ifdef yylineno +#define H5LTyylineno_ALREADY_DEFINED +#else +#define yylineno H5LTyylineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -88,7 +328,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -96,7 +335,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -127,63 +365,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) +#endif /* ! C99 */ -#define YY_USE_CONST +#endif /* ! FLEXINT_H */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE H5LTyyrestart(H5LTyyin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -200,30 +436,30 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t H5LTyyleng; +extern int yyleng; -extern FILE *H5LTyyin, *H5LTyyout; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up H5LTyytext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up H5LTyytext again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -238,12 +474,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -266,7 +502,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -283,8 +519,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via H5LTyyrestart()), so that the user can continue scanning by - * just pointing H5LTyyin at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -294,7 +530,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -305,103 +541,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when H5LTyytext is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t H5LTyyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow H5LTyywrap()'s to do buffer switches - * instead of setting up a fresh H5LTyyin. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void H5LTyyrestart (FILE *input_file ); -void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE H5LTyy_create_buffer (FILE *file,int size ); -void H5LTyy_delete_buffer (YY_BUFFER_STATE b ); -void H5LTyy_flush_buffer (YY_BUFFER_STATE b ); -void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void H5LTyypop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void H5LTyyensure_buffer_stack (void ); -static void H5LTyy_load_buffer_state (void ); -static void H5LTyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER H5LTyy_flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE H5LTyy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE H5LTyy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *H5LTyyalloc (yy_size_t ); -void *H5LTyyrealloc (void *,yy_size_t ); -void H5LTyyfree (void * ); - -#define yy_new_buffer H5LTyy_create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - H5LTyyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - H5LTyyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *H5LTyyin = (FILE *) 0, *H5LTyyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int H5LTyylineno; +extern int yylineno; +int yylineno = 1; -int H5LTyylineno = 1; - -extern char *H5LTyytext; -#define yytext_ptr H5LTyytext +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up H5LTyytext. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - H5LTyyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 66 #define YY_END_OF_BUFFER 67 /* This struct is not used in this scanner, @@ -411,7 +642,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[437] = +static const flex_int16_t yy_acclist[437] = { 0, 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, @@ -463,7 +694,7 @@ static yyconst flex_int16_t yy_acclist[437] = 57, 21, 57, 34, 34, 57 } ; -static yyconst flex_int16_t yy_accept[546] = +static const flex_int16_t yy_accept[546] = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, 16, 18, 20, 21, 22, 23, 24, 26, 28, 30, @@ -527,7 +758,7 @@ static yyconst flex_int16_t yy_accept[546] = 432, 434, 435, 437, 437 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -559,7 +790,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[42] = +static const YY_CHAR yy_meta[42] = { 0, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, @@ -568,7 +799,7 @@ static yyconst flex_int32_t yy_meta[42] = 1 } ; -static yyconst flex_int16_t yy_base[547] = +static const flex_int16_t yy_base[547] = { 0, 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, 611, 611, 56, 599, 580, 575, 611, 611, 611, 611, @@ -632,7 +863,7 @@ static yyconst flex_int16_t yy_base[547] = 0, 611, 0, 611, 106, 275 } ; -static yyconst flex_int16_t yy_def[547] = +static const flex_int16_t yy_def[547] = { 0, 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, @@ -696,7 +927,7 @@ static yyconst flex_int16_t yy_def[547] = 546, 544, 546, 0, 544, 544 } ; -static yyconst flex_int16_t yy_nxt[653] = +static const flex_int16_t yy_nxt[653] = { 0, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 6, 6, 13, 6, 6, 6, @@ -772,7 +1003,7 @@ static yyconst flex_int16_t yy_nxt[653] = 544, 544 } ; -static yyconst flex_int16_t yy_chk[653] = +static const flex_int16_t yy_chk[653] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -848,15 +1079,15 @@ static yyconst flex_int16_t yy_chk[653] = 544, 544 } ; -extern int H5LTyy_flex_debug; -int H5LTyy_flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; static char *yy_full_match; static int yy_lp; #define REJECT \ { \ -*yy_cp = (yy_hold_char); /* undo effects of setting up H5LTyytext */ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ ++(yy_lp); \ goto find_rule; \ @@ -865,7 +1096,7 @@ goto find_rule; \ #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *H5LTyytext; +char *yytext; #line 1 "hl/src/H5LTanalyze.l" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * @@ -893,7 +1124,6 @@ char *H5LTyytext; /* Turn off suggest const & malloc attribute warnings in gcc */ #if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" #endif int my_yyinput(char *, int); @@ -943,8 +1173,9 @@ extern hbool_t is_opq_tag; hbool_t first_quote = 1; +#line 1155 "hl/src/H5LTanalyze.c" -#line 926 "hl/src/H5LTanalyze.c" +#line 1157 "hl/src/H5LTanalyze.c" #define INITIAL 0 #define TAG_STRING 1 @@ -953,36 +1184,36 @@ hbool_t first_quote = 1; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int H5LTyylex_destroy (void ); +int yylex_destroy ( void ); -int H5LTyyget_debug (void ); +int yyget_debug ( void ); -void H5LTyyset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE H5LTyyget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void H5LTyyset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *H5LTyyget_in (void ); +FILE *yyget_in ( void ); -void H5LTyyset_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *H5LTyyget_out (void ); +FILE *yyget_out ( void ); -void H5LTyyset_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t H5LTyyget_leng (void ); + int yyget_leng ( void ); -char *H5LTyyget_text (void ); +char *yyget_text ( void ); -int H5LTyyget_lineno (void ); +int yyget_lineno ( void ); -void H5LTyyset_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -990,35 +1221,43 @@ void H5LTyyset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int H5LTyywrap (void ); +extern "C" int yywrap ( void ); #else -extern int H5LTyywrap (void ); +extern int yywrap ( void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1026,7 +1265,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout ) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1037,20 +1276,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( H5LTyyin ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, H5LTyyin))==0 && ferror(H5LTyyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1058,7 +1297,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(H5LTyyin); \ + clearerr(yyin); \ } \ }\ \ @@ -1091,12 +1330,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int H5LTyylex (void); +extern int yylex (void); -#define YY_DECL int H5LTyylex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after H5LTyytext and H5LTyyleng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1105,7 +1344,7 @@ extern int H5LTyylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1115,15 +1354,10 @@ extern int H5LTyylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 83 "hl/src/H5LTanalyze.l" - - -#line 1104 "hl/src/H5LTanalyze.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -1134,33 +1368,39 @@ YY_DECL /* Create the reject buffer large enough to save one state per allowed character. */ if ( ! (yy_state_buf) ) - (yy_state_buf) = (yy_state_type *)H5LTyyalloc(YY_STATE_BUF_SIZE ); + (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE ); if ( ! (yy_state_buf) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyylex()" ); + YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! H5LTyyin ) - H5LTyyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! H5LTyyout ) - H5LTyyout = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 82 "hl/src/H5LTanalyze.l" + + +#line 1376 "hl/src/H5LTanalyze.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of H5LTyytext. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1176,14 +1416,14 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } @@ -1192,8 +1432,9 @@ yy_match: yy_find_action: yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; -goto find_rule; /* Shut up GCC warning -Wall */ + find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ { if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) @@ -1217,282 +1458,282 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 85 "hl/src/H5LTanalyze.l" +#line 84 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 86 "hl/src/H5LTanalyze.l" +#line 85 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 87 "hl/src/H5LTanalyze.l" +#line 86 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 88 "hl/src/H5LTanalyze.l" +#line 87 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 89 "hl/src/H5LTanalyze.l" +#line 88 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 90 "hl/src/H5LTanalyze.l" +#line 89 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 91 "hl/src/H5LTanalyze.l" +#line 90 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 92 "hl/src/H5LTanalyze.l" +#line 91 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 94 "hl/src/H5LTanalyze.l" +#line 93 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 95 "hl/src/H5LTanalyze.l" +#line 94 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 96 "hl/src/H5LTanalyze.l" +#line 95 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 97 "hl/src/H5LTanalyze.l" +#line 96 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 98 "hl/src/H5LTanalyze.l" +#line 97 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 99 "hl/src/H5LTanalyze.l" +#line 98 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 100 "hl/src/H5LTanalyze.l" +#line 99 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 101 "hl/src/H5LTanalyze.l" +#line 100 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 103 "hl/src/H5LTanalyze.l" +#line 102 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 104 "hl/src/H5LTanalyze.l" +#line 103 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 105 "hl/src/H5LTanalyze.l" +#line 104 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 106 "hl/src/H5LTanalyze.l" +#line 105 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 107 "hl/src/H5LTanalyze.l" +#line 106 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 108 "hl/src/H5LTanalyze.l" +#line 107 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 109 "hl/src/H5LTanalyze.l" +#line 108 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 110 "hl/src/H5LTanalyze.l" +#line 109 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 111 "hl/src/H5LTanalyze.l" +#line 110 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 112 "hl/src/H5LTanalyze.l" +#line 111 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 113 "hl/src/H5LTanalyze.l" +#line 112 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 115 "hl/src/H5LTanalyze.l" +#line 114 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 116 "hl/src/H5LTanalyze.l" +#line 115 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 117 "hl/src/H5LTanalyze.l" +#line 116 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 118 "hl/src/H5LTanalyze.l" +#line 117 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 119 "hl/src/H5LTanalyze.l" +#line 118 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 120 "hl/src/H5LTanalyze.l" +#line 119 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 121 "hl/src/H5LTanalyze.l" +#line 120 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 123 "hl/src/H5LTanalyze.l" +#line 122 "hl/src/H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 124 "hl/src/H5LTanalyze.l" +#line 123 "hl/src/H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 125 "hl/src/H5LTanalyze.l" +#line 124 "hl/src/H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 126 "hl/src/H5LTanalyze.l" +#line 125 "hl/src/H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 127 "hl/src/H5LTanalyze.l" +#line 126 "hl/src/H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 128 "hl/src/H5LTanalyze.l" +#line 127 "hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 129 "hl/src/H5LTanalyze.l" +#line 128 "hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 130 "hl/src/H5LTanalyze.l" +#line 129 "hl/src/H5LTanalyze.l" {return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 131 "hl/src/H5LTanalyze.l" +#line 130 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 132 "hl/src/H5LTanalyze.l" +#line 131 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 133 "hl/src/H5LTanalyze.l" +#line 132 "hl/src/H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 134 "hl/src/H5LTanalyze.l" +#line 133 "hl/src/H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 135 "hl/src/H5LTanalyze.l" +#line 134 "hl/src/H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 137 "hl/src/H5LTanalyze.l" +#line 136 "hl/src/H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 138 "hl/src/H5LTanalyze.l" +#line 137 "hl/src/H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 139 "hl/src/H5LTanalyze.l" +#line 138 "hl/src/H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 140 "hl/src/H5LTanalyze.l" +#line 139 "hl/src/H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 142 "hl/src/H5LTanalyze.l" +#line 141 "hl/src/H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 143 "hl/src/H5LTanalyze.l" +#line 142 "hl/src/H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 144 "hl/src/H5LTanalyze.l" +#line 143 "hl/src/H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 146 "hl/src/H5LTanalyze.l" +#line 145 "hl/src/H5LTanalyze.l" { if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { - H5LTyylval.ival = atoi(H5LTyytext); + H5LTyylval.ival = atoi(yytext); return NUMBER; } else REJECT; @@ -1500,7 +1741,7 @@ YY_RULE_SETUP YY_BREAK case 56: YY_RULE_SETUP -#line 156 "hl/src/H5LTanalyze.l" +#line 155 "hl/src/H5LTanalyze.l" { /*if it's first quote, and is a compound field name or an enum symbol*/ if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) @@ -1515,12 +1756,12 @@ YY_RULE_SETUP case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 166 "hl/src/H5LTanalyze.l" +#line 165 "hl/src/H5LTanalyze.l" { #ifdef H5_HAVE_WIN32_API - H5LTyylval.sval = _strdup(H5LTyytext); + H5LTyylval.sval = _strdup(yytext); #else /* H5_HAVE_WIN32_API */ - H5LTyylval.sval = strdup(H5LTyytext); + H5LTyylval.sval = strdup(yytext); #endif /* H5_HAVE_WIN32_API */ BEGIN INITIAL; return STRING; @@ -1528,52 +1769,52 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 176 "hl/src/H5LTanalyze.l" +#line 175 "hl/src/H5LTanalyze.l" {return token('{');} YY_BREAK case 59: YY_RULE_SETUP -#line 177 "hl/src/H5LTanalyze.l" +#line 176 "hl/src/H5LTanalyze.l" {return token('}');} YY_BREAK case 60: YY_RULE_SETUP -#line 178 "hl/src/H5LTanalyze.l" +#line 177 "hl/src/H5LTanalyze.l" {return token('[');} YY_BREAK case 61: YY_RULE_SETUP -#line 179 "hl/src/H5LTanalyze.l" +#line 178 "hl/src/H5LTanalyze.l" {return token(']');} YY_BREAK case 62: YY_RULE_SETUP -#line 180 "hl/src/H5LTanalyze.l" +#line 179 "hl/src/H5LTanalyze.l" {return token(':');} YY_BREAK case 63: YY_RULE_SETUP -#line 181 "hl/src/H5LTanalyze.l" +#line 180 "hl/src/H5LTanalyze.l" {return token(';');} YY_BREAK case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 182 "hl/src/H5LTanalyze.l" +#line 181 "hl/src/H5LTanalyze.l" ; YY_BREAK case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 183 "hl/src/H5LTanalyze.l" +#line 182 "hl/src/H5LTanalyze.l" { return 0; } YY_BREAK case 66: YY_RULE_SETUP -#line 185 "hl/src/H5LTanalyze.l" +#line 184 "hl/src/H5LTanalyze.l" ECHO; YY_BREAK -#line 1555 "hl/src/H5LTanalyze.c" +#line 1796 "hl/src/H5LTanalyze.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TAG_STRING): yyterminate(); @@ -1591,15 +1832,15 @@ ECHO; { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed H5LTyyin at a new source and called - * H5LTyylex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = H5LTyyin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1652,11 +1893,11 @@ ECHO; { (yy_did_buffer_switch_on_eof) = 0; - if ( H5LTyywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * H5LTyytext, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -1705,7 +1946,8 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of H5LTyylex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1716,9 +1958,9 @@ ECHO; */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1747,7 +1989,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1760,7 +2002,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1786,7 +2028,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - H5LTyyrestart(H5LTyyin ); + yyrestart( yyin ); } else @@ -1800,12 +2042,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) H5LTyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1821,8 +2066,8 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); @@ -1831,14 +2076,14 @@ static int yy_get_next_buffer (void) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *(yy_state_ptr)++ = yy_current_state; } @@ -1852,39 +2097,41 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; + int yy_is_jam; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 544); if ( ! yy_is_jam ) *(yy_state_ptr)++ = yy_current_state; - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up H5LTyytext */ + /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1893,7 +2140,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1906,6 +2153,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1930,7 +2179,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1947,13 +2196,13 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - H5LTyyrestart(H5LTyyin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( H5LTyywrap( ) ) + if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -1973,7 +2222,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve H5LTyytext */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -1985,32 +2234,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void H5LTyyrestart (FILE * input_file ) + void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - H5LTyy_init_buffer(YY_CURRENT_BUFFER,input_file ); - H5LTyy_load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * H5LTyypop_buffer_state(); - * H5LTyypush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2023,21 +2272,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (H5LTyywrap()) processing, but the only time this flag - * is looked at is after H5LTyywrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void H5LTyy_load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - H5LTyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2047,35 +2296,35 @@ static void H5LTyy_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE H5LTyy_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) H5LTyyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - H5LTyy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with H5LTyy_create_buffer() + * @param b a buffer created with yy_create_buffer() * */ - void H5LTyy_delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2085,31 +2334,27 @@ static void H5LTyy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - H5LTyyfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - H5LTyyfree((void *) b ); + yyfree( (void *) b ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a H5LTyyrestart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void H5LTyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - H5LTyy_flush_buffer(b ); + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then H5LTyy_init_buffer was _probably_ - * called from H5LTyyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2126,7 +2371,7 @@ extern int isatty (int ); * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void H5LTyy_flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2146,7 +2391,7 @@ extern int isatty (int ); b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2155,14 +2400,14 @@ extern int isatty (int ); * @param new_buffer The new state. * */ -void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - H5LTyyensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from H5LTyy_switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2176,8 +2421,8 @@ void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from H5LTyy_switch_to_buffer. */ - H5LTyy_load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -2185,18 +2430,18 @@ void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void H5LTyypop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2204,7 +2449,7 @@ void H5LTyypop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void H5LTyyensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -2214,15 +2459,15 @@ static void H5LTyyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2231,15 +2476,15 @@ static void H5LTyyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyrealloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2251,9 +2496,9 @@ static void H5LTyyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2261,68 +2506,69 @@ YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - H5LTyy_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to H5LTyylex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * H5LTyy_scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - return H5LTyy_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) H5LTyyalloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = H5LTyy_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in H5LTyy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2336,9 +2582,9 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2348,14 +2594,14 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up H5LTyytext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - H5LTyytext[H5LTyyleng] = (yy_hold_char); \ - (yy_c_buf_p) = H5LTyytext + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - H5LTyyleng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -2364,91 +2610,91 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int H5LTyyget_lineno (void) +int yyget_lineno (void) { - - return H5LTyylineno; + + return yylineno; } /** Get the input stream. * */ -FILE *H5LTyyget_in (void) +FILE *yyget_in (void) { - return H5LTyyin; + return yyin; } /** Get the output stream. * */ -FILE *H5LTyyget_out (void) +FILE *yyget_out (void) { - return H5LTyyout; + return yyout; } /** Get the length of the current token. * */ -yy_size_t H5LTyyget_leng (void) +int yyget_leng (void) { - return H5LTyyleng; + return yyleng; } /** Get the current token. * */ -char *H5LTyyget_text (void) +char *yyget_text (void) { - return H5LTyytext; + return yytext; } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void H5LTyyset_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - H5LTyylineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * - * @see H5LTyy_switch_to_buffer + * @see yy_switch_to_buffer */ -void H5LTyyset_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - H5LTyyin = in_str ; + yyin = _in_str ; } -void H5LTyyset_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - H5LTyyout = out_str ; + yyout = _out_str ; } -int H5LTyyget_debug (void) +int yyget_debug (void) { - return H5LTyy_flex_debug; + return yy_flex_debug; } -void H5LTyyset_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - H5LTyy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from H5LTyylex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -2459,39 +2705,39 @@ static int yy_init_globals (void) /* Defined in main.c */ #ifdef YY_STDINIT - H5LTyyin = stdin; - H5LTyyout = stdout; + yyin = stdin; + yyout = stdout; #else - H5LTyyin = (FILE *) 0; - H5LTyyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * H5LTyylex_init() + * yylex_init() */ return 0; } -/* H5LTyylex_destroy is for both reentrant and non-reentrant scanners. */ -int H5LTyylex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - H5LTyypop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - H5LTyyfree((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; - H5LTyyfree ( (yy_state_buf) ); + yyfree ( (yy_state_buf) ); (yy_state_buf) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * H5LTyylex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -2502,18 +2748,19 @@ int H5LTyylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2521,13 +2768,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *H5LTyyalloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *H5LTyyrealloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2535,18 +2783,17 @@ void *H5LTyyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void H5LTyyfree (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see H5LTyyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 185 "hl/src/H5LTanalyze.l" - +#line 184 "hl/src/H5LTanalyze.l" int my_yyinput(char *buf, int max_size) { @@ -2559,11 +2806,11 @@ int my_yyinput(char *buf, int max_size) int H5LTyyerror(const char *msg) { - printf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); + printf("ERROR: %s before \"%s\".\n", msg, yytext); return 0; } -int H5LTyywrap() +int yywrap() { return(1); } diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index f16455b..5015053 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -26,7 +26,6 @@ /* Turn off suggest const & malloc attribute warnings in gcc */ #if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" #endif int my_yyinput(char *, int); diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 193ba1f..a9b3dc3 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -20,12 +20,11 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -/* A Bison parser, made by GNU Bison 3.4.1. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,14 +62,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.4.1" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -95,8 +91,8 @@ #define yylval H5LTyylval #define yychar H5LTyychar -/* First part of user prologue. */ -#line 20 "hl/src/H5LTparse.y" +/* Copy the first part of user declarations. */ +#line 20 "hl/src/H5LTparse.y" /* yacc.c:339 */ #include <stdio.h> #include <string.h> @@ -149,17 +145,13 @@ hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ -#line 131 "hl/src/H5LTparse.c" +#line 127 "hl/src/H5LTparse.c" /* yacc.c:339 */ # ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr # else -# define YY_NULLPTR ((void*)0) +# define YY_NULLPTR 0 # endif # endif @@ -171,8 +163,8 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ # define YYERROR_VERBOSE 0 #endif -/* Use api.header.include to #include this header - instead of duplicating it here. */ +/* In a future release of Bison, this section will be replaced + by #include "H5LTparse.h". */ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED /* Debug traces. */ @@ -249,17 +241,18 @@ extern int H5LTyydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + union YYSTYPE { -#line 72 "hl/src/H5LTparse.y" +#line 72 "hl/src/H5LTparse.y" /* yacc.c:355 */ int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 239 "hl/src/H5LTparse.c" - +#line 232 "hl/src/H5LTparse.c" /* yacc.c:355 */ }; + typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -272,7 +265,9 @@ hid_t H5LTyyparse (void); #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ +/* Copy the second part of user declarations. */ +#line 249 "hl/src/H5LTparse.c" /* yacc.c:358 */ #ifdef short # undef short @@ -293,13 +288,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short yytype_uint16; +typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short yytype_int16; +typedef short int yytype_int16; #endif #ifndef YYSIZE_T @@ -311,7 +306,7 @@ typedef short yytype_int16; # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned +# define YYSIZE_T unsigned int # endif #endif @@ -347,6 +342,15 @@ typedef short yytype_int16; # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -354,7 +358,7 @@ typedef short yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -374,8 +378,6 @@ typedef short yytype_int16; #endif -#define YY_ASSERT(E) ((void) (0 && (E))) - #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -518,16 +520,16 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 143 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 313 -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -823,22 +825,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) /* Error token number */ #define YYTERROR 1 @@ -878,37 +880,37 @@ do { \ } while (0) -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ static void -yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyoutput = yyo; - YYUSE (yyoutput); + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ static void -yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyo, "%s %s (", + YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyo, yytype, yyvaluep); - YYFPRINTF (yyo, ")"); + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. @@ -942,7 +944,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long yylno = yyrline[yyrule]; + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -953,7 +955,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &yyvsp[(yyi + 1) - (yynrhs)] + &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } @@ -1057,10 +1059,7 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - else - goto append; - - append: + /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; @@ -1078,7 +1077,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); + return yystpcpy (yyres, yystr) - yyres; } # endif @@ -1156,10 +1155,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; + yysize = yysize1; } } } @@ -1171,7 +1170,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break - default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1183,10 +1181,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; + yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1312,33 +1309,23 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; - /*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | +| yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ -yynewstate: + yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - -/*--------------------------------------------------------------------. -| yynewstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - *yyssp = (yytype_int16) yystate; + yysetstate: + *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; -#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); + YYSIZE_T yysize = yyssp - yyss + 1; -# if defined yyoverflow +#ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -1354,10 +1341,14 @@ yysetstate: &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); + yyss = yyss1; yyvs = yyvs1; } -# else /* defined YYSTACK_RELOCATE */ +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1373,33 +1364,35 @@ yysetstate: goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif +#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; - /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1457,6 +1450,7 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + goto yynewstate; @@ -1471,7 +1465,7 @@ yydefault: /*-----------------------------. -| yyreduce -- do a reduction. | +| yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1491,246 +1485,246 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 105 "hl/src/H5LTparse.y" + case 2: +#line 105 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } -#line 1476 "hl/src/H5LTparse.c" +#line 1470 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 3: -#line 106 "hl/src/H5LTparse.y" +#line 106 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { return (yyval.hid);} -#line 1482 "hl/src/H5LTparse.c" +#line 1476 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 13: -#line 120 "hl/src/H5LTparse.y" +#line 120 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } -#line 1488 "hl/src/H5LTparse.c" +#line 1482 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 14: -#line 121 "hl/src/H5LTparse.y" +#line 121 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } -#line 1494 "hl/src/H5LTparse.c" +#line 1488 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 15: -#line 122 "hl/src/H5LTparse.y" +#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } -#line 1500 "hl/src/H5LTparse.c" +#line 1494 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 16: -#line 123 "hl/src/H5LTparse.y" +#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } -#line 1506 "hl/src/H5LTparse.c" +#line 1500 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 17: -#line 124 "hl/src/H5LTparse.y" +#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } -#line 1512 "hl/src/H5LTparse.c" +#line 1506 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 18: -#line 125 "hl/src/H5LTparse.y" +#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } -#line 1518 "hl/src/H5LTparse.c" +#line 1512 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 19: -#line 126 "hl/src/H5LTparse.y" +#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } -#line 1524 "hl/src/H5LTparse.c" +#line 1518 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 20: -#line 127 "hl/src/H5LTparse.y" +#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } -#line 1530 "hl/src/H5LTparse.c" +#line 1524 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 21: -#line 128 "hl/src/H5LTparse.y" +#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } -#line 1536 "hl/src/H5LTparse.c" +#line 1530 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 22: -#line 129 "hl/src/H5LTparse.y" +#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } -#line 1542 "hl/src/H5LTparse.c" +#line 1536 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 23: -#line 130 "hl/src/H5LTparse.y" +#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } -#line 1548 "hl/src/H5LTparse.c" +#line 1542 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 24: -#line 131 "hl/src/H5LTparse.y" +#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } -#line 1554 "hl/src/H5LTparse.c" +#line 1548 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 25: -#line 132 "hl/src/H5LTparse.y" +#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } -#line 1560 "hl/src/H5LTparse.c" +#line 1554 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 26: -#line 133 "hl/src/H5LTparse.y" +#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } -#line 1566 "hl/src/H5LTparse.c" +#line 1560 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 27: -#line 134 "hl/src/H5LTparse.y" +#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } -#line 1572 "hl/src/H5LTparse.c" +#line 1566 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 28: -#line 135 "hl/src/H5LTparse.y" +#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } -#line 1578 "hl/src/H5LTparse.c" +#line 1572 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 29: -#line 136 "hl/src/H5LTparse.y" +#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } -#line 1584 "hl/src/H5LTparse.c" +#line 1578 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 30: -#line 137 "hl/src/H5LTparse.y" +#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } -#line 1590 "hl/src/H5LTparse.c" +#line 1584 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 31: -#line 138 "hl/src/H5LTparse.y" +#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } -#line 1596 "hl/src/H5LTparse.c" +#line 1590 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 32: -#line 139 "hl/src/H5LTparse.y" +#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } -#line 1602 "hl/src/H5LTparse.c" +#line 1596 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 33: -#line 140 "hl/src/H5LTparse.y" +#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } -#line 1608 "hl/src/H5LTparse.c" +#line 1602 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 34: -#line 141 "hl/src/H5LTparse.y" +#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } -#line 1614 "hl/src/H5LTparse.c" +#line 1608 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 35: -#line 142 "hl/src/H5LTparse.y" +#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } -#line 1620 "hl/src/H5LTparse.c" +#line 1614 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 36: -#line 143 "hl/src/H5LTparse.y" +#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } -#line 1626 "hl/src/H5LTparse.c" +#line 1620 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 37: -#line 144 "hl/src/H5LTparse.y" +#line 144 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } -#line 1632 "hl/src/H5LTparse.c" +#line 1626 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 38: -#line 145 "hl/src/H5LTparse.y" +#line 145 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } -#line 1638 "hl/src/H5LTparse.c" +#line 1632 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 39: -#line 146 "hl/src/H5LTparse.y" +#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } -#line 1644 "hl/src/H5LTparse.c" +#line 1638 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 40: -#line 149 "hl/src/H5LTparse.y" +#line 149 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } -#line 1650 "hl/src/H5LTparse.c" +#line 1644 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 41: -#line 150 "hl/src/H5LTparse.y" +#line 150 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } -#line 1656 "hl/src/H5LTparse.c" +#line 1650 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 42: -#line 151 "hl/src/H5LTparse.y" +#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } -#line 1662 "hl/src/H5LTparse.c" +#line 1656 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 43: -#line 152 "hl/src/H5LTparse.y" +#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } -#line 1668 "hl/src/H5LTparse.c" +#line 1662 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 44: -#line 153 "hl/src/H5LTparse.y" +#line 153 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } -#line 1674 "hl/src/H5LTparse.c" +#line 1668 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 45: -#line 154 "hl/src/H5LTparse.y" +#line 154 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } -#line 1680 "hl/src/H5LTparse.c" +#line 1674 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 46: -#line 155 "hl/src/H5LTparse.y" +#line 155 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } -#line 1686 "hl/src/H5LTparse.c" +#line 1680 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 47: -#line 159 "hl/src/H5LTparse.y" +#line 159 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } -#line 1692 "hl/src/H5LTparse.c" +#line 1686 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 48: -#line 161 "hl/src/H5LTparse.y" +#line 161 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } -#line 1702 "hl/src/H5LTparse.c" +#line 1696 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 51: -#line 170 "hl/src/H5LTparse.y" +#line 170 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } -#line 1708 "hl/src/H5LTparse.c" +#line 1702 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 52: -#line 172 "hl/src/H5LTparse.y" +#line 172 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -1765,117 +1759,117 @@ yyreduce: new_size = H5Tget_size(dtype_id); } -#line 1747 "hl/src/H5LTparse.c" +#line 1741 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 53: -#line 208 "hl/src/H5LTparse.y" +#line 208 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.sval) = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1757 "hl/src/H5LTparse.c" +#line 1751 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 54: -#line 215 "hl/src/H5LTparse.y" +#line 215 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } -#line 1763 "hl/src/H5LTparse.c" +#line 1757 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 55: -#line 217 "hl/src/H5LTparse.y" +#line 217 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.ival) = yylval.ival; } -#line 1769 "hl/src/H5LTparse.c" +#line 1763 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 57: -#line 221 "hl/src/H5LTparse.y" +#line 221 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { asindex++; /*pushd onto the stack*/ } -#line 1775 "hl/src/H5LTparse.c" +#line 1769 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 58: -#line 223 "hl/src/H5LTparse.y" +#line 223 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose((yyvsp[-1].hid)); } -#line 1786 "hl/src/H5LTparse.c" +#line 1780 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 61: -#line 233 "hl/src/H5LTparse.y" +#line 233 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } -#line 1792 "hl/src/H5LTparse.c" +#line 1786 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 62: -#line 234 "hl/src/H5LTparse.y" +#line 234 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } -#line 1802 "hl/src/H5LTparse.c" +#line 1796 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 65: -#line 245 "hl/src/H5LTparse.y" +#line 245 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1808 "hl/src/H5LTparse.c" +#line 1802 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 66: -#line 250 "hl/src/H5LTparse.y" +#line 250 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_opq_size = 1; } -#line 1814 "hl/src/H5LTparse.c" +#line 1808 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 67: -#line 251 "hl/src/H5LTparse.y" +#line 251 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); is_opq_size = 0; } -#line 1824 "hl/src/H5LTparse.c" +#line 1818 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 68: -#line 256 "hl/src/H5LTparse.y" +#line 256 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_opq_tag = 1; } -#line 1830 "hl/src/H5LTparse.c" +#line 1824 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 69: -#line 257 "hl/src/H5LTparse.y" +#line 257 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { H5Tset_tag((yyvsp[-6].hid), yylval.sval); free(yylval.sval); yylval.sval = NULL; is_opq_tag = 0; } -#line 1841 "hl/src/H5LTparse.c" +#line 1835 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 70: -#line 263 "hl/src/H5LTparse.y" +#line 263 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = (yyvsp[-8].hid); } -#line 1847 "hl/src/H5LTparse.c" +#line 1841 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 73: -#line 271 "hl/src/H5LTparse.y" +#line 271 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_str_size = 1; } -#line 1853 "hl/src/H5LTparse.c" +#line 1847 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 74: -#line 272 "hl/src/H5LTparse.y" +#line 272 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; @@ -1883,11 +1877,11 @@ yyreduce: str_size = yylval.ival; is_str_size = 0; } -#line 1865 "hl/src/H5LTparse.c" +#line 1859 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 75: -#line 280 "hl/src/H5LTparse.y" +#line 280 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; @@ -1896,33 +1890,33 @@ yyreduce: else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } -#line 1878 "hl/src/H5LTparse.c" +#line 1872 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 76: -#line 289 "hl/src/H5LTparse.y" +#line 289 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } -#line 1889 "hl/src/H5LTparse.c" +#line 1883 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 77: -#line 296 "hl/src/H5LTparse.y" +#line 296 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } -#line 1900 "hl/src/H5LTparse.c" +#line 1894 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 78: -#line 303 "hl/src/H5LTparse.y" +#line 303 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { hid_t str_id = (yyvsp[-1].hid); @@ -1939,71 +1933,71 @@ yyreduce: (yyval.hid) = str_id; } -#line 1921 "hl/src/H5LTparse.c" +#line 1915 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 79: -#line 320 "hl/src/H5LTparse.y" +#line 320 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_VARIABLE_TOKEN;} -#line 1927 "hl/src/H5LTparse.c" +#line 1921 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 81: -#line 323 "hl/src/H5LTparse.y" +#line 323 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} -#line 1933 "hl/src/H5LTparse.c" +#line 1927 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 82: -#line 324 "hl/src/H5LTparse.y" +#line 324 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} -#line 1939 "hl/src/H5LTparse.c" +#line 1933 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 83: -#line 325 "hl/src/H5LTparse.y" +#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} -#line 1945 "hl/src/H5LTparse.c" +#line 1939 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 84: -#line 327 "hl/src/H5LTparse.y" +#line 327 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} -#line 1951 "hl/src/H5LTparse.c" +#line 1945 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 85: -#line 328 "hl/src/H5LTparse.y" +#line 328 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} -#line 1957 "hl/src/H5LTparse.c" +#line 1951 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 86: -#line 330 "hl/src/H5LTparse.y" +#line 330 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.hid) = H5T_C_S1_TOKEN;} -#line 1963 "hl/src/H5LTparse.c" +#line 1957 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 87: -#line 331 "hl/src/H5LTparse.y" +#line 331 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} -#line 1969 "hl/src/H5LTparse.c" +#line 1963 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 88: -#line 335 "hl/src/H5LTparse.y" +#line 335 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1975 "hl/src/H5LTparse.c" +#line 1969 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 89: -#line 337 "hl/src/H5LTparse.y" +#line 337 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } -#line 1981 "hl/src/H5LTparse.c" +#line 1975 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 92: -#line 342 "hl/src/H5LTparse.y" +#line 342 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum_memb = 1; /*indicate member of enum*/ #ifdef H5_HAVE_WIN32_API @@ -2014,11 +2008,11 @@ yyreduce: free(yylval.sval); yylval.sval = NULL; } -#line 1996 "hl/src/H5LTparse.c" +#line 1990 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 93: -#line 353 "hl/src/H5LTparse.y" +#line 353 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -2061,12 +2055,11 @@ yyreduce: H5Tclose(super); H5Tclose(native); } -#line 2043 "hl/src/H5LTparse.c" +#line 2037 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; -#line 2047 "hl/src/H5LTparse.c" - +#line 2041 "hl/src/H5LTparse.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2091,13 +2084,14 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; @@ -2180,10 +2174,12 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2245,7 +2241,6 @@ yyacceptlab: yyresult = 0; goto yyreturn; - /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2253,7 +2248,6 @@ yyabortlab: yyresult = 1; goto yyreturn; - #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -2264,10 +2258,6 @@ yyexhaustedlab: /* Fall through. */ #endif - -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 73a76e9..e38116a 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.4.1. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,9 +30,6 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED /* Debug traces. */ @@ -110,17 +106,18 @@ extern int H5LTyydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + union YYSTYPE { -#line 72 "hl/src/H5LTparse.y" +#line 72 "hl/src/H5LTparse.y" /* yacc.c:1909 */ int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 122 "hl/src/H5LTparse.h" - +#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */ }; + typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index 07d8bfb..f413bea 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -940,7 +940,7 @@ herr_t H5PTfree_vlen_buff( hid_t table_id, goto error; /* Free the memory. If this succeeds, ret_value should be 0. */ - if((ret_value = H5Dvlen_reclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0) + if((ret_value = H5Treclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0) goto error; /* If the dataspace cannot be closed, return -2 to indicate that memory */ diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 2959c6c..69f3dae 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -93,4 +93,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (hl_gen_test_ld PROPERTIES FOLDER test/hl/gen) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 3cd913f..e12588b 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -67,7 +67,7 @@ if (BUILD_SHARED_LIBS) ) endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_SERIAL) # -------------------------------------------------------------------- # This executable can generate the actual test files - Currently not # used in the CMake Build system as we rely on the test files that are @@ -83,7 +83,9 @@ if (BUILD_TESTING) # add_test (NAME hl_h52gifgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_h52gifgentest>) endif () - include (CMakeTests.cmake) + if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) + endif () endif () #----------------------------------------------------------------------------- diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 8537d7c..094a7b5 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -27,12 +27,6 @@ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "$ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5" "gif2h5_files") add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list}) -if (NOT BUILD_SHARED_LIBS) - set (tgt_ext "") -else () - set (tgt_ext "-shared") -endif () - # Remove any output file left over from previous test run add_test ( NAME HL_TOOLS-clear-objects @@ -45,29 +39,29 @@ add_test ( ) set_tests_properties (HL_TOOLS-clear-objects PROPERTIES FIXTURES_SETUP clear_tools_hl) -add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:gif2h5${tgt_ext}> testfiles/image1.gif image1.h5) +add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:gif2h5${tgt_file_ext}> testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES FIXTURES_REQUIRED clear_tools_hl ) -add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image1.gif -i image) +add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/h52giftst.h5 image1.gif -i image) set_tests_properties (HL_TOOLS_h52gif PROPERTIES FIXTURES_REQUIRED clear_tools_hl ) -add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image.gif -i nosuch_image) +add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true" FIXTURES_REQUIRED clear_tools_hl ) -#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image.gif -i palette) +#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES # WILL_FAIL "true" # FIXTURES_REQUIRED clear_tools_hl #) -add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_ext}> testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true" FIXTURES_REQUIRED clear_tools_hl diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 6668c22..129fa60 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -15,13 +15,13 @@ #include "gif.h" -WORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip; +GIFWORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip; unsigned long cols[256]; char *cmd; FILE *fp; -static WORD +static GIFWORD XC = 0, YC = 0, /* Output X and Y coords of current pixel */ InitCodeSize, /* Starting code size, used during Clear */ CodeSize, /* Code size, read from GIF header */ @@ -29,7 +29,7 @@ static WORD IWidth, IHeight; /* image dimensions */ static int BitOffset = 0, /* Bit Offset of next code */ - Pass = 0, /* Used by output routine if WORDerlaced pic */ + Pass = 0, /* Used by output routine if GIFWORDerlaced pic */ OutCount = 0, /* Decompressor output 'stack count' */ Code, /* Value returned by ReadCode */ MaxCode, /* limiting value for current code size */ @@ -43,26 +43,26 @@ static int ReadMask; /* Code AND mask for current code size */ /*MODIFICATIONS*/ -BYTE tempbyte[10]; -BYTE * tempBYTEptr[10]; -WORD tempint[10]; -WORD ImageCount = 0; +GIFBYTE tempbyte[10]; +GIFBYTE * tempGIFBYTEptr[10]; +GIFWORD tempint[10]; +GIFWORD ImageCount = 0; /*END MODIFICATION*/ boolean Interlace, HasColormap; -BYTE *Image; /* The result array */ -BYTE *RawGIF; /* The heap array to hold it, raw */ -BYTE *Raster; /* The raster data stream, unblocked */ +GIFBYTE *Image; /* The result array */ +GIFBYTE *RawGIF; /* The heap array to hold it, raw */ +GIFBYTE *Raster; /* The raster data stream, unblocked */ /* The hash table used by the decompressor */ -int Prefix[4096]; -int Suffix[4096]; +int *Prefix; +int *Suffix; /* An output array used by the decompressor */ -int OutCode[1025]; +int *OutCode; /* The color map, read from the GIF header */ @@ -70,10 +70,10 @@ int numused; /* * Fetch the next code from the raster data stream. The codes can be any - * length from 3 to 12 bits, packed WORDo 8-bit BYTEs, so we have to maWORDain - * our location in the Raster array as a BIT Offset. We compute the BYTE - * Offset WORDo the raster array by dividing this by 8, pick up three BYTEs, - * compute the bit Offset WORDo our 24-bit chunk, shift to bring the desired + * length from 3 to 12 bits, packed into 8-bit GIFBYTEs, so we have to maintain + * our location in the Raster array as a BIT Offset. We compute the GIFBYTE + * Offset into the raster array by dividing this by 8, pick up three GIFBYTEs, + * compute the bit Offset into our 24-bit chunk, shift to bring the desired * code to the bottom, then mask it off and return it. */ static int @@ -93,7 +93,7 @@ ReadCode(void) } static void -AddToPixel(BYTE Index) +AddToPixel(GIFBYTE Index) { if (YC<IHeight) *(Image + YC * BytesPerScanline + XC) = Index; @@ -104,8 +104,8 @@ AddToPixel(BYTE Index) * Y-coordinate */ if (++XC == IWidth) { /* - * If a non-WORDerlaced picture, just increment YC to the next scan - * line. If it's WORDerlaced, deal with the WORDerlace as described + * If a non-interlaced picture, just increment YC to the next scan + * line. If it's interlaced, deal with the interlace as described * in the GIF spec. Put the decoded scan line out to the screen if we * haven't gone past the bottom of it. */ @@ -154,11 +154,24 @@ AddToPixel(BYTE Index) /* Main routine. Convert a GIF image to an HDF image */ -BYTE * +GIFBYTE * Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) { int i; + if (!(Prefix = calloc(4096, sizeof(int)))) { + printf("Out of memory"); + exit(EXIT_FAILURE); + } + if (!(Suffix = calloc(4096, sizeof(int)))) { + printf("Out of memory"); + exit(EXIT_FAILURE); + } + if (!(OutCode = calloc(1024, sizeof(int)))) { + printf("Out of memory"); + exit(EXIT_FAILURE); + } + XC = 0; YC = 0; Pass = 0; @@ -173,7 +186,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - Interlace = GifImageDesc->PackedField & 0x40; + Interlace = (uint8_t)(GifImageDesc->PackedField & 0x40); /* * Note that I ignore the possible existence of a local color map. I'm @@ -183,7 +196,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) */ /* - * Start reading the raster data. First we get the WORDial code size and + * Start reading the raster data. First we get the intial code size and * compute decompressor constant values, based on this code size. */ @@ -206,13 +219,13 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* * Read the raster data. Here we just transpose it from the GIF array to - * the Raster array, turning it from a series of blocks WORDo one long + * the Raster array, turning it from a series of blocks into one long * data stream, which makes life much easier for ReadCode(). */ /* Allocate the Image */ - if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) { + if (!(Image = (GIFBYTE *)malloc((size_t)IWidth*(size_t)IHeight))) { printf("Out of memory"); exit(EXIT_FAILURE); } @@ -238,7 +251,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) FreeCode = FirstFree; CurCode = OldCode = Code = ReadCode(); FinChar = CurCode & DataMask; - AddToPixel((BYTE)FinChar); + AddToPixel((GIFBYTE)FinChar); } else { /* * If not a clear code, then must be data: save same as CurCode @@ -256,7 +269,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) } /* - * Unless this code is raw data, pursue the chain poWORDed to by + * Unless this code is raw data, pursue the chain pointed to by * CurCode through the hash table to its end; each code in the * chain puts its associated output code on the output queue. */ @@ -278,7 +291,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) * stacked LIFO, so deal with it that way... */ for (i = OutCount - 1; i >= 0; i--) - AddToPixel((BYTE)OutCode[i]); + AddToPixel((GIFBYTE)OutCode[i]); OutCount = 0; @@ -291,7 +304,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) OldCode = InCode; /* - * PoWORD to the next slot in the table. If we exceed the current + * Point to the next slot in the table. If we exceed the current * MaxCode value, increment the code size unless it's already 12. * If it is, do nothing: the next code decompressed better be * CLEAR @@ -309,5 +322,9 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) Code = ReadCode(); } + free(Prefix); + free(Suffix); + free(OutCode); + return Image; } diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index ed1cc81..0c0f963 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -26,17 +26,24 @@ #define MAX_PAL 768 -/* typedef H5T_NATIVE_UINT8 BYTE; */ -typedef unsigned char BYTE; +/* typedef H5T_NATIVE_UINT8 GIFBYTE; */ +typedef unsigned char GIFBYTE; -/* typedef H5T_NATIVE_UINT16 WORD; */ -typedef unsigned long WORD; +/* typedef H5T_NATIVE_UINT16 GIFWORD; */ +typedef unsigned long GIFWORD; -typedef char CHAR; +typedef char GIFCHAR; + +#ifndef boolean typedef unsigned char boolean; +#endif +#ifndef false #define false 0 +#endif +#ifndef true #define true 1 +#endif /* Set the EndianOrder. ** The GIF Reader file should do this. @@ -52,15 +59,15 @@ extern int EndianOrder; ** descriptor, and the global color table for the GIF image. */ typedef struct _GifHeader { /* Offset Description */ - BYTE PackedField; /* 0Ah Color Information */ - WORD TableSize; - BYTE ImageCount; /* Keep a count of the number of images */ - BYTE CommentCount; - BYTE ApplicationCount; - BYTE PlainTextCount; - BYTE HDFPalette[256][3]; - BYTE HeaderDump[6]; /* BYTE array to dump header contents */ - BYTE LSDDump[7]; /* Logical Screen Descriptor dump */ + GIFBYTE PackedField; /* 0Ah Color Information */ + GIFWORD TableSize; + GIFBYTE ImageCount; /* Keep a count of the number of images */ + GIFBYTE CommentCount; + GIFBYTE ApplicationCount; + GIFBYTE PlainTextCount; + GIFBYTE HDFPalette[256][3]; + GIFBYTE HeaderDump[6]; /* GIFBYTE array to dump header contents */ + GIFBYTE LSDDump[7]; /* Logical Screen Descriptor dump */ } GIFHEAD; @@ -68,32 +75,32 @@ typedef struct _GifHeader { /* Offset Description */ ** The GIF Image Descriptor. */ typedef struct _GifImageDescriptor { - WORD ImageWidth; /* Width of the image in pixels */ - WORD ImageHeight; /* Height of the image in pixels */ - BYTE PackedField; /* Image and Color Table Data Information */ - WORD TableSize; - WORD CodeSize; /* Minimum LZW CodeSize for image data */ - BYTE HDFPalette[256][3]; - BYTE GIDDump[9]; /* GifImageDescriptor dump */ - - BYTE *Image; /* Decompressed Raster Image */ - BYTE *GIFImage; + GIFWORD ImageWidth; /* Width of the image in pixels */ + GIFWORD ImageHeight; /* Height of the image in pixels */ + GIFBYTE PackedField; /* Image and Color Table Data Information */ + GIFWORD TableSize; + GIFWORD CodeSize; /* Minimum LZW CodeSize for image data */ + GIFBYTE HDFPalette[256][3]; + GIFBYTE GIDDump[9]; /* GifImageDescriptor dump */ + + GIFBYTE *Image; /* Decompressed Raster Image */ + GIFBYTE *GIFImage; } GIFIMAGEDESC; /* ** GIF 89a Graphic Control Extension Block */ typedef struct _GifGraphicControlExtension { - BYTE GCEDump[5]; /* Graphic Control Extension Dump */ + GIFBYTE GCEDump[5]; /* Graphic Control Extension Dump */ } GIFGRAPHICCONTROL; /* ** GIF 89a Plain Text Extension Block */ typedef struct _GifPlainTextExtension { - BYTE PTEDump[15]; /* Plain Text Extension Dump */ - BYTE *PlainTextData; /* Plain Text data sub-blocks */ - WORD DataSize; + GIFBYTE PTEDump[15]; /* Plain Text Extension Dump */ + GIFBYTE *PlainTextData; /* Plain Text data sub-blocks */ + GIFWORD DataSize; } GIFPLAINTEXT; @@ -101,19 +108,19 @@ typedef struct _GifPlainTextExtension { ** GIF 89a Application Extension Block */ typedef struct _GifApplicationExtension { - BYTE AEDump[14]; /* Application Extension Dump */ - BYTE *ApplicationData; /* Application data sub-blocks */ - WORD DataSize; + GIFBYTE AEDump[14]; /* Application Extension Dump */ + GIFBYTE *ApplicationData; /* Application data sub-blocks */ + GIFWORD DataSize; } GIFAPPLICATION; /* ** GIF 89a Comment Extension Block */ typedef struct _GifCommentExtension { - BYTE CEDump[2]; /* Comment Extension Dump */ - BYTE *CommentData; /* Comment data sub-blocks */ - WORD DataSize; - BYTE Terminator; /* Block Terminator (always 0) */ + GIFBYTE CEDump[2]; /* Comment Extension Dump */ + GIFBYTE *CommentData; /* Comment data sub-blocks */ + GIFWORD DataSize; + GIFBYTE Terminator; /* Block Terminator (always 0) */ } GIFCOMMENT; /* @@ -128,12 +135,12 @@ typedef struct _GifCommentExtension { ** extension. */ typedef struct _GifToMem { - GIFHEAD *GifHeader; - GIFIMAGEDESC **GifImageDesc; - GIFGRAPHICCONTROL **GifGraphicControlExtension; - GIFPLAINTEXT **GifPlainTextExtension; - GIFAPPLICATION **GifApplicationExtension; - GIFCOMMENT **GifCommentExtension; + GIFHEAD *GifHeader; + GIFIMAGEDESC **GifImageDesc; + GIFGRAPHICCONTROL **GifGraphicControlExtension; + GIFPLAINTEXT **GifPlainTextExtension; + GIFAPPLICATION **GifApplicationExtension; + GIFCOMMENT **GifCommentExtension; } GIFTOMEM; /* @@ -141,40 +148,40 @@ typedef struct _GifToMem { */ /* GIF2MEM.C */ -int Gif2Mem(BYTE *, GIFTOMEM *); +int Gif2Mem(GIFBYTE *, GIFTOMEM *); /* GIFREAD.C */ -int ReadGifHeader(GIFHEAD *, BYTE **); -int ReadGifImageDesc(GIFIMAGEDESC *, BYTE **); -int ReadGifGraphicControl(GIFGRAPHICCONTROL *, BYTE **); -int ReadGifPlainText(GIFPLAINTEXT *, BYTE **); -int ReadGifApplication(GIFAPPLICATION *, BYTE **); -int ReadGifComment(GIFCOMMENT *, BYTE **); +int ReadGifHeader(GIFHEAD *, GIFBYTE **); +int ReadGifImageDesc(GIFIMAGEDESC *, GIFBYTE **); +int ReadGifGraphicControl(GIFGRAPHICCONTROL *, GIFBYTE **); +int ReadGifPlainText(GIFPLAINTEXT *, GIFBYTE **); +int ReadGifApplication(GIFAPPLICATION *, GIFBYTE **); +int ReadGifComment(GIFCOMMENT *, GIFBYTE **); /* HDFGIFWR.C */ -int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap, - BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, int numcols, +int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, GIFBYTE *rmap, + GIFBYTE *gmap, GIFBYTE *bmap, GIFBYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel); /* WRITEHDF.C */ -int WriteHDF(GIFTOMEM , CHAR * ); +int WriteHDF(GIFTOMEM , GIFCHAR * ); /* Function: ReadHDF ** Return: 0 on completion without error, -1 on error -** Input: CHAR *h5_file - HDF file name -** CHAR *dset_name - Name of the HDF Image dataset -** CHAR *pal_name - Name of the HDF palette -** Output: BYTE* data - the HDF Image to be converted -** BYTE palette[256][3] - the corresponding palette +** Input: GIFCHAR *h5_file - HDF file name +** GIFCHAR *dset_name - Name of the HDF Image dataset +** GIFCHAR *pal_name - Name of the HDF palette +** Output: GIFBYTE* data - the HDF Image to be converted +** GIFBYTE palette[256][3] - the corresponding palette ** hsize_t* image_size - the size of each dimension of the image */ -int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, - CHAR *h5_file, CHAR *dset_name, CHAR *pal_name); +int ReadHDF(GIFBYTE** data, GIFBYTE palette[256][3], hsize_t *image_size, + GIFCHAR *h5_file, GIFCHAR *dset_name, GIFCHAR *pal_name); -BYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *); -BYTE GetByte(BYTE *); -WORD GetWord(BYTE *); +GIFBYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *); +GIFBYTE GetByte(GIFBYTE *); +GIFWORD GetWord(GIFBYTE *); -void cleanup(BYTE*); +void cleanup(GIFBYTE*); #endif /* GIF_H_ */ diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index 2e06d34..051ff56 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/gif2hdf.c @@ -31,8 +31,8 @@ main(int argv , char *argc[]) long i, ImageCount; long filesize; - BYTE *MemGif; - BYTE *StartPos; + GIFBYTE *MemGif; + GIFBYTE *StartPos; char *GIFFileName; char *HDFFileName; @@ -81,7 +81,7 @@ main(int argv , char *argc[]) if (filesize == 0) printf("File Size Zero"); - if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) { + if (!(MemGif = StartPos = (GIFBYTE *)malloc((size_t)filesize))) { printf("Out of memory"); exit(EXIT_FAILURE); } diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 8fb575c..ae0a113 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -36,7 +36,7 @@ #include "gif.h" int -Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) +Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct) { /* * The gif structure outline for passing data to memory is given in gif.h. @@ -49,22 +49,22 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) GIFCOMMENT **gifComment; /* Comment Extension structure */ GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */ - register WORD i; /* Loop counter */ - BYTE Identifier; /* Extension block identifier holder */ - BYTE Label; /* Extension block label holder */ - BYTE ImageCount; /* Count of the number of images in the file */ - BYTE ImageArray; /* Keep the size of the array to store Images */ - BYTE CommentCount; - BYTE CommentArray; - BYTE ApplicationCount; - BYTE ApplicationArray; - BYTE PlainTextCount; - BYTE PlainTextArray; - BYTE GCEflag; - BYTE aTemp; - BYTE j; - BYTE w; /* Two more variables needed only while testing */ - BYTE *b; /* Endian Ordering */ + register GIFWORD i; /* Loop counter */ + GIFBYTE Identifier; /* Extension block identifier holder */ + GIFBYTE Label; /* Extension block label holder */ + GIFBYTE ImageCount; /* Count of the number of images in the file */ + GIFBYTE ImageArray; /* Keep the size of the array to store Images */ + GIFBYTE CommentCount; + GIFBYTE CommentArray; + GIFBYTE ApplicationCount; + GIFBYTE ApplicationArray; + GIFBYTE PlainTextCount; + GIFBYTE PlainTextArray; + GIFBYTE GCEflag; + GIFBYTE aTemp; + GIFBYTE j; + GIFBYTE w; /* Two more variables needed only while testing */ + GIFBYTE *b; /* Endian Ordering */ /* Allocate memory for the GIF structures */ /* Plug the structs into GifMemoryStruct at the end */ @@ -90,7 +90,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) /* Carry out Endian Testing and set Endian Order */ w = 0x0001; - b = (BYTE *) &w; + b = (GIFBYTE *) &w; EndianOrder = (b[0] ? 1 : 0); /* Read the GIF image file header information */ @@ -151,7 +151,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) if (ImageCount > ImageArray) { aTemp = ImageArray; - ImageArray = (BYTE)((ImageArray << 1) + 1); + ImageArray = (GIFBYTE)((ImageArray << 1) + 1); if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc, sizeof(GIFIMAGEDESC *) * ImageArray))) { printf("Out of memory!"); @@ -218,7 +218,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) PlainTextCount++; if (PlainTextCount > PlainTextArray) - PlainTextArray = (BYTE)((PlainTextArray << 1) + 1); + PlainTextArray = (GIFBYTE)((PlainTextArray << 1) + 1); if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) { printf("Out of memory!"); @@ -240,7 +240,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) CommentCount++; if (CommentCount > CommentArray) - CommentArray = (BYTE)((CommentArray << 1) + 1); + CommentArray = (GIFBYTE)((CommentArray << 1) + 1); if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) { printf("Out of memory!"); @@ -267,7 +267,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) if (ImageCount > ImageArray) { aTemp = ImageArray; - ImageArray = (BYTE)((ImageArray << 1) + 1); + ImageArray = (GIFBYTE)((ImageArray << 1) + 1); if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) { printf("Out of memory!"); @@ -306,7 +306,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) ApplicationCount++; if (ApplicationCount > ApplicationArray) - ApplicationArray = (BYTE)((ApplicationArray << 1) + 1); + ApplicationArray = (GIFBYTE)((ApplicationArray << 1) + 1); if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) { printf("Out of memory!"); diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index 948e112..79671aa 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -17,33 +17,33 @@ int EndianOrder; -static BYTE *ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize); +static GIFBYTE *ReadDataSubBlocks(GIFBYTE **MemGif2, GIFWORD *DSize); -WORD -GetWord(BYTE *MemGif) +GIFWORD +GetWord(GIFBYTE *MemGif) { - WORD w; + GIFWORD w; if (EndianOrder == 1) { /* LittleEndian */ - w = (WORD) (*MemGif++ & 0xFF); - w |= (WORD) ((*MemGif++ & 0xFF) << 0x08); + w = (GIFWORD) (*MemGif++ & 0xFF); + w |= (GIFWORD) ((*MemGif++ & 0xFF) << 0x08); } else { - w = (WORD) (*MemGif++ & 0xFF); - w = ((WORD) (*MemGif++ & 0xFF)) | (w << 0x08); + w = (GIFWORD) (*MemGif++ & 0xFF); + w = ((GIFWORD) (*MemGif++ & 0xFF)) | (w << 0x08); } return w; } -BYTE -GetByte(BYTE *MemGif) +GIFBYTE +GetByte(GIFBYTE *MemGif) { return *MemGif; } /* - * Read a GIF image BYTE Header. + * Read a GIF image GIFBYTE Header. * * This function reads the Header, Logical Screen Descriptor, and * Global Color Table (if any) from a GIF image file. The information @@ -54,10 +54,10 @@ GetByte(BYTE *MemGif) */ int ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ - BYTE **MemGif2) /* GIF image file input FILE stream */ + GIFBYTE **MemGif2) /* GIF image file input FILE stream */ { - WORD i; /* Loop counter */ - WORD tableSize; /* Number of entires in the Global Color Table */ + GIFWORD i; /* Loop counter */ + GIFWORD tableSize; /* Number of entires in the Global Color Table */ GifHead->TableSize = 0; for (i = 0 ; i < 6 ; i++) { @@ -78,7 +78,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ /* Check if a Global Color Table is present */ if (GifHead->PackedField & 0x80) { /* Read number of color table entries */ - tableSize = (WORD) (1L << ((GifHead->PackedField & 0x07) + 1)); + tableSize = (GIFWORD) (1L << ((GifHead->PackedField & 0x07) + 1)); GifHead->TableSize = tableSize; /* Read the Global Color Table */ @@ -122,13 +122,13 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ int ReadGifImageDesc( GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ + GIFBYTE **MemGif2 /* GIF image file input FILE stream */ ) { - WORD i; /* Loop counter */ - WORD tableSize; /* Number of entries in the Local Color Table */ - /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */ - BYTE *TempPtr; + GIFWORD i; /* Loop counter */ + GIFWORD tableSize; /* Number of entries in the Local Color Table */ + /* GIFBYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */ + GIFBYTE *TempPtr; int ch , ch1; GifImageDesc->TableSize = 0; @@ -145,20 +145,20 @@ ReadGifImageDesc( if (EndianOrder == 1) /* LittleEndian */ { - GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF); - GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08); + GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF); + GifImageDesc->ImageWidth |= (GIFWORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08); - GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF); - GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08); + GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF); + GifImageDesc->ImageHeight |= (GIFWORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08); } else { - GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF); - GifImageDesc->ImageWidth = ((WORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); + GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF); + GifImageDesc->ImageWidth = ((GIFWORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); - GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF); - GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); + GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF); + GifImageDesc->ImageHeight = ((GIFWORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); } @@ -171,7 +171,7 @@ ReadGifImageDesc( if (GifImageDesc->PackedField & 0x80) { /* Read number of color table entries */ - tableSize = (WORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1)); + tableSize = (GIFWORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1)); GifImageDesc->TableSize = tableSize; /* Read the Local Color Table */ for (i = 0; i < tableSize; i++) @@ -185,10 +185,10 @@ ReadGifImageDesc( /* ** Get LZW minimum Code Size */ - GifImageDesc->CodeSize = (WORD)*(*MemGif2)++; + GifImageDesc->CodeSize = (GIFWORD)*(*MemGif2)++; /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/ - if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) { + if (!(GifImageDesc->GIFImage = (GIFBYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) { printf("Out of memory"); exit(EXIT_FAILURE); } @@ -219,7 +219,7 @@ ReadGifImageDesc( int ReadGifGraphicControl( GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ + GIFBYTE **MemGif2 /* GIF image file input FILE stream */ ) { int i; @@ -244,7 +244,7 @@ ReadGifGraphicControl( int ReadGifPlainText( GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ + GIFBYTE **MemGif2 /* GIF image file input FILE stream */ ) { int i; @@ -283,7 +283,7 @@ ReadGifPlainText( int ReadGifApplication( GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ + GIFBYTE **MemGif2 /* GIF image file input FILE stream */ ) { int i; @@ -321,7 +321,7 @@ ReadGifApplication( int ReadGifComment( GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ + GIFBYTE **MemGif2 /* GIF image file input FILE stream */ ) { @@ -345,14 +345,14 @@ ReadGifComment( ** Returns: A NULL pointer if a memory allocation error occured, ** otherwise a valid pointer if no error occured. */ -static BYTE * -ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream */ - WORD *DSize) +static GIFBYTE * +ReadDataSubBlocks(GIFBYTE **MemGif2, /* GIF image file input FILE stream */ + GIFWORD *DSize) { - BYTE *ptr1; /* Pointer used to "walk the heap" */ - BYTE *ptr2; /* Pointer used to mark the top of the heap */ - BYTE dataSize; /* Size of the current data sub-block being read */ - WORD bufSize; /* Total size of the Plain Text data buffer */ + GIFBYTE *ptr1; /* Pointer used to "walk the heap" */ + GIFBYTE *ptr2; /* Pointer used to mark the top of the heap */ + GIFBYTE dataSize; /* Size of the current data sub-block being read */ + GIFWORD bufSize; /* Total size of the Plain Text data buffer */ int tempcount = 0; bufSize = 0; /* The output buffer is empty */ @@ -360,9 +360,9 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */ /* Allocate initial data buffer */ - if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) { + if (!(ptr1 = ptr2 = (GIFBYTE *) malloc((size_t)dataSize + 1))) { printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed"); - return((BYTE *) NULL); + return((GIFBYTE *) NULL); } for (;;) { @@ -381,8 +381,8 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream break; /* Block Terminator encountered */ /* Increase the buffer size to accomodate the next sub-block */ - if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1))) - return((BYTE *) NULL); + if (!(ptr1 = ptr2 = (GIFBYTE *) realloc(ptr2, bufSize + dataSize + 1))) + return((GIFBYTE *) NULL); ptr1 += bufSize; /* Move pointer to the end of the data */ diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index ae63e92..e32facb 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -45,20 +45,20 @@ usage(void) FILE *fpGif = NULL; int main(int argc , char **argv) { - BYTE *Image; + GIFBYTE *Image; void *edata; H5E_auto2_t func; /* compression structs */ - CHAR *HDFName = NULL; - CHAR *GIFName = NULL; + GIFCHAR *HDFName = NULL; + GIFCHAR *GIFName = NULL; - BYTE* b; + GIFBYTE* b; - BYTE GlobalPalette[256][3]; - BYTE Red[256]; - BYTE Green[256]; - BYTE Blue[256]; + GIFBYTE GlobalPalette[256][3]; + GIFBYTE Red[256]; + GIFBYTE Green[256]; + GIFBYTE Blue[256]; int RWidth, RHeight; int ColorMapSize, InitCodeSize, Background, BitsPerPixel; @@ -66,7 +66,7 @@ int main(int argc , char **argv) int i; int numcols = 0; - BYTE pc2nc[256] , r1[256] , g1[256] , b1[256]; + GIFBYTE pc2nc[256] , r1[256] , g1[256] , b1[256]; int arg_index = 2; int bool_is_image = 0; /* 0 = false , 1 = true */ @@ -110,7 +110,7 @@ int main(int argc , char **argv) { /* allocate space to store the image name */ size_t len = strlen(argv[arg_index]); - image_name = (CHAR*) malloc( len + 1); + image_name = (GIFCHAR*) malloc( len + 1); strcpy(image_name , argv[arg_index]); bool_is_image = 0; @@ -125,7 +125,7 @@ int main(int argc , char **argv) /* Do Endian Order testing and set Endian Order */ idx = 0x0001; - b = (BYTE *) &idx; + b = (GIFBYTE *) &idx; EndianOrder = (b[0] ? 1:0); if (!(fpGif = fopen(GIFName , "wb"))) @@ -164,7 +164,7 @@ int main(int argc , char **argv) goto out; } - Image = (BYTE*) malloc( (size_t) width * (size_t) height ); + Image = (GIFBYTE*) malloc( (size_t) width * (size_t) height ); if ( H5IMread_image( fid, image_name, Image ) < 0 ) goto out; @@ -174,7 +174,7 @@ int main(int argc , char **argv) if ( H5IMget_palette_info( fid, image_name, 0, pal_dims ) < 0 ) goto out; - pal = (BYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] ); + pal = (GIFBYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] ); if ( H5IMget_palette( fid, image_name, 0, pal ) < 0 ) goto out; @@ -211,9 +211,9 @@ int main(int argc , char **argv) numcols = 256; for (i = 0 ; i < numcols ; i++) { - Red[i] = (BYTE)(255 - i); - Green[i] = (BYTE)(255 - i); - Blue[i] = (BYTE)(255 - i); + Red[i] = (GIFBYTE)(255 - i); + Green[i] = (GIFBYTE)(255 - i); + Blue[i] = (GIFBYTE)(255 - i); } } else @@ -246,7 +246,7 @@ int main(int argc , char **argv) if (j==i) { /* wasn't found */ - pc2nc[i] = (BYTE)nc; + pc2nc[i] = (GIFBYTE)nc; r1[nc] = Red[i]; g1[nc] = Green[i]; b1[nc] = Blue[i]; diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index 6f5ab58..d44ff7a 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/hdfgifwr.c @@ -51,7 +51,7 @@ #include "gif.h" -typedef BYTE byte; +typedef GIFBYTE byte; typedef long int count_int; #ifdef __STDC__ @@ -69,45 +69,6 @@ static void char_init(), char_out(), flush_char(); static byte pc2nc[256]; -/*************************************************************/ -int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, - byte *gmap, byte *bmap, byte *pc2ncmap, int numcols, - int colorstyle, int BitsPerPixel) -{ - int InitCodeSize; - int i; - byte *pic8 = pic; - - /* Shut compiler up... */ - ptype=ptype; - rmap=rmap; - gmap=gmap; - bmap=bmap; - numcols=numcols; - colorstyle=colorstyle; - - for (i = 0; i < 256; i++) { - pc2nc[i] = pc2ncmap[i]; - } - - if (BitsPerPixel <= 1) - InitCodeSize = 2; - else - InitCodeSize = BitsPerPixel; - - if (!fp) { - fprintf(stderr, "WriteGIF: file not open for writing\n" ); - return (1); - } - - compress(InitCodeSize+1, fp, pic8, w*h); - - if (ferror(fp)) - return -1; - - return 0 ; -} - /***********************************************************************/ static unsigned long cur_accum = 0; static int cur_bits = 0; @@ -123,8 +84,8 @@ static int maxbits = XV_BITS; /* user settable max # bits/code */ static int maxcode; /* maximum code, given n_bits */ static int maxmaxcode = 1 << XV_BITS; /* NEVER generate this */ -static count_int htab [HSIZE]; -static unsigned short codetab [HSIZE]; +static count_int *htab; +static unsigned short *codetab; #define HashTabOf(i) htab[i] #define CodeTabOf(i) codetab[i] @@ -173,6 +134,57 @@ static FILE *g_outfile; static int ClearCode; static int EOFCode; +/*************************************************************/ +int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, + byte *gmap, byte *bmap, byte *pc2ncmap, int numcols, + int colorstyle, int BitsPerPixel) +{ + int InitCodeSize; + int i; + byte *pic8 = pic; + + if (!(htab = calloc(HSIZE, sizeof(count_int)))) { + fprintf(stderr, "Out of memory"); + return 1; + } + if (!(codetab = calloc(HSIZE, sizeof(unsigned short)))) { + fprintf(stderr, "Out of memory"); + return 1; + } + + /* Shut compiler up... */ + ptype=ptype; + rmap=rmap; + gmap=gmap; + bmap=bmap; + numcols=numcols; + colorstyle=colorstyle; + + for (i = 0; i < 256; i++) { + pc2nc[i] = pc2ncmap[i]; + } + + if (BitsPerPixel <= 1) + InitCodeSize = 2; + else + InitCodeSize = BitsPerPixel; + + if (!fp) { + fprintf(stderr, "WriteGIF: file not open for writing\n"); + return 1; + } + + compress(InitCodeSize+1, fp, pic8, w*h); + + free(htab); + free(codetab); + + if (ferror(fp)) + return -1; + + return 0 ; +} + /********************************************************/ static void compress(int init_bits, FILE *outfile, byte *data, int len) { @@ -194,8 +206,6 @@ static void compress(int init_bits, FILE *outfile, byte *data, int len) /* initialize 'compress' globals */ maxbits = XV_BITS; maxmaxcode = 1<<XV_BITS; - memset(htab, 0, sizeof(htab)); - memset(codetab, 0, sizeof(codetab)); hsize = HSIZE; free_ent = 0; clear_flg = 0; diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index b656c36..c2933c5 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/writehdf.c @@ -62,9 +62,9 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName) /* get some data from gifHead */ ImageCount = gifHead.ImageCount; #ifdef UNUSED - CommentCount = (WORD)gifHead.CommentCount; - ApplicationCount = (WORD)gifHead.ApplicationCount; - PlainTextCount = (WORD)gifHead.PlainTextCount; + CommentCount = (GIFWORD)gifHead.CommentCount; + ApplicationCount = (GIFWORD)gifHead.ApplicationCount; + PlainTextCount = (GIFWORD)gifHead.PlainTextCount; #endif /* UNUSED */ if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) { diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index b3d65f7..edb78c0 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -26,7 +26,7 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared) endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) #-- Add swmr_check_compat_vfd program set (hl_swmr_check_compat_vfd_SOURCES ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c @@ -68,7 +68,9 @@ if (BUILD_TESTING) endif () set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) - include (CMakeTests.cmake) + if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) + endif () endif () #----------------------------------------------------------------------------- diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 0424140..19d47cb 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -68,19 +68,13 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes ############################################################################## ############################################################################## - if (NOT BUILD_SHARED_LIBS) - set (tgt_ext "") - else () - set (tgt_ext "-shared") - endif () - macro (ADD_H5_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_file_ext}>" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -102,7 +96,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_file_ext}>" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -131,7 +125,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_file_ext}>" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index d1f4e32..b7f583c 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -20,13 +20,13 @@ */ #define PROGRAMNAME "h5watch" /* Name of tool */ #define FIELD_SEP "," /* nested field separator */ -#define DEFAULT_RETRY 50 /* number of times to try opening the file */ +#define DEFAULT_RETRY 50 /* number of times to try opening the file */ /* * Note:(see comments in hl/src/H5LDprivate.h) * This tool uses private routines H5LD_construct_vector()and H5LD_clean_vector() - * This tool uses H5LD_memb_t data structure declared in H5LDprivate.h + * This tool uses H5LD_memb_t data structure declared in H5LDprivate.h */ const char *progname = "h5watch"; /* tool name */ @@ -35,7 +35,7 @@ static char *g_dup_fields = NULL; /* copy of "list_of_fields" */ static H5LD_memb_t **g_listv = NULL; /* vector info for "list_of_fields" */ static hbool_t g_monitor_size_only = FALSE; /* monitor changes in dataset dimension sizes */ -static unsigned g_polling_interval = 1; /* polling interval to check appended data */ +static unsigned g_polling_interval = 1; /* polling interval to check appended data */ static hbool_t g_label = FALSE; /* label compound values */ static int g_display_width = 80; /* output width in characters */ @@ -109,7 +109,7 @@ static struct long_options l_opts[] = { * * Purpose: Prepare to print the dataset's appended data. * Call the tools library routine h5tools_dump_dset() to do the printing. - * (This routine is mostly copied from dump_dataset_values() in tools/h5ls/h5ls.c + * (This routine is mostly copied from dump_dataset_values() in tools/h5ls/h5ls.c * and modified accordingly). * * Return: 0 on success; negative on failure @@ -121,15 +121,15 @@ static struct long_options l_opts[] = { static herr_t doprint(hid_t did, hsize_t *start, hsize_t *block, int rank) { - h5tools_context_t ctx; /* print context */ - h5tool_format_t info; /* Format info for the tools library */ - static char fmt_double[16], fmt_float[16]; /* Format info */ - struct subset_t subset; /* Subsetting info */ - hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */ - hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */ - hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */ - hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */ - int i; /* Local index variable */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t info; /* Format info for the tools library */ + static char fmt_double[16], fmt_float[16]; /* Format info */ + struct subset_t subset; /* Subsetting info */ + hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */ + hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */ + hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */ + hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */ + int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ /* Subsetting information for the tools library printing routines */ @@ -147,6 +147,7 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank) } /* end for */ HDmemset(&ctx, 0, sizeof(ctx)); + ctx.sset = ⊂ /* Set to all default values and then override */ HDmemset(&info, 0, sizeof info); @@ -220,7 +221,7 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank) } /* end if */ /* Print the values. */ - if((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did, &subset)) < 0) + if((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did)) < 0) error_msg("unable to print data\n"); HDfprintf(stdout, "\n"); @@ -255,7 +256,7 @@ slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsi int i; /* Local index variable */ int ind; /* Index for the current rank */ herr_t ret_value = SUCCEED; /* Return value */ - + ind = rank - subrank; if((subrank - 1) > 0) { @@ -288,7 +289,7 @@ done: return ret_value; } /* end slicendump() */ - + /*------------------------------------------------------------------------- * Function: monitor_dataset * @@ -305,16 +306,16 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t monitor_dataset(hid_t fid, char *dsetname) { - hid_t did; /* dataset id */ - hid_t sid; /* dataspace id */ - int ndims; /* # of dimensions in the dataspace */ - int i, u; /* local index variable */ - hsize_t prev_dims[H5S_MAX_RANK]; /* current dataspace dimensions */ - hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */ - herr_t ret_value = SUCCEED; /* return value */ + hid_t did; /* dataset id */ + hid_t sid; /* dataspace id */ + int ndims; /* # of dimensions in the dataspace */ + int i, u; /* local index variable */ + hsize_t prev_dims[H5S_MAX_RANK]; /* current dataspace dimensions */ + hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */ + herr_t ret_value = SUCCEED; /* return value */ HDfprintf(stdout, "Monitoring dataset %s...\n", dsetname); @@ -323,7 +324,7 @@ monitor_dataset(hid_t fid, char *dsetname) error_msg("error in opening dataset \"%s\"\n", dsetname); ret_value = FAIL; goto done; - } + } if((sid = H5Dget_space(did)) < 0) { error_msg("error in getting dataspace id for dataset \"%s\"\n", dsetname); ret_value = FAIL; @@ -398,7 +399,7 @@ monitor_dataset(hid_t fid, char *dsetname) } HDfflush(stdout); } - + /* Save the current dimension sizes */ HDmemcpy(prev_dims, cur_dims, (size_t)ndims * sizeof(hsize_t)); @@ -438,7 +439,7 @@ process_cmpd_fields(hid_t fid, char *dsetname) herr_t ret_value = SUCCEED; /* Return value */ HDassert(g_list_of_fields && *g_list_of_fields); - + /* Open the dataset */ if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) { error_msg("error in opening dataset \"%s\"\n", dsetname); @@ -457,14 +458,14 @@ process_cmpd_fields(hid_t fid, char *dsetname) if(H5Tget_class(dtid) != H5T_COMPOUND) { error_msg("dataset should be compound type for <list_of_fields>\n"); ret_value = FAIL; - goto done; + goto done; } /* Make a copy of "g_list_of_fields" */ if((g_dup_fields = HDstrdup(g_list_of_fields)) == NULL) { error_msg("error in duplicating g_list_of_fields\n"); ret_value = FAIL; - goto done; + goto done; } /* Estimate the number of comma-separated fields in "g_list of_fields" */ @@ -474,7 +475,7 @@ process_cmpd_fields(hid_t fid, char *dsetname) if((g_listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))) == NULL) { error_msg("error in allocating memory for H5LD_memb_t\n"); ret_value = FAIL; - goto done; + goto done; } /* Process and store info for "g_listv" */ @@ -495,7 +496,7 @@ done: return(ret_value); } /* process_cmpd_fields() */ - + /*------------------------------------------------------------------------- * Function: check_dataset * @@ -512,18 +513,18 @@ done: static herr_t check_dataset(hid_t fid, char *dsetname) { - hid_t did=-1; /* Dataset id */ - hid_t dcp=-1; /* Dataset creation property */ - hid_t sid=-1; /* Dataset's dataspace id */ - int ndims; /* # of dimensions in the dataspace */ - unsigned u; /* Local index variable */ - hsize_t cur_dims[H5S_MAX_RANK]; /* size of dataspace dimensions */ - hsize_t max_dims[H5S_MAX_RANK]; /* maximum size of dataspace dimensions */ - hbool_t unlim_max_dims = FALSE; /* whether dataset has unlimited or max. dimension setting */ + hid_t did=-1; /* Dataset id */ + hid_t dcp=-1; /* Dataset creation property */ + hid_t sid=-1; /* Dataset's dataspace id */ + int ndims; /* # of dimensions in the dataspace */ + unsigned u; /* Local index variable */ + hsize_t cur_dims[H5S_MAX_RANK]; /* size of dataspace dimensions */ + hsize_t max_dims[H5S_MAX_RANK]; /* maximum size of dataspace dimensions */ + hbool_t unlim_max_dims = FALSE; /* whether dataset has unlimited or max. dimension setting */ void *edata; H5E_auto2_t func; H5D_layout_t layout; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ /* Disable error reporting */ H5Eget_auto2(H5E_DEFAULT, &func, &edata); @@ -574,17 +575,17 @@ check_dataset(hid_t fid, char *dsetname) /* Check whether dataset has unlimited dimension or max. dimension setting */ for(u = 0; u < (unsigned)ndims; u++) - if(max_dims[u] == H5S_UNLIMITED || cur_dims[u] != max_dims[u]) { + if(max_dims[u] == H5S_UNLIMITED || cur_dims[u] != max_dims[u]) { unlim_max_dims = TRUE; - break; - } + break; + } if(!unlim_max_dims) { error_msg("\"%s\" should have unlimited or max. dimension setting\n", dsetname); ret_value = FAIL; } -done: +done: H5Eset_auto2(H5E_DEFAULT, func, edata); /* Closing */ @@ -597,7 +598,7 @@ done: return(ret_value); } /* check_dataset() */ - + /*------------------------------------------------------------------------- * Function: leave * @@ -618,7 +619,7 @@ leave(int ret) exit(ret); } - + /*------------------------------------------------------------------------- * Function: usage * @@ -630,7 +631,7 @@ leave(int ret) * *------------------------------------------------------------------------- */ -static void +static void usage(const char *prog) { HDfflush(stdout); @@ -653,7 +654,7 @@ usage(const char *prog) HDfprintf(stdout, " for a compound data type. <list_of_fields> can be\n"); HDfprintf(stdout, " specified as follows:\n"); HDfprintf(stdout, " 1) A comma-separated list of field names in a\n"); - HDfprintf(stdout, " compound data type. \",\" is the separator\n"); + HDfprintf(stdout, " compound data type. \",\" is the separator\n"); HDfprintf(stdout, " for field names while \".\" is the separator\n"); HDfprintf(stdout, " for a nested field.\n"); HDfprintf(stdout, " 2) A single field name in a compound data type.\n"); @@ -672,7 +673,7 @@ usage(const char *prog) } /* usage() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -688,7 +689,7 @@ usage(const char *prog) static void parse_command_line(int argc, const char *argv[]) { - int opt; /* Command line option */ + int opt; /* Command line option */ int tmp; /* no arguments */ @@ -726,7 +727,7 @@ parse_command_line(int argc, const char *argv[]) case 'S': /* --simple */ g_simple_output = TRUE; break; - + case 'l': /* --label */ g_label = TRUE; break; @@ -772,7 +773,7 @@ parse_command_line(int argc, const char *argv[]) leave(EXIT_FAILURE); } } - + /* check for object to be processed */ if (argc <= opt_ind) { @@ -782,7 +783,7 @@ parse_command_line(int argc, const char *argv[]) } } /* parse_command_line() */ - + /*------------------------------------------------------------------------- * Function: catch_signal * @@ -859,9 +860,9 @@ main(int argc, const char *argv[]) } /* Mostly copied from tools/h5ls coding & modified accordingly */ - /* - * [OBJECT] is specified as - * [<filename>/<path_to_dataset>/<dsetname>] + /* + * [OBJECT] is specified as + * [<filename>/<path_to_dataset>/<dsetname>] * * Example: ../dir1/foo/bar/dset * \_________/\______/ @@ -871,7 +872,7 @@ main(int argc, const char *argv[]) * succeeds. The first call uses the entire name and each subsequent call * chops off the last component. If we reach the beginning of the name * then there must have been something wrong with the file (perhaps it - * doesn't exist). + * doesn't exist). */ if((fname = HDstrdup(argv[opt_ind])) == NULL) { error_msg("memory allocation failed (file %s:line %d)\n", @@ -913,7 +914,7 @@ main(int argc, const char *argv[]) if(fname) HDfree(fname); if(fapl >= 0) H5Pclose(fapl); leave(EXIT_FAILURE); - } + } if(!dname) { error_msg("no dataset specified\n"); @@ -935,13 +936,13 @@ main(int argc, const char *argv[]) if(process_cmpd_fields(fid, dname) < 0) h5tools_setstatus(EXIT_FAILURE); } - } + } /* If everything is fine, start monitoring the datset */ if(h5tools_getstatus() != EXIT_FAILURE) if(monitor_dataset(fid, dname) < 0) h5tools_setstatus(EXIT_FAILURE); - + /* Free spaces */ if(fname) HDfree(fname); if(dname) HDfree(dname); diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index d31bcc3..24ff6aa 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -18,7 +18,7 @@ # supports SWMR. ./swmr_check_compat_vfd rc=$? -if [[ $rc != 0 ]] ; then +if [ $rc != 0 ] ; then echo echo "The VFD specified by the HDF5_DRIVER environment variable" echo "does not support SWMR." |