From 1c5f6ffb706c3b3ea715803a1ede1e3b1c4516fa Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Mon, 14 Jun 1999 10:07:58 -0500 Subject: [svn-r1341] Changes since 19990611 ---------------------- ./doc/html/H5.format.html Added documentation for opaque data types (bitfield types were already documented but they were out of order). ./src/H5E.c Fixed a bug with glibc2 on linux systems where `stdout' is an extern and can't be used to initialize static data. ./src/H5T.c ./src/H5Tpkg.h ./src/H5Tpublic.h ./src/H5detect.c Removed the `_T' from the new C9x types I just added so the names are consistent with existing types. Besides, the fact that something is a datatype is obvious because it starts with H5T_NATIVE_. ./tools/h5ls.c Added the new C9x data types. H5ls prints one of these types only if it doesn't match one of the builtin C types. Prints the OID for shared data types. Fixed a formatting bug with symbolic links which was introduced a few changes ago. The commandline has been changed so that objects from multiple files can be listed with a single command. Instead of specifying a file name and an optional list of objects, each thing to print is a file name and object concatenated. H5ls figures out how to devide the name into a file name and object name even when the file name part doesn't correspond to an actual Unix file. Old syntax: h5ls [OPTIONS] FILE [OBJECTS] New syntax: h5ls [OPTIONS] FILE[/OBJECT] [FILE[/OBJECT]]... Example ({X,Y} is expanded by the shell) Old command: h5ls -d ../test/x.data dir1 dir2 New command: h5ls -d ../test/x.data/{dir1,dir2} The filename is printed as part of the object name when full names are requested (--full or --recursive). If people really don't like this they can undefine a constant at the top of h5ls. Errors from the hdf5 library are turned off. Commandline switches of the form `--width 80' are accepted in addition to `--width=80'. This is more symmetric with single-letter switches that take two forms: `-w 80' and `-w80'. ./src/H5D.c Added tracing instrumentation for H5Dvlen_reclaim(). ./src/H5private.h Added casts to int for the isalpha() et al macros to shut up solaris warnings about char subscripts. --- doc/html/H5.format.html | 150 +++++++++++++++++----------- src/.distdep | 37 +++++-- src/H5D.c | 1 + src/H5E.c | 32 +++++- src/H5Tpkg.h | 54 +++++------ src/H5Tpublic.h | 102 +++++++++---------- src/H5detect.c | 80 +++++++-------- src/H5private.h | 22 ++--- test/.distdep | 27 ++++++ tools/h5ls.c | 253 +++++++++++++++++++++++++++++++++++------------- 10 files changed, 498 insertions(+), 260 deletions(-) diff --git a/doc/html/H5.format.html b/doc/html/H5.format.html index 25d2cc7..a098deb 100644 --- a/doc/html/H5.format.html +++ b/doc/html/H5.format.html @@ -2180,6 +2180,100 @@
+ + + + + + + + + + + + + + + + + + + + +
+ Bit Field for Bitfield types (Class 4) +
BitsMeaning
0Byte Order. If zero, byte order is little-endian; + otherwise, byte order is big endian.
1, 2Padding type. Bit 1 is the lo_pad type and bit 2 + is the hi_pad type. If a datum has unused bits at either + end, then the lo_pad or hi_pad bit is copied to those + locations.
3-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + + +
+ Properties for Bitfield types (Class 4) +
ByteByteByteByte
Bit OffsetBit Precision
+
+ +

+

+ + + + + + + + + + + + +
+ Bit Field for Opaque types (Class 5) +
BitsMeaning
0-23Reserved (zero).
+
+ +

+

+ + + + + + + + + + + + + +
+ Properties for Opaque types (Class 5) +
ByteByteByteByte

Null-terminated ASCII Tag
+ (multiple of 8 bytes)

+
+ +

+

+ + @@ -2268,60 +2362,6 @@
Bit Field for Compound Types (Class 6)
-

-

- - - - - - - - - - - - - - - - - - - - - - -
- Bit Field for Bitfield types (Class 4) -
BitsMeaning
0Byte Order. If zero, byte order is little-endian; - otherwise, byte order is big endian.
1, 2Padding type. Bit 1 is the lo_pad type and bit 2 - is the hi_pad type. If a datum has unused bits at either - end, then the lo_pad or hi_pad bit is copied to those - locations.
3-23Reserved (zero).
-
- -

-

- - - - - - - - - - - - - - -
- Properties for Bitfield types (Class 4) -
ByteByteByteByte
Bit OffsetBit Precision
-
-

Data type examples are here. @@ -3457,7 +3497,7 @@ data-type.

Quincey Koziol
Robb Matzke
-Last modified: Thu Oct 8 09:34:16 EDT 1998 +Last modified: Fri Jun 11 14:11:57 EDT 1999 diff --git a/src/.distdep b/src/.distdep index 02eaf65..ff75d73 100644 --- a/src/.distdep +++ b/src/.distdep @@ -1188,7 +1188,12 @@ H5Tconv.lo: \ H5Dpublic.h \ H5Rprivate.h \ H5Rpublic.h \ - H5Tprivate.h + H5Tprivate.h \ + H5Tpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h H5Tinit.lo: \ H5Tinit.c \ H5private.h \ @@ -1213,6 +1218,30 @@ H5Tinit.lo: \ H5Tpublic.h \ H5Gprivate.h \ H5Gpublic.h +H5Tvlen.lo: \ + H5Tvlen.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Tpkg.h \ + H5Rprivate.h \ + H5Rpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h H5TB.lo: \ H5TB.c \ H5private.h \ @@ -1269,8 +1298,4 @@ H5Z.lo: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h + H5Tpublic.h diff --git a/src/H5D.c b/src/H5D.c index 1739f47..b0542a0 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -2596,6 +2596,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) herr_t ret_value=FAIL; FUNC_ENTER(H5Dvlen_reclaim, FAIL); + H5TRACE4("e","iiix",type_id,space_id,plist_id,buf); /* Check args */ if (H5I_DATATYPE!=H5I_get_type(type_id) || diff --git a/src/H5E.c b/src/H5E.c index 3ed3c8c..5008631 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -111,7 +111,8 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = { /* Interface initialization? */ static intn interface_initialize_g = 0; -#define INTERFACE_INIT NULL +#define INTERFACE_INIT H5E_init_interface +static herr_t H5E_init_interface (void); const hbool_t H5E_clearable_g = TRUE; /* DO NOT CHANGE */ /* @@ -128,7 +129,34 @@ H5E_t H5E_stack_g[1]; * probably be part of the error stack so they're local to a thread. */ herr_t (*H5E_auto_g)(void*) = (herr_t(*)(void*))H5Eprint; -void *H5E_auto_data_g = stderr; +void *H5E_auto_data_g = NULL; + + +/*------------------------------------------------------------------------- + * Function: H5E_init_interface + * + * Purpose: Initialize the H5E interface. `stderr' is an extern or + * function on some systems so we can't initialize + * H5E_auto_data_g statically. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Friday, June 11, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E_init_interface (void) +{ + FUNC_ENTER(H5E_init_interface, FAIL); + H5E_auto_data_g = stderr; + FUNC_LEAVE(SUCCEED); +} /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index c3facc0..5bbbb69 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -179,33 +179,33 @@ __DLLVAR__ size_t H5T_NATIVE_DOUBLE_ALIGN_g; __DLLVAR__ size_t H5T_NATIVE_LDOUBLE_ALIGN_g; /* C9x alignment constraints */ -__DLLVAR__ size_t H5T_NATIVE_INT8_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT8_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_LEAST8_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST8_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_FAST8_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_FAST8_T_ALIGN_g; - -__DLLVAR__ size_t H5T_NATIVE_INT16_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT16_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_LEAST16_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST16_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_FAST16_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_FAST16_T_ALIGN_g; - -__DLLVAR__ size_t H5T_NATIVE_INT32_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT32_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_LEAST32_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST32_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_FAST32_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_FAST32_T_ALIGN_g; - -__DLLVAR__ size_t H5T_NATIVE_INT64_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT64_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_LEAST64_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST64_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_INT_FAST64_T_ALIGN_g; -__DLLVAR__ size_t H5T_NATIVE_UINT_FAST64_T_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT8_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT8_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_LEAST8_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST8_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_FAST8_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_FAST8_ALIGN_g; + +__DLLVAR__ size_t H5T_NATIVE_INT16_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT16_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_LEAST16_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST16_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_FAST16_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_FAST16_ALIGN_g; + +__DLLVAR__ size_t H5T_NATIVE_INT32_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT32_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_LEAST32_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST32_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_FAST32_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_FAST32_ALIGN_g; + +__DLLVAR__ size_t H5T_NATIVE_INT64_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT64_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_LEAST64_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_LEAST64_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_INT_FAST64_ALIGN_g; +__DLLVAR__ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g; /* Conversion functions */ __DLL__ herr_t H5T_conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index e208351..688ed2f 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -384,57 +384,57 @@ __DLLVAR__ hid_t H5T_NATIVE_HERR_g; __DLLVAR__ hid_t H5T_NATIVE_HBOOL_g; /* C9x integer types */ -#define H5T_NATIVE_INT8_T (H5open(), H5T_NATIVE_INT8_T_g) -#define H5T_NATIVE_UINT8_T (H5open(), H5T_NATIVE_UINT8_T_g) -#define H5T_NATIVE_INT_LEAST8_T (H5open(), H5T_NATIVE_INT_LEAST8_T_g) -#define H5T_NATIVE_UINT_LEAST8_T (H5open(), H5T_NATIVE_UINT_LEAST8_T_g) -#define H5T_NATIVE_INT_FAST8_T (H5open(), H5T_NATIVE_INT_FAST8_T_g) -#define H5T_NATIVE_UINT_FAST8_T (H5open(), H5T_NATIVE_UINT_FAST8_T_g) -__DLLVAR__ hid_t H5T_NATIVE_INT8_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT8_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST8_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST8_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_FAST8_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST8_T_g; - -#define H5T_NATIVE_INT16_T (H5open(), H5T_NATIVE_INT16_T_g) -#define H5T_NATIVE_UINT16_T (H5open(), H5T_NATIVE_UINT16_T_g) -#define H5T_NATIVE_INT_LEAST16_T (H5open(), H5T_NATIVE_INT_LEAST16_T_g) -#define H5T_NATIVE_UINT_LEAST16_T (H5open(), H5T_NATIVE_UINT_LEAST16_T_g) -#define H5T_NATIVE_INT_FAST16_T (H5open(), H5T_NATIVE_INT_FAST16_T_g) -#define H5T_NATIVE_UINT_FAST16_T (H5open(), H5T_NATIVE_UINT_FAST16_T_g) -__DLLVAR__ hid_t H5T_NATIVE_INT16_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT16_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST16_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST16_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_FAST16_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST16_T_g; - -#define H5T_NATIVE_INT32_T (H5open(), H5T_NATIVE_INT32_T_g) -#define H5T_NATIVE_UINT32_T (H5open(), H5T_NATIVE_UINT32_T_g) -#define H5T_NATIVE_INT_LEAST32_T (H5open(), H5T_NATIVE_INT_LEAST32_T_g) -#define H5T_NATIVE_UINT_LEAST32_T (H5open(), H5T_NATIVE_UINT_LEAST32_T_g) -#define H5T_NATIVE_INT_FAST32_T (H5open(), H5T_NATIVE_INT_FAST32_T_g) -#define H5T_NATIVE_UINT_FAST32_T (H5open(), H5T_NATIVE_UINT_FAST32_T_g) -__DLLVAR__ hid_t H5T_NATIVE_INT32_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT32_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST32_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST32_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_FAST32_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST32_T_g; - -#define H5T_NATIVE_INT64_T (H5open(), H5T_NATIVE_INT64_T_g) -#define H5T_NATIVE_UINT64_T (H5open(), H5T_NATIVE_UINT64_T_g) -#define H5T_NATIVE_INT_LEAST64_T (H5open(), H5T_NATIVE_INT_LEAST64_T_g) -#define H5T_NATIVE_UINT_LEAST64_T (H5open(), H5T_NATIVE_UINT_LEAST64_T_g) -#define H5T_NATIVE_INT_FAST64_T (H5open(), H5T_NATIVE_INT_FAST64_T_g) -#define H5T_NATIVE_UINT_FAST64_T (H5open(), H5T_NATIVE_UINT_FAST64_T_g) -__DLLVAR__ hid_t H5T_NATIVE_INT64_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT64_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST64_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST64_T_g; -__DLLVAR__ hid_t H5T_NATIVE_INT_FAST64_T_g; -__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST64_T_g; +#define H5T_NATIVE_INT8 (H5open(), H5T_NATIVE_INT8_g) +#define H5T_NATIVE_UINT8 (H5open(), H5T_NATIVE_UINT8_g) +#define H5T_NATIVE_INT_LEAST8 (H5open(), H5T_NATIVE_INT_LEAST8_g) +#define H5T_NATIVE_UINT_LEAST8 (H5open(), H5T_NATIVE_UINT_LEAST8_g) +#define H5T_NATIVE_INT_FAST8 (H5open(), H5T_NATIVE_INT_FAST8_g) +#define H5T_NATIVE_UINT_FAST8 (H5open(), H5T_NATIVE_UINT_FAST8_g) +__DLLVAR__ hid_t H5T_NATIVE_INT8_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT8_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST8_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST8_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_FAST8_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST8_g; + +#define H5T_NATIVE_INT16 (H5open(), H5T_NATIVE_INT16_g) +#define H5T_NATIVE_UINT16 (H5open(), H5T_NATIVE_UINT16_g) +#define H5T_NATIVE_INT_LEAST16 (H5open(), H5T_NATIVE_INT_LEAST16_g) +#define H5T_NATIVE_UINT_LEAST16 (H5open(), H5T_NATIVE_UINT_LEAST16_g) +#define H5T_NATIVE_INT_FAST16 (H5open(), H5T_NATIVE_INT_FAST16_g) +#define H5T_NATIVE_UINT_FAST16 (H5open(), H5T_NATIVE_UINT_FAST16_g) +__DLLVAR__ hid_t H5T_NATIVE_INT16_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT16_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST16_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST16_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_FAST16_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST16_g; + +#define H5T_NATIVE_INT32 (H5open(), H5T_NATIVE_INT32_g) +#define H5T_NATIVE_UINT32 (H5open(), H5T_NATIVE_UINT32_g) +#define H5T_NATIVE_INT_LEAST32 (H5open(), H5T_NATIVE_INT_LEAST32_g) +#define H5T_NATIVE_UINT_LEAST32 (H5open(), H5T_NATIVE_UINT_LEAST32_g) +#define H5T_NATIVE_INT_FAST32 (H5open(), H5T_NATIVE_INT_FAST32_g) +#define H5T_NATIVE_UINT_FAST32 (H5open(), H5T_NATIVE_UINT_FAST32_g) +__DLLVAR__ hid_t H5T_NATIVE_INT32_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT32_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST32_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST32_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_FAST32_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST32_g; + +#define H5T_NATIVE_INT64 (H5open(), H5T_NATIVE_INT64_g) +#define H5T_NATIVE_UINT64 (H5open(), H5T_NATIVE_UINT64_g) +#define H5T_NATIVE_INT_LEAST64 (H5open(), H5T_NATIVE_INT_LEAST64_g) +#define H5T_NATIVE_UINT_LEAST64 (H5open(), H5T_NATIVE_UINT_LEAST64_g) +#define H5T_NATIVE_INT_FAST64 (H5open(), H5T_NATIVE_INT_FAST64_g) +#define H5T_NATIVE_UINT_FAST64 (H5open(), H5T_NATIVE_UINT_FAST64_g) +__DLLVAR__ hid_t H5T_NATIVE_INT64_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT64_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_LEAST64_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_LEAST64_g; +__DLLVAR__ hid_t H5T_NATIVE_INT_FAST64_g; +__DLLVAR__ hid_t H5T_NATIVE_UINT_FAST64_g; /* Operations defined on all data types */ __DLL__ hid_t H5Topen(hid_t loc_id, const char *name); diff --git a/src/H5detect.c b/src/H5detect.c index 1d07df8..5930c54 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -995,106 +995,106 @@ main(void) print_header(); /* C89 integer types */ - DETECT_I(signed char, SCHAR, d[nd]); nd++; - DETECT_I(unsigned char, UCHAR, d[nd]); nd++; - DETECT_I(short, SHORT, d[nd]); nd++; - DETECT_I(unsigned short, USHORT, d[nd]); nd++; - DETECT_I(int, INT, d[nd]); nd++; - DETECT_I(unsigned int, UINT, d[nd]); nd++; - DETECT_I(long, LONG, d[nd]); nd++; - DETECT_I(unsigned long, ULONG, d[nd]); nd++; + DETECT_I(signed char, SCHAR, d[nd]); nd++; + DETECT_I(unsigned char, UCHAR, d[nd]); nd++; + DETECT_I(short, SHORT, d[nd]); nd++; + DETECT_I(unsigned short, USHORT, d[nd]); nd++; + DETECT_I(int, INT, d[nd]); nd++; + DETECT_I(unsigned int, UINT, d[nd]); nd++; + DETECT_I(long, LONG, d[nd]); nd++; + DETECT_I(unsigned long, ULONG, d[nd]); nd++; /* * C9x integer types. */ #if SIZEOF_INT8_T>0 - DETECT_I(int8_t, INT8_T, d[nd]); nd++; + DETECT_I(int8_t, INT8, d[nd]); nd++; #endif #if SIZEOF_UINT8_T>0 - DETECT_I(uint8_t, UINT8_T, d[nd]); nd++; + DETECT_I(uint8_t, UINT8, d[nd]); nd++; #endif #if SIZEOF_INT_LEAST8_T>0 - DETECT_I(int_least8_t, INT_LEAST8_T, d[nd]); nd++; + DETECT_I(int_least8_t, INT_LEAST8, d[nd]); nd++; #endif #if SIZEOF_UINT_LEAST8_T>0 - DETECT_I(uint_least8_t, UINT_LEAST8_T, d[nd]); nd++; + DETECT_I(uint_least8_t, UINT_LEAST8, d[nd]); nd++; #endif #if SIZEOF_INT_FAST8_T>0 - DETECT_I(int_fast8_t, INT_FAST8_T, d[nd]); nd++; + DETECT_I(int_fast8_t, INT_FAST8, d[nd]); nd++; #endif #if SIZEOF_UINT_FAST8_T>0 - DETECT_I(uint_fast8_t, UINT_FAST8_T, d[nd]); nd++; + DETECT_I(uint_fast8_t, UINT_FAST8, d[nd]); nd++; #endif #if SIZEOF_INT16_T>0 - DETECT_I(int16_t, INT16_T, d[nd]); nd++; + DETECT_I(int16_t, INT16, d[nd]); nd++; #endif #if SIZEOF_UINT16_T>0 - DETECT_I(uint16_t, UINT16_T, d[nd]); nd++; + DETECT_I(uint16_t, UINT16, d[nd]); nd++; #endif #if SIZEOF_INT_LEAST16_T>0 - DETECT_I(int_least16_t, INT_LEAST16_T, d[nd]); nd++; + DETECT_I(int_least16_t, INT_LEAST16, d[nd]); nd++; #endif #if SIZEOF_UINT_LEAST16_T>0 - DETECT_I(uint_least16_t, UINT_LEAST16_T, d[nd]); nd++; + DETECT_I(uint_least16_t, UINT_LEAST16, d[nd]); nd++; #endif #if SIZEOF_INT_FAST16_T>0 - DETECT_I(int_fast16_t, INT_FAST16_T, d[nd]); nd++; + DETECT_I(int_fast16_t, INT_FAST16, d[nd]); nd++; #endif #if SIZEOF_UINT_FAST16_T>0 - DETECT_I(uint_fast16_t, UINT_FAST16_T, d[nd]); nd++; + DETECT_I(uint_fast16_t, UINT_FAST16, d[nd]); nd++; #endif #if SIZEOF_INT32_T>0 - DETECT_I(int32_t, INT32_T, d[nd]); nd++; + DETECT_I(int32_t, INT32, d[nd]); nd++; #endif #if SIZEOF_UINT32_T>0 - DETECT_I(uint32_t, UINT32_T, d[nd]); nd++; + DETECT_I(uint32_t, UINT32, d[nd]); nd++; #endif #if SIZEOF_INT_LEAST32_T>0 - DETECT_I(int_least32_t, INT_LEAST32_T, d[nd]); nd++; + DETECT_I(int_least32_t, INT_LEAST32, d[nd]); nd++; #endif #if SIZEOF_UINT_LEAST32_T>0 - DETECT_I(uint_least32_t, UINT_LEAST32_T, d[nd]); nd++; + DETECT_I(uint_least32_t, UINT_LEAST32, d[nd]); nd++; #endif #if SIZEOF_INT_FAST32_T>0 - DETECT_I(int_fast32_t, INT_FAST32_T, d[nd]); nd++; + DETECT_I(int_fast32_t, INT_FAST32, d[nd]); nd++; #endif #if SIZEOF_UINT_FAST32_T>0 - DETECT_I(uint_fast32_t, UINT_FAST32_T, d[nd]); nd++; + DETECT_I(uint_fast32_t, UINT_FAST32, d[nd]); nd++; #endif #if SIZEOF_INT64_T>0 - DETECT_I(int64_t, INT64_T, d[nd]); nd++; + DETECT_I(int64_t, INT64, d[nd]); nd++; #endif #if SIZEOF_UINT64_T>0 - DETECT_I(uint64_t, UINT64_T, d[nd]); nd++; + DETECT_I(uint64_t, UINT64, d[nd]); nd++; #endif #if SIZEOF_INT_LEAST64_T>0 - DETECT_I(int_least64_t, INT_LEAST64_T, d[nd]); nd++; + DETECT_I(int_least64_t, INT_LEAST64, d[nd]); nd++; #endif #if SIZEOF_UINT_LEAST64_T>0 - DETECT_I(uint_least64_t, UINT_LEAST64_T, d[nd]); nd++; + DETECT_I(uint_least64_t, UINT_LEAST64, d[nd]); nd++; #endif #if SIZEOF_INT_FAST64_T>0 - DETECT_I(int_fast64_t, INT_FAST64_T, d[nd]); nd++; + DETECT_I(int_fast64_t, INT_FAST64, d[nd]); nd++; #endif #if SIZEOF_UINT_FAST64_T>0 - DETECT_I(uint_fast64_t, UINT_FAST64_T, d[nd]); nd++; + DETECT_I(uint_fast64_t, UINT_FAST64, d[nd]); nd++; #endif #if SIZEOF_LONG_LONG>0 - DETECT_I(long_long, LLONG, d[nd]); nd++; - DETECT_I(unsigned long_long, ULLONG, d[nd]); nd++; + DETECT_I(long_long, LLONG, d[nd]); nd++; + DETECT_I(unsigned long_long, ULLONG, d[nd]); nd++; #else /* * This architecture doesn't support an integer type larger than `long' * so we'll just make H5T_NATIVE_LLONG the same as H5T_NATIVE_LONG since * `long long' is probably equivalent to `long' here anyway. */ - DETECT_I(long, LLONG, d[nd]); nd++; - DETECT_I(unsigned long, ULLONG, d[nd]); nd++; + DETECT_I(long, LLONG, d[nd]); nd++; + DETECT_I(unsigned long, ULLONG, d[nd]); nd++; #endif - DETECT_F(float, FLOAT, d[nd]); nd++; - DETECT_F(double, DOUBLE, d[nd]); nd++; + DETECT_F(float, FLOAT, d[nd]); nd++; + DETECT_F(double, DOUBLE, d[nd]); nd++; #if SIZEOF_DOUBLE == SIZEOF_LONG_DOUBLE /* @@ -1103,9 +1103,9 @@ main(void) * some systems and `long double' is probably the same as `double' here * anyway. */ - DETECT_F(double, LDOUBLE, d[nd]); nd++; + DETECT_F(double, LDOUBLE, d[nd]); nd++; #else - DETECT_F(long double, LDOUBLE, d[nd]); nd++; + DETECT_F(long double, LDOUBLE, d[nd]); nd++; #endif print_results (nd, d); diff --git a/src/H5private.h b/src/H5private.h index 5d973c5..df0b852 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -545,18 +545,18 @@ __DLL__ int HDfprintf (FILE *stream, const char *fmt, ...); #define HDgets(S) gets(S) #define HDgetuid() getuid() #define HDgmtime(T) gmtime(T) -#define HDisalnum(C) isalnum(C) -#define HDisalpha(C) isalpha(C) +#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ +#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ #define HDisatty(F) isatty(F) -#define HDiscntrl(C) iscntrl(C) -#define HDisdigit(C) isdigit(C) -#define HDisgraph(C) isgraph(C) -#define HDislower(C) islower(C) -#define HDisprint(C) isprint(C) -#define HDispunct(C) ispunct(C) -#define HDisspace(C) isspace(C) -#define HDisupper(C) isupper(C) -#define HDisxdigit(C) isxdigit(C) +#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ +#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ +#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ +#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ +#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ +#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ +#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ +#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ +#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ #define HDkill(P,S) kill(P,S) #define HDlabs(X) labs(X) #define HDldexp(X,N) ldexp(X,N) diff --git a/test/.distdep b/test/.distdep index b3c51d3..ea4b857 100644 --- a/test/.distdep +++ b/test/.distdep @@ -883,6 +883,33 @@ tselect.lo: \ ../src/H5Rpublic.h \ ../src/H5RApublic.h \ ../src/H5Spublic.h +tvltypes.lo: \ + tvltypes.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5api_adpt.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/hdf5.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Rpublic.h \ + ../src/H5RApublic.h \ + ../src/H5Spublic.h unlink.lo: \ unlink.c \ h5test.h \ diff --git a/tools/h5ls.c b/tools/h5ls.c index ae14077..f525136 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -15,6 +15,12 @@ #include #include +/* + * If defined then include the file name as part of the object name when + * printing full object names. Otherwise leave the file name off. + */ +#define H5LS_PREPEND_FILENAME + /* Command-line switches */ static int verbose_g = 0; /*lots of extra output */ static int width_g = 80; /*output width in characters */ @@ -271,6 +277,9 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces) * Thursday, November 5, 1998 * * Modifications: + * Robb Matzke, 1999-06-11 + * Added the C9x types, but we still prefer to display the types + * from the C language itself (like `int' vs. `int32_t'). * *------------------------------------------------------------------------- */ @@ -303,6 +312,54 @@ display_native_type(hid_t type, int UNUSED indent) printf("native double"); } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { printf("native long double"); + } else if (H5Tequal(type, H5T_NATIVE_INT8)) { + printf("native int8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT8)) { + printf("native uint8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT16)) { + printf("native int16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT16)) { + printf("native uint16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT32)) { + printf("native int32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT32)) { + printf("native uint32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT64)) { + printf("native int64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT64)) { + printf("native uint64_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)) { + printf("native int_least8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)) { + printf("native uint_least8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)) { + printf("native int_least16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)) { + printf("native uint_least16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)) { + printf("native int_least32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)) { + printf("native uint_least32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)) { + printf("native int_least64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)) { + printf("native uint_least64_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)) { + printf("native int_fast8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)) { + printf("native uint_fast8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)) { + printf("native int_fast16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)) { + printf("native uint_fast16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)) { + printf("native int_fast32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)) { + printf("native uint_fast32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)) { + printf("native int_fast64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)) { + printf("native uint_fast64_t"); } else if (H5Tequal(type, H5T_NATIVE_B8)) { printf("native 8-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B16)) { @@ -973,6 +1030,8 @@ display_opaque_type(hid_t type, int indent) * Thursday, November 5, 1998 * * Modifications: + * Robb Matzke, 1999-06-11 + * Prints the OID of shared data types. * *------------------------------------------------------------------------- */ @@ -980,6 +1039,7 @@ static void display_type(hid_t type, int indent) { H5T_class_t data_class = H5Tget_class(type); + H5G_stat_t sb; /* Bad data type */ if (type<0) { @@ -987,9 +1047,17 @@ display_type(hid_t type, int indent) return; } - /* Shared? */ - if (H5Tcommitted(type)) printf("shared "); - + /* Shared? If so then print the type's OID */ + if (H5Tcommitted(type)) { + if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) { + printf("shared-%lu:%lu:%lu:%lu ", + sb.fileno[1], sb.fileno[0], + sb.objno[1], sb.objno[0]); + } else { + printf("shared "); + } + } + /* Print the type */ if (display_native_type(type, indent) || display_ieee_type(type, indent) || @@ -1480,7 +1548,8 @@ ragged_list2(hid_t UNUSED ra, const char UNUSED *name) * links don't correspond to actual objects we simply print the * link information and return failure. * - * Return: Success: never succeeds + * Return: Success: 0 - an invalid object but successful return + * of this function. * * Failure: -1 * @@ -1500,9 +1569,9 @@ link_open(hid_t location, const char *name) if (NULL==HDmemchr(buf, 0, sizeof(buf))) { strcpy(buf+sizeof(buf)-4, "..."); } - puts(buf); + fputs(buf, stdout); - return -1; + return 0; } @@ -1594,7 +1663,7 @@ list (hid_t group, const char *name, void *_iter) * Show detailed information about the object, beginning with information * which is common to all objects. */ - if (verbose_g>0) { + if (verbose_g>0 && H5G_LINK!=sb.type) { 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]); @@ -1612,7 +1681,7 @@ list (hid_t group, const char *name, void *_iter) puts("\""); } } - if (sb.type>0 && dispatch_g[sb.type].list2) { + if (sb.type>=0 && dispatch_g[sb.type].list2) { (dispatch_g[sb.type].list2)(obj, fullname); } @@ -1620,7 +1689,9 @@ list (hid_t group, const char *name, void *_iter) * Close the object. */ done: - if (sb.type>0 && obj>=0) (dispatch_g[sb.type].close)(obj); + if (sb.type>=0 && obj>=0 && dispatch_g[sb.type].close) { + (dispatch_g[sb.type].close)(obj); + } if (fullname) free(fullname); return 0; } @@ -1631,8 +1702,7 @@ list (hid_t group, const char *name, void *_iter) * * Purpose: Returns a malloc'd buffer that contains the PATH and BASE * names separated by a single slash. It also removes duplicate - * and trailing slashes and insures that the name begins with a - * slash. + * and trailing slashes. * * Return: Success: Ptr to fixed name from malloc() * @@ -1653,8 +1723,10 @@ fix_name(const char *path, const char *base) int len=0; if (path) { - /* Slash, followed by path, followed by slash */ - if ('/'!=*path) prev = s[len++] = '/'; + /* Path, followed by slash */ +#ifdef H5LS_PREPEND_FILENAME + if ('/'!=*path) s[len++] = '/'; +#endif for (/*void*/; *path; path++) { if ('/'!=*path || '/'!=prev) prev = s[len++] = *path; } @@ -1779,15 +1851,20 @@ get_width(void) int main (int argc, char *argv[]) { - hid_t file, plist=H5P_DEFAULT, root; - const char *fname = NULL; + hid_t file=-1, plist=-1, root=-1; + char *fname=NULL, *oname=NULL, *x; const char *progname; const char *s = NULL; char *rest, *container=NULL; int argno; H5G_stat_t sb; iter_t iter; + static char root_name[] = "/"; + /* Turn off HDF5's automatic error printing unless you're debugging h5ls */ + H5Eset_auto(NULL, NULL); + + /* Build display table */ DISPATCH(H5G_DATASET, "Dataset", H5Dopen, H5Dclose, dataset_list1, dataset_list2); DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, @@ -1799,8 +1876,8 @@ main (int argc, char *argv[]) DISPATCH(H5G_RAGGED, "Ragged Array", H5Gopen, H5Gclose, NULL, ragged_list2); - /*init the programtype var fromthe tools lib*/ - programtype = H5LS; + /* Init the program type for the tools lib*/ + programtype = H5LS; /*global*/ /* Name of this program without the path */ if ((progname=strrchr(argv[0], '/'))) progname++; @@ -1839,6 +1916,18 @@ main (int argc, char *argv[]) usage(progname); exit(1); } + } else if (!strcmp(argv[argno], "--width")) { + if (argno+1>=argc) { + usage(progname); + exit(1); + } else { + s = argv[++argno]; + } + width_g = (int)strtol(s, &rest, 0); + if (width_g<=0 || *rest) { + usage(progname); + exit(1); + } } else if (!strcmp(argv[argno], "--verbose")) { verbose_g++; } else if (!strcmp(argv[argno], "--version")) { @@ -1914,66 +2003,94 @@ main (int argc, char *argv[]) } /* - * The first non-switch argument is a file name. If the file name - * contains a `%' then assume that a file family is being opened. + * If no arguments remain then print a usage message (instead of doing + * absolutely nothing ;-) */ - if (argno=argc) { usage(progname); exit(1); } - if (strchr(fname, '%')) { - plist = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_family(plist, 0, H5P_DEFAULT); - } - if ((file = H5Fopen(fname, H5F_ACC_RDONLY, plist))<0) exit (1); - + /* - * The remaining optional arguments are the names of the objects to list. - * If there are no arguments then list `/'. + * Each remaining argument is an hdf5 file followed by an optional slash + * and object name. + * + * Example: ../dir1/foo/bar/baz + * \_________/\______/ + * file obj + * + * The dichotomy is determined by calling H5Fopen() repeatedly until it + * 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). */ - if (argno>=argc) { - if (grp_literal_g) { - root = H5Gopen(file, "/"); - iter.container = "/"; - list(root, "/", &iter); - H5Gclose(root); - } else { - H5Gget_objinfo(file, "/", TRUE, &sb); - sym_insert(&sb, "/"); - iter.container = "/"; - H5Giterate(file, "/", NULL, list, &iter); + while (argno=0) break; /*success*/ + + /* Shorten the file name; lengthen the object name */ + x = oname; + oname = strrchr(fname, '/'); + if (x) *x = '/'; + if (!oname) break; + *oname = '\0'; } - } else { - for (/*void*/; argno=0 && - H5G_GROUP==sb.type && !grp_literal_g) { - /* - * Specified name is a group. List the complete contents of - * the group. - */ - sym_insert(&sb, argv[argno]); - iter.container = container = fix_name("", argv[argno]); - H5Giterate(file, argv[argno], NULL, list, &iter); - free(container); - - } else if ((root=H5Gopen(file, "/"))<0) { - exit(1); /*major problem!*/ + if (file<0) { + fprintf(stderr, "%s: unable to open file\n", fname); + } + if (oname) oname++; + if (!oname || !*oname) oname = root_name; + + /* Open the object and display it's information */ + if (H5Gget_objinfo(file, oname, TRUE, &sb)>=0 && + H5G_GROUP==sb.type && !grp_literal_g) { + /* + * Specified name is a group. List the complete contents of the + * group. + */ + sym_insert(&sb, oname); +#ifdef H5LS_PREPEND_FILENAME + iter.container = container = fix_name(fname, oname); +#else + iter.container = container = fix_name("", oname); +#endif + H5Giterate(file, oname, NULL, list, &iter); + free(container); + + } else if ((root=H5Gopen(file, "/"))<0) { + exit(1); /*major problem!*/ - } else { - /* - * Specified name is a non-group object -- list that object. - * The container for the object is everything up to the base - * name. - */ - iter.container = "/"; - list(root, argv[argno], &iter); - if (H5Gclose(root)<0) exit(1); - } + } else { + /* + * Specified name is a non-group object -- list that object. The + * container for the object is everything up to the base name. + */ +#ifdef H5LS_PREPEND_FILENAME + iter.container = fname; +#else + iter.container = "/"; +#endif + list(root, oname, &iter); + if (H5Gclose(root)<0) exit(1); } + H5Fclose(file); } - - if (H5Fclose(file)<0) exit(1); + return 0; } -- cgit v0.12