From ccf09fae583d23c4bf92d5e2d459ed643e174821 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Fri, 6 Nov 1998 13:00:22 -0500 Subject: [svn-r879] Changes since 19981105 ---------------------- ./configure.in ./acconfig.h ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Added checks for functions, structs, constants, and header files used in h5ls.c to determine the output width with various Windows compilers and Unix variants. Added check for and defined HAVE_SYS_STAT_H. Included in H5private.h outside the Posix.1 #include's section. ./src/H5RA.c Less aggressive about failing -- rather returns false, which allows type detection to continue. ./src/h5ls.c Data types are displayed for datasets and named data types when `-v' or `--verbose' is specified on the command-line. The algorithm is a little different than the dumper because we're trying to be human-friendly, not necessarily machine-friendly. * Any data type which matches a native C type gets printed something like `native double'. * A floating point type that matches one of the IEEE standard types but not one of the native types gets printed like `IEEE 64-bit big-endian float'. * Other floating point values have information about sign bit location; exponent size, location, and bias; and significand size, location, and normalization. * Padding and offsets are displayed for types that have padding (precision != size), including internal padding for some floating point data types. * Non-native integer types are displayed like `32-bit little-endian unsigned integer'. * Compound data types have each member displayed including the member name, byte offset within the struct, dimensions, index permutation, and data type. * String types are displayed like `256-byte null-terminated ASCII string'. * References are displayed like `8-byte unknown reference' until the reference interface stabilizes a little. * All other types including types not yet defined will be printed like `4-byte class-9 unknown'. The dimensionality of scalar datasets is printed like `{SCALAR}' instead of just `{}'. If external raw files are used to store a dataset then the offsets, sizes, and file names of each are printed if `-v' or `--verbose' was given on the command-line. If an object is found and h5ls can't determine the object type then it still tries to print the number of hard links, the OID, and any comment that might be present if `-v' or `--verbose' was specified. If the `-d' or `--dump' switch is turned on then ragged arrays will report that the data can only be dumped by dumping the component datasets explicitly. I'm not planning to implement this since we're going to eventually change the whole way ragged arrays are stored. Compound data values do not have the component names displayed by default when `-v' or `--verbose' is turned on. Instead, the names can be displayed with `-l' or `--label'. The output width is determined by the first rule that applies: * If the `-wN', `-w N' or `--width=N' switch appeared on the command line then use N for the output width. * Query the OS for the tty width in a highly unportable way borrowed from GNU `less' depending on what functions and data structures were found during configuration (if any): _getvideoconfig(), gettextinfo(), _srcsize(), ioctl(), GetConsoleScreenBufferInfo(), struct videoconfig, struct text_info, the TIOCGWINSZ ioctl, the TIOCGETD ioctl. * If the `COLUMNS' environment variable is set then use its value. * Use the value 80. Just for kicks, run Mark and Jim's test_vbt and then say `h5ls -dlsv test.vbt'. You can also try it on the various *.h5 files in the test/example directories. ./config/linux Removed turning on parallel by default on Robb's macine. --- README | 2 +- acconfig.h | 12 + config/linux | 7 - configure | 447 ++++++++++++++++++++++------ configure.in | 35 ++- src/H5RA.c | 4 +- src/H5config.h.in | 33 +++ src/H5private.h | 18 +- tools/h5ls.c | 871 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 9 files changed, 1298 insertions(+), 131 deletions(-) diff --git a/README b/README index 529c7aa..6325fa0 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is hdf5-1.1.22 released on Thu Nov 5 04:19:57 CST 1998 +This is hdf5-1.1.23 released on Fri Nov 6 10:29:37 CST 1998 Please refer to the INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/acconfig.h b/acconfig.h index 35cbfac..13e8eb3 100644 --- a/acconfig.h +++ b/acconfig.h @@ -24,3 +24,15 @@ /* Define if `struct stat' has the `st_blocks' field */ #undef HAVE_STAT_ST_BLOCKS + +/* Define if `struct text_info' is defined */ +#undef HAVE_STRUCT_TEXT_INFO + +/* Define if `struct videoconfig' is defined */ +#undef HAVE_STRUCT_VIDEOCONFIG + +/* Define if the ioctl TIOCGETD is defined */ +#undef HAVE_TIOCGETD + +/* Define if the ioctl TIOCGWINSZ is defined */ +#undef HAVE_TIOCGWINSZ diff --git a/config/linux b/config/linux index 3766079..9e3bc5c 100644 --- a/config/linux +++ b/config/linux @@ -62,13 +62,6 @@ PROFILE_CFLAGS=-pg PROFILE_CPPFLAGS= #---------------------------------------------------------------------------- -# Enable parallel support by default for Robb's development system. -# -if [ 'robb@arborea' = `whoami`@`hostname` ]; then - enable_parallel=${enable_parallel:-yes} -fi - -#---------------------------------------------------------------------------- # Values for overriding configuration tests when cross compiling. # This includes compiling on some machines where the serial front end # compiles for a parallel back end. diff --git a/configure b/configure index fcab0d4..25b03c0 100755 --- a/configure +++ b/configure @@ -1373,15 +1373,54 @@ else fi done +for ac_hdr in sys/ioctl.h sys/stat.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1381: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1380: checking for off_t" >&5 +echo "configure:1419: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1409,12 +1448,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1413: checking for size_t" >&5 +echo "configure:1452: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1442,14 +1481,14 @@ EOF fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1446: checking whether byte ordering is bigendian" >&5 +echo "configure:1485: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1460,11 +1499,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1475,7 +1514,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1479: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1495,7 +1534,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1532,7 +1571,7 @@ EOF fi echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1536: checking size of short" >&5 +echo "configure:1575: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1540,7 +1579,7 @@ else ac_cv_sizeof_short=2 else cat > conftest.$ac_ext < main() @@ -1551,7 +1590,7 @@ main() exit(0); } EOF -if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -1571,7 +1610,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1575: checking size of int" >&5 +echo "configure:1614: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1579,7 +1618,7 @@ else ac_cv_sizeof_int=4 else cat > conftest.$ac_ext < main() @@ -1590,7 +1629,7 @@ main() exit(0); } EOF -if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1610,7 +1649,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1614: checking size of long" >&5 +echo "configure:1653: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1618,7 +1657,7 @@ else ac_cv_sizeof_long=4 else cat > conftest.$ac_ext < main() @@ -1629,7 +1668,7 @@ main() exit(0); } EOF -if { (eval echo configure:1633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1649,7 +1688,7 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:1653: checking size of long long" >&5 +echo "configure:1692: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1657,7 +1696,7 @@ else ac_cv_sizeof_long_long=8 else cat > conftest.$ac_ext < main() @@ -1668,7 +1707,7 @@ main() exit(0); } EOF -if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -1688,7 +1727,7 @@ EOF echo $ac_n "checking size of __int64""... $ac_c" 1>&6 -echo "configure:1692: checking size of __int64" >&5 +echo "configure:1731: checking size of __int64" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof___int64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1696,7 +1735,7 @@ else ac_cv_sizeof___int64=8 else cat > conftest.$ac_ext < main() @@ -1707,7 +1746,7 @@ main() exit(0); } EOF -if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof___int64=`cat conftestval` else @@ -1727,7 +1766,7 @@ EOF echo $ac_n "checking size of float""... $ac_c" 1>&6 -echo "configure:1731: checking size of float" >&5 +echo "configure:1770: checking size of float" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1735,7 +1774,7 @@ else ac_cv_sizeof_float=4 else cat > conftest.$ac_ext < main() @@ -1746,7 +1785,7 @@ main() exit(0); } EOF -if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_float=`cat conftestval` else @@ -1766,7 +1805,7 @@ EOF echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:1770: checking size of double" >&5 +echo "configure:1809: checking size of double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1774,7 +1813,7 @@ else ac_cv_sizeof_double=8 else cat > conftest.$ac_ext < main() @@ -1785,7 +1824,7 @@ main() exit(0); } EOF -if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_double=`cat conftestval` else @@ -1805,7 +1844,7 @@ EOF echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:1809: checking size of long double" >&5 +echo "configure:1848: checking size of long double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1813,7 +1852,7 @@ else ac_cv_sizeof_long_double=8 else cat > conftest.$ac_ext < main() @@ -1824,7 +1863,7 @@ main() exit(0); } EOF -if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_double=`cat conftestval` else @@ -1844,7 +1883,7 @@ EOF echo $ac_n "checking size of size_t""... $ac_c" 1>&6 -echo "configure:1848: checking size of size_t" >&5 +echo "configure:1887: checking size of size_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1852,7 +1891,7 @@ else ac_cv_sizeof_size_t=4 else cat > conftest.$ac_ext < main() @@ -1863,7 +1902,7 @@ main() exit(0); } EOF -if { (eval echo configure:1867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_size_t=`cat conftestval` else @@ -1886,7 +1925,7 @@ cat >>confdefs.h <<\EOF #include /*for off_t definition*/ EOF echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:1890: checking size of off_t" >&5 +echo "configure:1929: checking size of off_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1894,7 +1933,7 @@ else ac_cv_sizeof_off_t=4 else cat > conftest.$ac_ext < main() @@ -1905,7 +1944,7 @@ main() exit(0); } EOF -if { (eval echo configure:1909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_off_t=`cat conftestval` else @@ -1932,7 +1971,7 @@ if test "${enable_hsizet+set}" = set; then fi echo $ac_n "checking for sizeof hsize_t and hssize_t""... $ac_c" 1>&6 -echo "configure:1936: checking for sizeof hsize_t and hssize_t" >&5 +echo "configure:1975: checking for sizeof hsize_t and hssize_t" >&5 case $HSIZET in no|small) echo "$ac_t""small" 1>&6 @@ -1948,9 +1987,9 @@ esac echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:1952: checking for tm_gmtoff in struct tm" >&5 +echo "configure:1991: checking for tm_gmtoff in struct tm" >&5 cat > conftest.$ac_ext < @@ -1959,7 +1998,7 @@ int main() { struct tm tm; tm.tm_gmtoff=0; ; return 0; } EOF -if { (eval echo configure:1963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TM_GMTOFF 1 @@ -1975,9 +2014,9 @@ fi rm -f conftest* echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6 -echo "configure:1979: checking for global timezone variable" >&5 +echo "configure:2018: checking for global timezone variable" >&5 cat > conftest.$ac_ext < @@ -1986,7 +2025,7 @@ int main() { timezone=0; ; return 0; } EOF -if { (eval echo configure:1990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TIMEZONE 1 @@ -2002,12 +2041,12 @@ fi rm -f conftest* echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2006: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2045: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2015,7 +2054,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2036,12 +2075,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2040: checking for tm_zone in struct tm" >&5 +echo "configure:2079: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -2049,7 +2088,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2069,12 +2108,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2073: checking for tzname" >&5 +echo "configure:2112: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -2084,7 +2123,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2106,9 +2145,9 @@ EOF fi echo $ac_n "checking for struct timezone""... $ac_c" 1>&6 -echo "configure:2110: checking for struct timezone" >&5 +echo "configure:2149: checking for struct timezone" >&5 cat > conftest.$ac_ext < @@ -2118,7 +2157,7 @@ int main() { struct timezone tz; tz.tz_minuteswest=0; ; return 0; } EOF -if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_TIMEZONE 1 @@ -2134,9 +2173,9 @@ fi rm -f conftest* echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:2138: checking for st_blocks in struct stat" >&5 +echo "configure:2177: checking for st_blocks in struct stat" >&5 cat > conftest.$ac_ext < @@ -2144,7 +2183,7 @@ int main() { struct stat sb; sb.st_blocks=0; ; return 0; } EOF -if { (eval echo configure:2148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STAT_ST_BLOCKS 1 @@ -2159,15 +2198,227 @@ else fi rm -f conftest* +for ac_func in _getvideoconfig gettextinfo GetConsoleScreenBufferInfo +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2205: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in _scrsize ioctl +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2260: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for struct videoconfig""... $ac_c" 1>&6 +echo "configure:2314: checking for struct videoconfig" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_VIDEOCONFIG 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for struct text_info""... $ac_c" 1>&6 +echo "configure:2339: checking for struct text_info" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_TEXT_INFO 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for TIOCGWINSZ""... $ac_c" 1>&6 +echo "configure:2364: checking for TIOCGWINSZ" >&5 +cat > conftest.$ac_ext < +int main() { +int w=TIOCGWINSZ; +; return 0; } +EOF +if { (eval echo configure:2373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_TIOCGWINSZ 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for TIOCGGETD""... $ac_c" 1>&6 +echo "configure:2389: checking for TIOCGGETD" >&5 +cat > conftest.$ac_ext < +int main() { +int w=TIOCGETD; +; return 0; } +EOF +if { (eval echo configure:2398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_TIOCGETD 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + + for ac_func in getpwuid gethostname system getrusage fork waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2166: checking for $ac_func" >&5 +echo "configure:2417: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2217,12 +2468,12 @@ done for ac_func in gettimeofday BSDgettimeofday difftime sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2221: checking for $ac_func" >&5 +echo "configure:2472: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2271,24 +2522,24 @@ done cat > conftest.$ac_ext < int main() { off64_t n = 0; ; return 0; } EOF -if { (eval echo configure:2282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* for ac_func in lseek64 fseek64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2287: checking for $ac_func" >&5 +echo "configure:2538: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2346,12 +2597,12 @@ rm -f conftest* echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2350: checking for working const" >&5 +echo "configure:2601: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2421,21 +2672,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2425: checking for inline" >&5 +echo "configure:2676: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2462,16 +2713,16 @@ esac echo $ac_n "checking for __attribute__ extension""... $ac_c" 1>&6 -echo "configure:2466: checking for __attribute__ extension" >&5 +echo "configure:2717: checking for __attribute__ extension" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ATTRIBUTE 1 @@ -2487,16 +2738,16 @@ fi rm -f conftest* echo $ac_n "checking for __FUNCTION__ extension""... $ac_c" 1>&6 -echo "configure:2491: checking for __FUNCTION__ extension" >&5 +echo "configure:2742: checking for __FUNCTION__ extension" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_FUNCTION 1 @@ -2512,7 +2763,7 @@ fi rm -f conftest* echo $ac_n "checking how to print long long""... $ac_c" 1>&6 -echo "configure:2516: checking how to print long long" >&5 +echo "configure:2767: checking how to print long long" >&5 if eval "test \"`echo '$''{'hdf5_cv_printf_ll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2521,7 +2772,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -2532,7 +2783,7 @@ else sprintf(s,"%${hdf5_cv_printf_ll}d",x); exit (strcmp(s,"1099511627776"));} EOF -if { (eval echo configure:2536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then break else @@ -2553,7 +2804,7 @@ EOF echo $ac_n "checking for debug flags""... $ac_c" 1>&6 -echo "configure:2557: checking for debug flags" >&5 +echo "configure:2808: checking for debug flags" >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -2585,7 +2836,7 @@ if test "X" != "X$DEBUG_PKG"; then fi echo $ac_n "checking for API tracing""... $ac_c" 1>&6 -echo "configure:2589: checking for API tracing" >&5; +echo "configure:2840: checking for API tracing" >&5; # Check whether --enable-trace or --disable-trace was given. if test "${enable_trace+set}" = set; then enableval="$enable_trace" @@ -2608,7 +2859,7 @@ if test "${enable_parallel+set}" = set; then fi echo $ac_n "checking for parallel support""... $ac_c" 1>&6 -echo "configure:2612: checking for parallel support" >&5; +echo "configure:2863: checking for parallel support" >&5; case "X-$PARALLEL" in @@ -2633,7 +2884,7 @@ EOF CFLAGS="$CFLAGS $MPI_LIB" RUNTEST="$RUNTEST" echo $ac_n "checking for main in -lmpi""... $ac_c" 1>&6 -echo "configure:2637: checking for main in -lmpi" >&5 +echo "configure:2888: checking for main in -lmpi" >&5 ac_lib_var=`echo mpi'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2641,14 +2892,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpi $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2675,7 +2926,7 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for main in -lmpio""... $ac_c" 1>&6 -echo "configure:2679: checking for main in -lmpio" >&5 +echo "configure:2930: checking for main in -lmpio" >&5 ac_lib_var=`echo mpio'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2683,14 +2934,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpio $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index 0999e01..e92677c 100644 --- a/configure.in +++ b/configure.in @@ -123,7 +123,7 @@ esac dnl ---------------------------------------------------------------------- -dnl Check for libraries. (none required yet) +dnl Check for libraries. dnl AC_CHECK_LIB(m, ceil) AC_CHECK_LIB(coug, main) dnl ...for ASCI/Red @@ -135,7 +135,7 @@ dnl AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(io.h sys/resource.h sys/time.h unistd.h winsock.h zlib.h) - +AC_CHECK_HEADERS(sys/ioctl.h sys/stat.h) dnl ---------------------------------------------------------------------- dnl Data types and their sizes. @@ -221,6 +221,37 @@ AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl ---------------------------------------------------------------------- +dnl How do we figure out the width of a tty in characters? +dnl +AC_CHECK_FUNCS(_getvideoconfig gettextinfo GetConsoleScreenBufferInfo) +AC_CHECK_FUNCS(_scrsize ioctl) + +AC_MSG_CHECKING(for struct videoconfig) +AC_TRY_COMPILE(,[struct videoconfig w; w.numtextcols=0;], +AC_DEFINE(HAVE_STRUCT_VIDEOCONFIG) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(for struct text_info) +AC_TRY_COMPILE(,[struct text_info w; w.screenwidth=0;], +AC_DEFINE(HAVE_STRUCT_TEXT_INFO) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(for TIOCGWINSZ) +AC_TRY_COMPILE([#include ],[int w=TIOCGWINSZ;], +AC_DEFINE(HAVE_TIOCGWINSZ) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(for TIOCGGETD) +AC_TRY_COMPILE([#include ],[int w=TIOCGETD;], +AC_DEFINE(HAVE_TIOCGETD) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + + +dnl ---------------------------------------------------------------------- dnl Check for functions. dnl AC_CHECK_FUNCS(getpwuid gethostname system getrusage fork waitpid) diff --git a/src/H5RA.c b/src/H5RA.c index 11d02e9..1f05424 100644 --- a/src/H5RA.c +++ b/src/H5RA.c @@ -431,8 +431,8 @@ H5RA_isa(H5G_entry_t *ent) } /* Is `raw' a dataset? */ - if (H5G_find(ent, "raw", NULL, &d_ent)<0 || - (exists=H5D_isa(&d_ent))<0) { + if (H5G_find(ent, "raw", NULL, &d_ent)<0) HRETURN(FALSE); + if ((exists=H5D_isa(&d_ent))<0) { HRETURN_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found"); } else if (!exists) { HRETURN(FALSE); diff --git a/src/H5config.h.in b/src/H5config.h.in index a08c7e2..88b268d 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -59,6 +59,18 @@ /* Define if `struct stat' has the `st_blocks' field */ #undef HAVE_STAT_ST_BLOCKS +/* Define if `struct text_info' is defined */ +#undef HAVE_STRUCT_TEXT_INFO + +/* Define if `struct videoconfig' is defined */ +#undef HAVE_STRUCT_VIDEOCONFIG + +/* Define if the ioctl TIOCGETD is defined */ +#undef HAVE_TIOCGETD + +/* Define if the ioctl TIOCGWINSZ is defined */ +#undef HAVE_TIOCGWINSZ + /* The number of bytes in a __int64. */ #undef SIZEOF___INT64 @@ -92,6 +104,15 @@ /* Define if you have the BSDgettimeofday function. */ #undef HAVE_BSDGETTIMEOFDAY +/* Define if you have the GetConsoleScreenBufferInfo function. */ +#undef HAVE_GETCONSOLESCREENBUFFERINFO + +/* Define if you have the _getvideoconfig function. */ +#undef HAVE__GETVIDEOCONFIG + +/* Define if you have the _scrsize function. */ +#undef HAVE__SCRSIZE + /* Define if you have the difftime function. */ #undef HAVE_DIFFTIME @@ -110,9 +131,15 @@ /* Define if you have the getrusage function. */ #undef HAVE_GETRUSAGE +/* Define if you have the gettextinfo function. */ +#undef HAVE_GETTEXTINFO + /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY +/* Define if you have the ioctl function. */ +#undef HAVE_IOCTL + /* Define if you have the lseek64 function. */ #undef HAVE_LSEEK64 @@ -128,9 +155,15 @@ /* Define if you have the header file. */ #undef HAVE_IO_H +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + /* Define if you have the header file. */ #undef HAVE_SYS_RESOURCE_H +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H diff --git a/src/H5private.h b/src/H5private.h index 2769269..3ef8c1d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -39,12 +39,20 @@ # include #endif #ifdef _POSIX_VERSION -# include # include # include #endif /* + * The `struct stat' data type for stat() and fstat(). This is a Posix file + * but often apears on non-Posix systems also. The `struct stat' is required + * for hdf5 to compile, although only a few fields are actually used. + */ +#ifdef HAVE_SYS_STAT_H +# include +#endif + +/* * If a program may include both `time.h' and `sys/time.h' then * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.in). * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not @@ -72,6 +80,14 @@ #endif /* + * Unix ioctls. These are used by h5ls (and perhaps others) to determine a + * resonable output width. + */ +#ifdef HAVE_SYS_IOCTL_H +# include +#endif + +/* * Win32 is severely broken when it comes to ANSI-C and Posix.1 compliance. */ #ifdef HAVE_IO_H diff --git a/tools/h5ls.c b/tools/h5ls.c index 3d7b845..383c590 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -23,10 +23,11 @@ #endif /* Command-line switches */ -static int verbose_g = 0; -static int dump_g = 0; -static int width_g = 80; -static int string_g = FALSE; +static int verbose_g = 0; /*lots of extra output */ +static int width_g = 80; /*output width in characters */ +static hbool_t dump_g = FALSE; /*display dataset values? */ +static hbool_t label_g = FALSE; /*label compound values? */ +static hbool_t string_g = FALSE; /*print 1-byte numbers as ASCII? */ /* Information about how to display each type of object */ static struct dispatch_t { @@ -46,6 +47,7 @@ static struct dispatch_t { } static herr_t list (hid_t group, const char *name, void *cd); +static void display_type(hid_t type, int indent); /*------------------------------------------------------------------------- @@ -70,6 +72,7 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ OPTIONS\n\ -h, -?, --help Print a usage message and exit\n\ -d, --dump Print the values of datasets\n\ + -l, --label Label members of compound datasets\n\ -s, --string Print 1-byte integer datasets as ASCII\n\ -wN, --width=N Set the number of columns of output\n\ -v, --verbose Generate more verbose output\n\ @@ -87,6 +90,669 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ /*------------------------------------------------------------------------- + * Function: display_string + * + * Purpose: Print a string value by escaping unusual characters. + * + * Return: Number of characters printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +display_string(const char *s) +{ + int nprint=0; + + for (/*void*/; s && *s; s++) { + switch (*s) { + case '"': + printf("\\\""); + nprint += 2; + break; + case '\\': + printf("\\\\"); + nprint += 2; + break; + case '\b': + printf("\\b"); + nprint += 2; + break; + case '\f': + printf("\\f"); + nprint += 2; + break; + case '\n': + printf("\\n"); + nprint += 2; + break; + case '\r': + printf("\\r"); + nprint += 2; + break; + case '\t': + printf("\\t"); + nprint += 2; + break; + default: + if (isprint(*s)) { + putchar(*s); + nprint++; + } else { + printf("\\%03o", *((const unsigned char*)s)); + nprint += 4; + } + break; + } + } + return nprint; +} + + +/*------------------------------------------------------------------------- + * Function: display_native_type + * + * Purpose: Prints the name of a native C data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_native_type(hid_t type, int __unused__ indent) +{ + if (H5Tequal(type, H5T_NATIVE_CHAR)) { + printf("native char"); + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { + printf("native unsigned char"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { + printf("native short"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { + printf("native unsigned short"); + } else if (H5Tequal(type, H5T_NATIVE_INT)) { + printf("native int"); + } else if (H5Tequal(type, H5T_NATIVE_UINT)) { + printf("native unsigned int"); + } else if (H5Tequal(type, H5T_NATIVE_LONG)) { + printf("native long"); + } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { + printf("native unsigned long"); + } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { + printf("native long long"); + } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { + printf("native unsigned long long"); + } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { + printf("native float"); + } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { + printf("native double"); + } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { + printf("native long double"); + } else if (H5Tequal(type, H5T_NATIVE_B8)) { + printf("native 8-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B16)) { + printf("native 16-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B32)) { + printf("native 32-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B64)) { + printf("native 64-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_HSIZE)) { + printf("native hsize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { + printf("native hssize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HERR)) { + printf("native herr_t"); + } else if (H5Tequal(type, H5T_NATIVE_HBOOL)) { + printf("native hbool_t"); + } else { + return FALSE; + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_ieee_type + * + * Purpose: Print the name of an IEEE floating-point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_ieee_type(hid_t type, int __unused__ indent) +{ + if (H5Tequal(type, H5T_IEEE_F32BE)) { + printf("IEEE 32-bit big-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F32LE)) { + printf("IEEE 32-bit little-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F64BE)) { + printf("IEEE 64-bit big-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F64LE)) { + printf("IEEE 64-bit little-endian float"); + } else { + return FALSE; + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_precision + * + * Purpose: Prints information on the next line about precision and + * padding if the precision is less than the total data type + * size. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +display_precision(hid_t type, int indent) +{ + size_t prec; /*precision */ + H5T_pad_t plsb, pmsb; /*lsb and msb padding */ + const char *plsb_s=NULL; /*lsb padding string */ + const char *pmsb_s=NULL; /*msb padding string */ + size_t nbits; /*number of bits */ + + /* + * If the precision is less than the total size then show the precision + * and offset on the following line. Also display the padding + * information. + */ + if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) { + printf("\n%*s(%lu bit%s of precision beginning at bit %lu)", + indent, "", (unsigned long)prec, 1==prec?"":"s", + (unsigned long)H5Tget_offset(type)); + + H5Tget_pad(type, &plsb, &pmsb); + if (H5Tget_offset(type)>0) { + switch (plsb) { + case H5T_PAD_ZERO: + plsb_s = "zero"; + break; + case H5T_PAD_ONE: + plsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + plsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + plsb_s = "unknown"; + break; + } + } + if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) { + switch (pmsb) { + case H5T_PAD_ZERO: + pmsb_s = "zero"; + break; + case H5T_PAD_ONE: + pmsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + pmsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + pmsb_s = "unknown"; + break; + } + } + if (plsb_s || pmsb_s) { + printf("\n%*s(", indent, ""); + if (plsb_s) { + nbits = H5Tget_offset(type); + printf("%lu %s bit%s at bit 0", + (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); + } + if (plsb_s && pmsb_s) printf(", "); + if (pmsb_s) { + nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); + printf("%lu %s bit%s at bit %lu", + (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", + (unsigned long)(8*H5Tget_size(type)-nbits)); + } + printf(")"); + } + } +} + + +/*------------------------------------------------------------------------- + * Function: display_int_type + * + * Purpose: Print the name of an integer data type. Common information + * like number of bits, byte order, and sign scheme appear on + * the first line. Additional information might appear in + * parentheses on the following lines. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_int_type(hid_t type, int indent) +{ + H5T_order_t order; /*byte order value */ + const char *order_s=NULL; /*byte order string */ + H5T_sign_t sign; /*sign scheme value */ + const char *sign_s=NULL; /*sign scheme string */ + + if (H5T_INTEGER!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } + } else { + order_s = ""; + } + + /* Sign */ + if (H5T_SGN_NONE==sign) { + sign_s = " unsigned"; + } else if (H5T_SGN_2==sign) { + sign_s = ""; + } else { + sign_s = " unknown-sign"; + } + + /* + * Print size, order, and sign on first line, precision and padding + * information on the subsequent lines + */ + printf("%lu-bit%s%s integer", + (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); + display_precision(type, indent); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_float_type + * + * Purpose: Print info about a floating point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_float_type(hid_t type, int indent) +{ + H5T_order_t order; /*byte order value */ + const char *order_s=NULL; /*byte order string */ + size_t spos; /*sign bit position */ + size_t esize, epos; /*exponent size and position */ + size_t msize, mpos; /*significand size and position */ + size_t ebias; /*exponent bias */ + H5T_norm_t norm; /*significand normalization */ + const char *norm_s=NULL; /*normalization string */ + H5T_pad_t pad; /*internal padding value */ + const char *pad_s=NULL; /*internal padding string */ + + if (H5T_FLOAT!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } + } else { + order_s = ""; + } + + /* + * Print size and byte order on first line, precision and padding on + * subsequent lines. + */ + printf("%lu-bit%s floating-point", + (unsigned long)(8*H5Tget_size(type)), order_s); + display_precision(type, indent); + + /* Print sizes, locations, and other information about each field */ + H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize); + ebias = H5Tget_ebias(type); + norm = H5Tget_norm(type); + switch (norm) { + case H5T_NORM_IMPLIED: + norm_s = ", msb implied"; + break; + case H5T_NORM_MSBSET: + norm_s = ", msb always set"; + break; + case H5T_NORM_NONE: + norm_s = ", no normalization"; + break; + case H5T_NORM_ERROR: + norm_s = ", unknown normalization"; + break; + } + printf("\n%*s(significant for %lu bit%s at bit %lu%s)", indent, "", + (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, + norm_s); + printf("\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", + indent, "", (unsigned long)esize, 1==esize?"":"s", + (unsigned long)epos, (unsigned long)ebias); + printf("\n%*s(sign bit at %lu)", indent, "", (unsigned long)spos); + return TRUE; + + /* Display internal padding */ + if (1+esize+msize0) { + printf("["); + for (j=0; j"); + return; + } + + /* Shared? */ + if (H5Tcommitted(type)) printf("shared "); + + /* Print the type */ + if (display_native_type(type, indent) || + display_ieee_type(type, indent) || + display_int_type(type, indent) || + display_float_type(type, indent) || + display_cmpd_type(type, indent) || + display_string_type(type, indent) || + display_reference_type(type, indent)) { + return; + } + + /* Unknown type */ + printf("%lu-byte class-%u unknown", + (unsigned long)H5Tget_size(type), + (unsigned)data_class); +} + + +/*------------------------------------------------------------------------- * Function: dump_dataset_values * * Purpose: Prints all values of a dataset. @@ -111,7 +777,7 @@ dump_dataset_values(hid_t dset) memset(&info, 0, sizeof info); info.idx_fmt = " (%s) "; info.line_ncols = width_g; - if (verbose_g) info.cmpd_name = "%s="; + if (label_g) info.cmpd_name = "%s="; /* * If the dataset is a 1-byte integer type then format it as an ASCI @@ -223,6 +889,7 @@ dataset_list1(hid_t dset) HDfprintf(stdout, "/%Hu", max_size[i]); } } + if (0==ndims) printf("SCALAR"); putchar('}'); H5Sclose (space); @@ -251,19 +918,56 @@ static herr_t dataset_list2(hid_t dset) { hid_t dcpl; /*dataset creation property list*/ + hid_t type; /*data type of dataset */ int nf; /*number of filters */ unsigned filt_flags; /*filter flags */ H5Z_filter_t filt_id; /*filter identification number */ unsigned cd_values[20]; /*filter client data values */ size_t cd_nelmts; /*filter client number of values*/ size_t cd_num; /*filter client data counter */ - char f_name[32]; /*filter name */ + char f_name[256]; /*filter/file name */ char s[64]; /*temporary string buffer */ + off_t f_offset; /*offset in external file */ + hsize_t f_size; /*bytes used in external file */ + hsize_t total_offset; /*total dataset offset */ int i; + if (verbose_g>0) { dcpl = H5Dget_create_plist(dset); + /* Print data type */ + printf(" %-10s ", "Type:"); + type = H5Dget_type(dset); + display_type(type, 15); + H5Tclose(type); + printf("\n"); + + /* Print information about external strorage */ + if ((nf = H5Pget_external_count(dcpl))>0) { + printf(" %-10s %d external file%s (num/addr/offset/length)\n", + "Extern:", nf, 1==nf?"":"s"); + for (i=0, total_offset=0; i0) { for (i=0; i=H5G_NTYPES) { - printf("Unknown type(%d)\n", sb.type); - return 0; + printf("Unknown type(%d)", sb.type); + sb.type = -1; + } + if (sb.type>=0 && dispatch_g[sb.type].name) { + fputs(dispatch_g[sb.type].name, stdout); } - if (dispatch_g[sb.type].name) fputs(dispatch_g[sb.type].name, stdout); /* * Open the object. Not all objects can be opened. If this is the case * then return right away. */ - if (NULL==dispatch_g[sb.type].open || - (obj=(dispatch_g[sb.type].open)(group, name))<0) return 0; + if (sb.type>=0 && + (NULL==dispatch_g[sb.type].open || + (obj=(dispatch_g[sb.type].open)(group, name))<0)) return 0; /* * List the first line of information for the object. */ - if (dispatch_g[sb.type].list1) (dispatch_g[sb.type].list1)(obj); + if (sb.type>=0 && dispatch_g[sb.type].list1) { + (dispatch_g[sb.type].list1)(obj); + } putchar('\n'); /* @@ -410,30 +1146,117 @@ list (hid_t group, const char *name, void __unused__ *cd) * which is common to all objects. */ if (verbose_g>0) { - H5Aiterate(obj, NULL, list_attr, NULL); + if (sb.type>=0) H5Aiterate(obj, NULL, list_attr, NULL); printf(" %-10s %lu:%lu:%lu:%lu\n", "Location:", sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]); printf(" %-10s %u\n", "Links:", sb.nlink); if (sb.mtime>0 && NULL!=(tm=localtime(&(sb.mtime)))) { strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - printf(" %-10s %s\n", "Modtime:", buf); + printf(" %-10s %s\n", "Modified:", buf); } comment[0] = '\0'; H5Gget_comment(group, name, sizeof(comment), comment); strcpy(comment+sizeof(comment)-4, "..."); if (comment[0]) printf(" %-10s %s\n", "Comment:", comment); } - if (dispatch_g[sb.type].list2) (dispatch_g[sb.type].list2)(obj); + if (sb.type>0 && dispatch_g[sb.type].list2) { + (dispatch_g[sb.type].list2)(obj); + } /* * Close the object. */ - (dispatch_g[sb.type].close)(obj); + if (sb.type>0) (dispatch_g[sb.type].close)(obj); return 0; } /*------------------------------------------------------------------------- + * Function: get_width + * + * Purpose: Figure out how wide the screen is. This is highly + * unportable, but the user can always override the width we + * detect by giving a command-line option. These code snippets + * were borrowed from the GNU less(1). + * + * Return: Success: Number of columns. + * + * Failure: Some default number of columms. + * + * Programmer: Robb Matzke + * Friday, November 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +get_width(void) +{ + int width = 80; /*the default */ + char *s; + + /* + * Try to get it from the COLUMNS environment variable first since it's + * value is sometimes wrong. + */ + if ((s=getenv("COLUMNS")) && *s && isdigit(*s)) { + width = strtol(s, NULL, 0); + } + +#if defined(HAVE_STRUCT_VIDEOCONFIG) && defined(HAVE__GETVIDEOCONFIG) + { + /* Microsoft C */ + struct videoconfig w; + _getvideoconfig(&w); + width = w.numtextcols; + } +#elif defined(HAVE_STRUCT_TEXT_INFO) && defined(HAVE_GETTEXTINFO) + { + /* Borland C or DJGPPC */ + struct text_info w; + gettextinfo(&w); + width = w.screenwidth; + } +#elif defined(HAVE_GETCONSOLESCREENBUFFERINFO) + { + /* Win32 C */ + CONSOLE_SCREEN_BUFFER_INFO scr; + GetConsoleScreenBufferInfo(con_out, &scr); + width = scr.srWindow.Right - scr.srWindow.Left + 1; + } +#elif defined(HAVE__SCRSIZE) + { + /* OS/2 */ + int w[2]; + _scrsize(w); + width = w[0]; + } +#elif defined(HAVE_TIOCGWINSZ) && defined(HAVE_IOCTL) + { + /* Unix with ioctl(TIOCGWINSZ) */ + struct winsize w; + if (ioctl(2, TIOCGWINSZ, &w)>=0 && w.ws_col>0) { + width = w.ws_col; + } + } +#elif defined(HAVE_TIOCGETD) && defined(HAVE_IOCTL) + { + /* Unix with ioctl(TIOCGETD) */ + struct uwdata w; + if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0) { + width = w.uw_width / w.uw_hs; + } + } +#endif + + /* Set to at least 1 */ + if (width<1) width = 1; + return width; +} + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Opens a file and lists the specified group @@ -465,7 +1288,7 @@ main (int argc, char *argv[]) DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, NULL, NULL); DISPATCH(H5G_TYPE, "Type", H5Topen, H5Tclose, - NULL, NULL); + NULL, datatype_list2); DISPATCH(H5G_LINK, "-> ", link_open, NULL, NULL, NULL); DISPATCH(H5G_RAGGED, "Ragged Array", H5Gopen, H5Gclose, @@ -474,7 +1297,10 @@ main (int argc, char *argv[]) /* Name of this program without the path */ if ((progname=strrchr (argv[0], '/'))) progname++; else progname = argv[0]; - + + /* Default output width */ + width_g = get_width(); + /* Switches come before non-switch arguments */ for (argno=1; argno