summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5S.c2
-rw-r--r--src/H5T.c421
-rw-r--r--src/H5Tconv.c11
-rw-r--r--src/H5Tpkg.h2
-rw-r--r--src/H5Tpublic.h241
-rw-r--r--src/H5detect.c432
-rw-r--r--src/h5ls.c4
7 files changed, 636 insertions, 477 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 7969c04..092f569 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -677,7 +677,7 @@ H5S_get_ndims(const H5S_t *ds)
*-------------------------------------------------------------------------
*/
int
-H5Sget_dims(hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/)
+H5Sget_dims (hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/)
{
H5S_t *ds = NULL;
intn ret_value = 0;
diff --git a/src/H5T.c b/src/H5T.c
index 9690176..bdeda66 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -30,7 +30,45 @@ static intn interface_initialize_g = FALSE;
#define INTERFACE_INIT H5T_init_interface
static void H5T_term_interface(void);
-/* Predefined native types */
+hid_t H5T_IEEE_F32BE_g = FAIL;
+hid_t H5T_IEEE_F32LE_g = FAIL;
+hid_t H5T_IEEE_F64BE_g = FAIL;
+hid_t H5T_IEEE_F64LE_g = FAIL;
+
+hid_t H5T_STD_I8BE_g = FAIL;
+hid_t H5T_STD_I8LE_g = FAIL;
+hid_t H5T_STD_I16BE_g = FAIL;
+hid_t H5T_STD_I16LE_g = FAIL;
+hid_t H5T_STD_I32BE_g = FAIL;
+hid_t H5T_STD_I32LE_g = FAIL;
+hid_t H5T_STD_I64BE_g = FAIL;
+hid_t H5T_STD_I64LE_g = FAIL;
+hid_t H5T_STD_U8BE_g = FAIL;
+hid_t H5T_STD_U8LE_g = FAIL;
+hid_t H5T_STD_U16BE_g = FAIL;
+hid_t H5T_STD_U16LE_g = FAIL;
+hid_t H5T_STD_U32BE_g = FAIL;
+hid_t H5T_STD_U32LE_g = FAIL;
+hid_t H5T_STD_U64BE_g = FAIL;
+hid_t H5T_STD_U64LE_g = FAIL;
+hid_t H5T_STD_B8BE_g = FAIL;
+hid_t H5T_STD_B8LE_g = FAIL;
+hid_t H5T_STD_B16BE_g = FAIL;
+hid_t H5T_STD_B16LE_g = FAIL;
+hid_t H5T_STD_B32BE_g = FAIL;
+hid_t H5T_STD_B32LE_g = FAIL;
+hid_t H5T_STD_B64BE_g = FAIL;
+hid_t H5T_STD_B64LE_g = FAIL;
+
+hid_t H5T_UNIX_D32BE_g = FAIL;
+hid_t H5T_UNIX_D32LE_g = FAIL;
+hid_t H5T_UNIX_D64BE_g = FAIL;
+hid_t H5T_UNIX_D64LE_g = FAIL;
+
+hid_t H5T_C_S1_g = FAIL;
+
+hid_t H5T_FORTRAN_S1_g = FAIL;
+
hid_t H5T_NATIVE_CHAR_g = FAIL;
hid_t H5T_NATIVE_UCHAR_g = FAIL;
hid_t H5T_NATIVE_SHORT_g = FAIL;
@@ -38,44 +76,18 @@ hid_t H5T_NATIVE_USHORT_g = FAIL;
hid_t H5T_NATIVE_INT_g = FAIL;
hid_t H5T_NATIVE_UINT_g = FAIL;
hid_t H5T_NATIVE_LONG_g = FAIL;
+hid_t H5T_NATIVE_ULONG_g = FAIL;
hid_t H5T_NATIVE_LLONG_g = FAIL;
hid_t H5T_NATIVE_ULLONG_g = FAIL;
-hid_t H5T_NATIVE_HYPER_g = FAIL;
-hid_t H5T_NATIVE_UHYPER_g = FAIL;
-hid_t H5T_NATIVE_INT8_g = FAIL;
-hid_t H5T_NATIVE_UINT8_g = FAIL;
-hid_t H5T_NATIVE_INT16_g = FAIL;
-hid_t H5T_NATIVE_UINT16_g = FAIL;
-hid_t H5T_NATIVE_INT32_g = FAIL;
-hid_t H5T_NATIVE_UINT32_g = FAIL;
-hid_t H5T_NATIVE_INT64_g = FAIL;
-hid_t H5T_NATIVE_UINT64_g = FAIL;
-hid_t H5T_NATIVE_ULONG_g = FAIL;
hid_t H5T_NATIVE_FLOAT_g = FAIL;
hid_t H5T_NATIVE_DOUBLE_g = FAIL;
-hid_t H5T_NATIVE_TIME_g = FAIL;
-hid_t H5T_NATIVE_STRING_g = FAIL;
-hid_t H5T_NATIVE_BITFIELD_g = FAIL;
+hid_t H5T_NATIVE_LDOUBLE_g = FAIL;
+hid_t H5T_NATIVE_B8_g = FAIL;
+hid_t H5T_NATIVE_B16_g = FAIL;
+hid_t H5T_NATIVE_B32_g = FAIL;
+hid_t H5T_NATIVE_B64_g = FAIL;
hid_t H5T_NATIVE_OPAQUE_g = FAIL;
-/* Predefined standard types */
-hid_t H5T_IEEE_R32LE_g = FAIL;
-hid_t H5T_IEEE_R32BE_g = FAIL;
-hid_t H5T_IEEE_R64LE_g = FAIL;
-hid_t H5T_IEEE_R64BE_g = FAIL;
-hid_t H5T_IEEE_U16LE_g = FAIL;
-hid_t H5T_IEEE_U16BE_g = FAIL;
-hid_t H5T_IEEE_U32LE_g = FAIL;
-hid_t H5T_IEEE_U32BE_g = FAIL;
-hid_t H5T_IEEE_U64LE_g = FAIL;
-hid_t H5T_IEEE_U64BE_g = FAIL;
-hid_t H5T_IEEE_S16LE_g = FAIL;
-hid_t H5T_IEEE_S16BE_g = FAIL;
-hid_t H5T_IEEE_S32LE_g = FAIL;
-hid_t H5T_IEEE_S32BE_g = FAIL;
-hid_t H5T_IEEE_S64LE_g = FAIL;
-hid_t H5T_IEEE_S64BE_g = FAIL;
-
/* The path database */
static intn H5T_npath_g = 0; /*num paths defined */
@@ -116,69 +128,67 @@ H5T_init_interface(void)
}
/*
- * Initialize pre-defined data types that depend on the architecture.
+ * Initialize pre-defined native data types from code generated during
+ * the library configuration by H5detect.
*/
ret_value = H5T_init();
- /*
- * Initialize pre-define data types that can be derived from
- * architecture-dependent types.
+ /*------------------------------------------------------------
+ * Native types
+ *------------------------------------------------------------
*/
- /* INT8 */
- H5T_NATIVE_INT8_g = H5Tcopy(H5T_NATIVE_INT_g);
- H5Tset_size(H5T_NATIVE_INT8_g, 1);
- H5Tset_precision(H5T_NATIVE_INT8_g, 8);
- H5Tlock(H5T_NATIVE_INT8_g);
-
- /* UINT8 */
- H5T_NATIVE_UINT8_g = H5Tcopy(H5T_NATIVE_UINT_g);
- H5Tset_size(H5T_NATIVE_UINT8_g, 1);
- H5Tset_precision(H5T_NATIVE_UINT8_g, 8);
- H5Tlock(H5T_NATIVE_UINT8_g);
-
- /* INT16 */
- H5T_NATIVE_INT16_g = H5Tcopy(H5T_NATIVE_INT_g);
- H5Tset_size(H5T_NATIVE_INT16_g, 2);
- H5Tset_precision(H5T_NATIVE_INT16_g, 16);
- H5Tlock(H5T_NATIVE_INT16_g);
-
- /* UINT16 */
- H5T_NATIVE_UINT16_g = H5Tcopy(H5T_NATIVE_UINT_g);
- H5Tset_size(H5T_NATIVE_UINT16_g, 2);
- H5Tset_precision(H5T_NATIVE_UINT16_g, 16);
- H5Tlock(H5T_NATIVE_UINT16_g);
-
- /* INT32 */
- H5T_NATIVE_INT32_g = H5Tcopy(H5T_NATIVE_INT_g);
- H5Tset_size(H5T_NATIVE_INT32_g, 4);
- H5Tset_precision(H5T_NATIVE_INT32_g, 32);
- H5Tlock(H5T_NATIVE_INT32_g);
-
- /* UINT32 */
- H5T_NATIVE_UINT32_g = H5Tcopy(H5T_NATIVE_UINT_g);
- H5Tset_size(H5T_NATIVE_UINT32_g, 4);
- H5Tset_precision(H5T_NATIVE_UINT32_g, 32);
- H5Tlock(H5T_NATIVE_UINT32_g);
-
- /* INT64 */
- H5T_NATIVE_INT64_g = H5Tcopy(H5T_NATIVE_INT_g);
- H5Tset_size(H5T_NATIVE_INT64_g, 8);
- H5Tset_precision(H5T_NATIVE_INT64_g, 64);
- H5Tlock(H5T_NATIVE_INT64_g);
-
- /* UINT64 */
- H5T_NATIVE_UINT64_g = H5Tcopy(H5T_NATIVE_UINT_g);
- H5Tset_size(H5T_NATIVE_UINT64_g, 8);
- H5Tset_precision(H5T_NATIVE_UINT64_g, 64);
- H5Tlock(H5T_NATIVE_UINT64_g);
-
- /*
- * Standard data types in big and little endian flavors.
+ /* 1-byte bit field */
+ dt = H5I_object (H5T_NATIVE_B8_g = H5Tcopy (H5T_NATIVE_UINT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+ dt->size = 1;
+ dt->u.atomic.prec = 8;
+
+ /* 2-byte bit field */
+ dt = H5I_object (H5T_NATIVE_B16_g = H5Tcopy (H5T_NATIVE_UINT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+ dt->size = 2;
+ dt->u.atomic.prec = 16;
+
+ /* 4-byte bit field */
+ dt = H5I_object (H5T_NATIVE_B32_g = H5Tcopy (H5T_NATIVE_UINT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+ dt->size = 4;
+ dt->u.atomic.prec = 32;
+
+ /* 8-byte bit field */
+ dt = H5I_object (H5T_NATIVE_B64_g = H5Tcopy (H5T_NATIVE_UINT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+ dt->size = 8;
+ dt->u.atomic.prec = 64;
+
+ /* Opaque data */
+ dt = H5MM_xcalloc(1, sizeof(H5T_t));
+ dt->state = H5T_STATE_IMMUTABLE;
+ H5F_addr_undef (&(dt->ent.header));
+ dt->type = H5T_OPAQUE;
+ dt->size = 1;
+ dt->u.atomic.order = H5T_ORDER_NONE;
+ dt->u.atomic.offset = 0;
+ dt->u.atomic.prec = 8 * dt->size;
+ dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.msb_pad = H5T_PAD_ZERO;
+ if ((H5T_NATIVE_OPAQUE_g = H5I_register(H5_DATATYPE, dt)) < 0) {
+ HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
+ "unable to initialize H5T layer");
+ }
+
+ /*------------------------------------------------------------
+ * IEEE Types
+ *------------------------------------------------------------
*/
/* IEEE 4-byte little-endian float */
- dt = H5I_object (H5T_IEEE_R32LE_g = H5Tcopy (H5T_NATIVE_DOUBLE));
+ dt = H5I_object (H5T_IEEE_F32LE_g = H5Tcopy (H5T_NATIVE_DOUBLE_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 4;
dt->u.atomic.offset = 0;
@@ -196,7 +206,7 @@ H5T_init_interface(void)
dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
/* IEEE 4-byte big-endian float */
- dt = H5I_object (H5T_IEEE_R32BE_g = H5Tcopy (H5T_NATIVE_DOUBLE));
+ dt = H5I_object (H5T_IEEE_F32BE_g = H5Tcopy (H5T_NATIVE_DOUBLE_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 4;
dt->u.atomic.offset = 0;
@@ -214,7 +224,7 @@ H5T_init_interface(void)
dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
/* IEEE 8-byte little-endian float */
- dt = H5I_object (H5T_IEEE_R64LE_g = H5Tcopy (H5T_NATIVE_DOUBLE));
+ dt = H5I_object (H5T_IEEE_F64LE_g = H5Tcopy (H5T_NATIVE_DOUBLE_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 8;
dt->u.atomic.offset = 0;
@@ -232,7 +242,7 @@ H5T_init_interface(void)
dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
/* IEEE 8-byte big-endian float */
- dt = H5I_object (H5T_IEEE_R64BE_g = H5Tcopy (H5T_NATIVE_DOUBLE));
+ dt = H5I_object (H5T_IEEE_F64BE_g = H5Tcopy (H5T_NATIVE_DOUBLE_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 8;
dt->u.atomic.offset = 0;
@@ -249,8 +259,36 @@ H5T_init_interface(void)
dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
- /* IEEE 2-byte little-endian signed integer */
- dt = H5I_object (H5T_IEEE_S16LE_g = H5Tcopy (H5T_NATIVE_INT));
+ /*------------------------------------------------------------
+ * Other "standard" types
+ *------------------------------------------------------------
+ */
+
+
+ /* 1-byte little-endian (endianness is irrelevant) signed integer */
+ dt = H5I_object (H5T_STD_I8LE_g = H5Tcopy (H5T_NATIVE_INT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->size = 1;
+ dt->u.atomic.offset = 0;
+ dt->u.atomic.prec = 8;
+ dt->u.atomic.order = H5T_ORDER_LE;
+ dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.msb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.u.i.sign = H5T_SGN_2;
+
+ /* 1-byte big-endian (endianness is irrelevant) signed integer */
+ dt = H5I_object (H5T_STD_I8BE_g = H5Tcopy (H5T_NATIVE_INT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->size = 1;
+ dt->u.atomic.offset = 0;
+ dt->u.atomic.prec = 8;
+ dt->u.atomic.order = H5T_ORDER_BE;
+ dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.msb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.u.i.sign = H5T_SGN_2;
+
+ /* 2-byte little-endian signed integer */
+ dt = H5I_object (H5T_STD_I16LE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 2;
dt->u.atomic.offset = 0;
@@ -260,8 +298,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_2;
- /* IEEE 2-byte big-endian signed integer */
- dt = H5I_object (H5T_IEEE_S16BE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 2-byte big-endian signed integer */
+ dt = H5I_object (H5T_STD_I16BE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 2;
dt->u.atomic.offset = 0;
@@ -271,8 +309,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_2;
- /* IEEE 4-byte little-endian signed integer */
- dt = H5I_object (H5T_IEEE_S32LE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 4-byte little-endian signed integer */
+ dt = H5I_object (H5T_STD_I32LE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 4;
dt->u.atomic.offset = 0;
@@ -282,8 +320,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_2;
- /* IEEE 4-byte big-endian signed integer */
- dt = H5I_object (H5T_IEEE_S32BE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 4-byte big-endian signed integer */
+ dt = H5I_object (H5T_STD_I32BE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 4;
dt->u.atomic.offset = 0;
@@ -293,8 +331,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_2;
- /* IEEE 8-byte little-endian signed integer */
- dt = H5I_object (H5T_IEEE_S64LE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 8-byte little-endian signed integer */
+ dt = H5I_object (H5T_STD_I64LE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 8;
dt->u.atomic.offset = 0;
@@ -304,8 +342,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_2;
- /* IEEE 8-byte big-endian signed integer */
- dt = H5I_object (H5T_IEEE_S64BE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 8-byte big-endian signed integer */
+ dt = H5I_object (H5T_STD_I64BE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 8;
dt->u.atomic.offset = 0;
@@ -315,8 +353,30 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_2;
- /* IEEE 2-byte little-endian unsigned integer */
- dt = H5I_object (H5T_IEEE_U16LE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 1-byte little-endian (endianness is irrelevant) unsigned integer */
+ dt = H5I_object (H5T_STD_U8LE_g = H5Tcopy (H5T_NATIVE_INT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->size = 1;
+ dt->u.atomic.offset = 0;
+ dt->u.atomic.prec = 8;
+ dt->u.atomic.order = H5T_ORDER_LE;
+ dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.msb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.u.i.sign = H5T_SGN_NONE;
+
+ /* 1-byte big-endian (endianness is irrelevant) unsigned integer */
+ dt = H5I_object (H5T_STD_U8BE_g = H5Tcopy (H5T_NATIVE_INT_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->size = 1;
+ dt->u.atomic.offset = 0;
+ dt->u.atomic.prec = 8;
+ dt->u.atomic.order = H5T_ORDER_BE;
+ dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.msb_pad = H5T_PAD_ZERO;
+ dt->u.atomic.u.i.sign = H5T_SGN_NONE;
+
+ /* 2-byte little-endian unsigned integer */
+ dt = H5I_object (H5T_STD_U16LE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 2;
dt->u.atomic.offset = 0;
@@ -326,8 +386,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_NONE;
- /* IEEE 2-byte big-endian unsigned integer */
- dt = H5I_object (H5T_IEEE_U16BE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 2-byte big-endian unsigned integer */
+ dt = H5I_object (H5T_STD_U16BE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 2;
dt->u.atomic.offset = 0;
@@ -337,8 +397,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_NONE;
- /* IEEE 4-byte little-endian unsigned integer */
- dt = H5I_object (H5T_IEEE_U32LE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 4-byte little-endian unsigned integer */
+ dt = H5I_object (H5T_STD_U32LE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 4;
dt->u.atomic.offset = 0;
@@ -348,8 +408,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_NONE;
- /* IEEE 4-byte big-endian unsigned integer */
- dt = H5I_object (H5T_IEEE_U32BE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 4-byte big-endian unsigned integer */
+ dt = H5I_object (H5T_STD_U32BE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 4;
dt->u.atomic.offset = 0;
@@ -359,8 +419,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_NONE;
- /* IEEE 8-byte little-endian unsigned integer */
- dt = H5I_object (H5T_IEEE_U64LE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 8-byte little-endian unsigned integer */
+ dt = H5I_object (H5T_STD_U64LE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 8;
dt->u.atomic.offset = 0;
@@ -370,8 +430,8 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_NONE;
- /* IEEE 8-byte big-endian unsigned integer */
- dt = H5I_object (H5T_IEEE_U64BE_g = H5Tcopy (H5T_NATIVE_INT));
+ /* 8-byte big-endian unsigned integer */
+ dt = H5I_object (H5T_STD_U64BE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = 8;
dt->u.atomic.offset = 0;
@@ -381,28 +441,79 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.i.sign = H5T_SGN_NONE;
+ /* 1-byte big endian bit field (order is irrelevant) */
+ dt = H5I_object (H5T_STD_B8BE_g = H5Tcopy (H5T_STD_U8BE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
- /*
- * Initialize pre-defined data types that don't depend on architecture.
+ /* 1-byte little-endian bit field (order is irrelevant) */
+ dt = H5I_object (H5T_STD_B8LE_g = H5Tcopy (H5T_STD_U8LE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+ /* 2-byte big endian bit field */
+ dt = H5I_object (H5T_STD_B16BE_g = H5Tcopy (H5T_STD_U16BE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+ /* 2-byte little-endian bit field */
+ dt = H5I_object (H5T_STD_B16LE_g = H5Tcopy (H5T_STD_U16LE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+ /* 4-byte big endian bit field */
+ dt = H5I_object (H5T_STD_B32BE_g = H5Tcopy (H5T_STD_U32BE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+ /* 4-byte little-endian bit field */
+ dt = H5I_object (H5T_STD_B32LE_g = H5Tcopy (H5T_STD_U32LE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+ /* 8-byte big endian bit field */
+ dt = H5I_object (H5T_STD_B64BE_g = H5Tcopy (H5T_STD_U64BE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+ /* 8-byte little-endian bit field */
+ dt = H5I_object (H5T_STD_B64LE_g = H5Tcopy (H5T_STD_U64LE_g));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_BITFIELD;
+
+
+
+ /*------------------------------------------------------------
+ * The Unix architecture for dates and times.
+ *------------------------------------------------------------
*/
- /* TIME */
- dt = H5MM_xcalloc(1, sizeof(H5T_t));
+ /* 4-byte time_t, big-endian */
+ dt = H5I_object (H5T_UNIX_D32BE_g = H5Tcopy (H5T_STD_U32BE));
dt->state = H5T_STATE_IMMUTABLE;
- H5F_addr_undef (&(dt->ent.header));
dt->type = H5T_TIME;
- dt->size = 1;
- dt->u.atomic.order = H5Tget_order(H5T_NATIVE_INT_g);
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8 * dt->size;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- if ((H5T_NATIVE_TIME_g = H5I_register(H5_DATATYPE, dt)) < 0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "can't initialize H5T layer");
- }
+
+ /* 4-byte time_t, little-endian */
+ dt = H5I_object (H5T_UNIX_D32LE_g = H5Tcopy (H5T_STD_U32LE));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_TIME;
+
+ /* 8-byte time_t, big-endian */
+ dt = H5I_object (H5T_UNIX_D64BE_g = H5Tcopy (H5T_STD_U64BE));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_TIME;
+
+ /* 8-byte time_t, little-endian */
+ dt = H5I_object (H5T_UNIX_D64LE_g = H5Tcopy (H5T_STD_U64LE));
+ dt->state = H5T_STATE_IMMUTABLE;
+ dt->type = H5T_TIME;
+
+ /*------------------------------------------------------------
+ * The `C' architecture
+ *------------------------------------------------------------
+ */
- /* STRING */
+ /* One-byte character string */
dt = H5MM_xcalloc(1, sizeof(H5T_t));
dt->state = H5T_STATE_IMMUTABLE;
H5F_addr_undef (&(dt->ent.header));
@@ -415,53 +526,35 @@ H5T_init_interface(void)
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
dt->u.atomic.u.s.cset = H5T_CSET_ASCII;
dt->u.atomic.u.s.pad = H5T_STR_NULL;
- if ((H5T_NATIVE_STRING_g = H5I_register(H5_DATATYPE, dt)) < 0) {
+ if ((H5T_C_S1_g = H5I_register(H5_DATATYPE, dt)) < 0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"can't initialize H5T layer");
}
- /* BITFIELD */
- dt = H5MM_xcalloc(1, sizeof(H5T_t));
- dt->state = H5T_STATE_IMMUTABLE;
- H5F_addr_undef (&(dt->ent.header));
- dt->type = H5T_BITFIELD;
- dt->size = 1;
- dt->u.atomic.order = H5Tget_order(H5T_NATIVE_INT_g);
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8 * dt->size;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- if ((H5T_NATIVE_BITFIELD_g = H5I_register(H5_DATATYPE, dt)) < 0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to initialize H5T layer");
- }
+ /*------------------------------------------------------------
+ * The `Fortran' architecture
+ *------------------------------------------------------------
+ */
- /* OPAQUE */
+ /* One-byte character string */
dt = H5MM_xcalloc(1, sizeof(H5T_t));
dt->state = H5T_STATE_IMMUTABLE;
H5F_addr_undef (&(dt->ent.header));
- dt->type = H5T_OPAQUE;
+ dt->type = H5T_STRING;
dt->size = 1;
dt->u.atomic.order = H5T_ORDER_NONE;
dt->u.atomic.offset = 0;
dt->u.atomic.prec = 8 * dt->size;
dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- if ((H5T_NATIVE_OPAQUE_g = H5I_register(H5_DATATYPE, dt)) < 0) {
+ dt->u.atomic.u.s.cset = H5T_CSET_ASCII;
+ dt->u.atomic.u.s.pad = H5T_STR_SPACE;
+ if ((H5T_FORTRAN_S1_g = H5I_register(H5_DATATYPE, dt)) < 0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to initialize H5T layer");
+ "can't initialize H5T layer");
}
/*
- * Define aliases.
- */
- H5T_NATIVE_HYPER_g = H5Tcopy(H5T_NATIVE_LLONG_g);
- H5Tlock(H5T_NATIVE_HYPER_g);
-
- H5T_NATIVE_UHYPER_g = H5Tcopy(H5T_NATIVE_ULLONG_g);
- H5Tlock(H5T_NATIVE_UHYPER_g);
-
- /*
* Register conversion functions beginning with the most general and
* ending with the most specific.
*/
@@ -485,13 +578,13 @@ H5T_init_interface(void)
"unable to register conversion function");
}
- if (H5Tregister_hard ("i32le_r64le", H5T_IEEE_U32LE_g, H5T_IEEE_R64LE_g,
- H5T_conv_i32le_r64le)<0) {
+ if (H5Tregister_hard ("u32le_f64le", H5T_STD_U32LE_g, H5T_IEEE_F64LE_g,
+ H5T_conv_i32le_f64le)<0) {
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to register conversion function");
}
- if (H5Tregister_hard ("i32le_r64le", H5T_IEEE_S32LE_g, H5T_IEEE_R64LE_g,
- H5T_conv_i32le_r64le)<0) {
+ if (H5Tregister_hard ("i32le_f64le", H5T_STD_I32LE_g, H5T_IEEE_F64LE_g,
+ H5T_conv_i32le_f64le)<0) {
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to register conversion function");
}
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 3f393d2..2d69dc1 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -54,7 +54,7 @@ H5T_conv_noop(hid_t __unused__ src_id, hid_t __unused__ dst_id,
switch (cdata->command) {
case H5T_CONV_INIT:
- /* Nothing to initialize */
+ cdata->need_bkg = H5T_BKG_NO;
break;
case H5T_CONV_CONV:
@@ -147,6 +147,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
"conversion not supported");
}
+ cdata->need_bkg = H5T_BKG_NO;
break;
case H5T_CONV_CONV:
@@ -578,6 +579,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
"destination size is too large");
}
+ cdata->need_bkg = H5T_BKG_NO;
break;
case H5T_CONV_FREE:
@@ -855,7 +857,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
/*-------------------------------------------------------------------------
- * Function: H5T_conv_i32le_r64le
+ * Function: H5T_conv_i32le_f64le
*
* Purpose: Converts 4-byte little-endian integers (signed or unsigned)
* to 8-byte litte-endian IEEE floating point.
@@ -872,7 +874,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
*-------------------------------------------------------------------------
*/
herr_t
-H5T_conv_i32le_r64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
+H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *buf, void __unused__ *bkg)
{
uint8 *s=NULL, *d=NULL; /*src and dst buf pointers */
@@ -886,11 +888,12 @@ H5T_conv_i32le_r64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
uintn exponent; /*exponent */
intn i; /*counter */
- FUNC_ENTER (H5T_conv_i32le_r64le, FAIL);
+ FUNC_ENTER (H5T_conv_i32le_f64le, FAIL);
switch (cdata->command) {
case H5T_CONV_INIT:
assert (sizeof(intn)>=4);
+ cdata->need_bkg = H5T_BKG_NO;
break;
case H5T_CONV_FREE:
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index fc67908..4257d52 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -127,7 +127,7 @@ herr_t H5T_conv_struct (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *_buf, void *bkg);
herr_t H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *_buf, void __unused__ *bkg);
-herr_t H5T_conv_i32le_r64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
+herr_t H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *_buf, void __unused__ *bkg);
/* Bit twiddling functions */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index bc1d9bd..56ad7c3 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -21,7 +21,6 @@
#include <H5Ipublic.h>
#define HOFFSET(S,M) (offsetof(S,M))
-#define HPOFFSET(P,M) ((size_t)((const char*)&(P->M)-(const char*)P))
/* These are the various classes of data types */
typedef enum H5T_class_t {
@@ -119,7 +118,166 @@ typedef struct H5T_cdata_t {
typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *buf, void *bkg);
-/* The predefined native types */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The IEEE floating point types in various byte orders.
+ */
+#define H5T_IEEE_F32BE (H5open(), H5T_IEEE_F32BE_g)
+#define H5T_IEEE_F32LE (H5open(), H5T_IEEE_F32LE_g)
+#define H5T_IEEE_F64BE (H5open(), H5T_IEEE_F64BE_g)
+#define H5T_IEEE_F64LE (H5open(), H5T_IEEE_F64LE_g)
+extern hid_t H5T_IEEE_F32BE_g;
+extern hid_t H5T_IEEE_F32LE_g;
+extern hid_t H5T_IEEE_F64BE_g;
+extern hid_t H5T_IEEE_F64LE_g;
+
+/*
+ * These are "standard" types. For instance, signed (2's complement) and
+ * unsigned integers of various sizes and byte orders.
+ */
+#define H5T_STD_I8BE (H5open(), H5T_STD_I8BE_g)
+#define H5T_STD_I8LE (H5open(), H5T_STD_I8LE_g)
+#define H5T_STD_I16BE (H5open(), H5T_STD_I16BE_g)
+#define H5T_STD_I16LE (H5open(), H5T_STD_I16LE_g)
+#define H5T_STD_I32BE (H5open(), H5T_STD_I32BE_g)
+#define H5T_STD_I32LE (H5open(), H5T_STD_I32LE_g)
+#define H5T_STD_I64BE (H5open(), H5T_STD_I64BE_g)
+#define H5T_STD_I64LE (H5open(), H5T_STD_I64LE_g)
+#define H5T_STD_U8BE (H5open(), H5T_STD_U8BE_g)
+#define H5T_STD_U8LE (H5open(), H5T_STD_U8LE_g)
+#define H5T_STD_U16BE (H5open(), H5T_STD_U16BE_g)
+#define H5T_STD_U16LE (H5open(), H5T_STD_U16LE_g)
+#define H5T_STD_U32BE (H5open(), H5T_STD_U32BE_g)
+#define H5T_STD_U32LE (H5open(), H5T_STD_U32LE_g)
+#define H5T_STD_U64BE (H5open(), H5T_STD_U64BE_g)
+#define H5T_STD_U64LE (H5open(), H5T_STD_U64LE_g)
+#define H5T_STD_B8BE (H5open(), H5T_STD_B8BE_g)
+#define H5T_STD_B8LE (H5open(), H5T_STD_B8LE_g)
+#define H5T_STD_B16BE (H5open(), H5T_STD_B16BE_g)
+#define H5T_STD_B16LE (H5open(), H5T_STD_B16LE_g)
+#define H5T_STD_B32BE (H5open(), H5T_STD_B32BE_g)
+#define H5T_STD_B32LE (H5open(), H5T_STD_B32LE_g)
+#define H5T_STD_B64BE (H5open(), H5T_STD_B64BE_g)
+#define H5T_STD_B64LE (H5open(), H5T_STD_B64LE_g)
+extern hid_t H5T_STD_I8BE_g;
+extern hid_t H5T_STD_I8LE_g;
+extern hid_t H5T_STD_I16BE_g;
+extern hid_t H5T_STD_I16LE_g;
+extern hid_t H5T_STD_I32BE_g;
+extern hid_t H5T_STD_I32LE_g;
+extern hid_t H5T_STD_I64BE_g;
+extern hid_t H5T_STD_I64LE_g;
+extern hid_t H5T_STD_U8BE_g;
+extern hid_t H5T_STD_U8LE_g;
+extern hid_t H5T_STD_U16BE_g;
+extern hid_t H5T_STD_U16LE_g;
+extern hid_t H5T_STD_U32BE_g;
+extern hid_t H5T_STD_U32LE_g;
+extern hid_t H5T_STD_U64BE_g;
+extern hid_t H5T_STD_U64LE_g;
+extern hid_t H5T_STD_B8BE_g;
+extern hid_t H5T_STD_B8LE_g;
+extern hid_t H5T_STD_B16BE_g;
+extern hid_t H5T_STD_B16LE_g;
+extern hid_t H5T_STD_B32BE_g;
+extern hid_t H5T_STD_B32LE_g;
+extern hid_t H5T_STD_B64BE_g;
+extern hid_t H5T_STD_B64LE_g;
+
+/*
+ * Types which are particular to Unix.
+ */
+#define H5T_UNIX_D32BE (H5open(), H5T_UNIX_D32BE_g)
+#define H5T_UNIX_D32LE (H5open(), H5T_UNIX_D32LE_g)
+#define H5T_UNIX_D64BE (H5open(), H5T_UNIX_D64BE_g)
+#define H5T_UNIX_D64LE (H5open(), H5T_UNIX_D64LE_g)
+extern hid_t H5T_UNIX_D32BE_g;
+extern hid_t H5T_UNIX_D32LE_g;
+extern hid_t H5T_UNIX_D64BE_g;
+extern hid_t H5T_UNIX_D64LE_g;
+
+/*
+ * Types particular to the C language. String types use `bytes' instead
+ * of `bits' as their size.
+ */
+#define H5T_C_S1 (H5open(), H5T_C_S1_g)
+extern hid_t H5T_C_S1_g;
+
+/*
+ * Types particular to Fortran.
+ */
+#define H5T_FORTRAN_S1 (H5open(), H5T_FORTRAN_S1_g)
+extern hid_t H5T_FORTRAN_S1_g;
+
+/*
+ * These types are for Intel CPU's. They are little endian with IEEE
+ * floating point.
+ */
+#define H5T_INTEL_I8 H5T_STD_I8LE
+#define H5T_INTEL_I16 H5T_STD_I16LE
+#define H5T_INTEL_I32 H5T_STD_I32LE
+#define H5T_INTEL_I64 H5T_STD_I64LE
+#define H5T_INTEL_U8 H5T_STD_U8LE
+#define H5T_INTEL_U16 H5T_STD_U16LE
+#define H5T_INTEL_U32 H5T_STD_U32LE
+#define H5T_INTEL_U64 H5T_STD_U64LE
+#define H5T_INTEL_B8 H5T_STD_B8LE
+#define H5T_INTEL_B16 H5T_STD_B16LE
+#define H5T_INTEL_B32 H5T_STD_B32LE
+#define H5T_INTEL_B64 H5T_STD_B64LE
+#define H5T_INTEL_F32 H5T_IEEE_F32LE
+#define H5T_INTEL_F64 H5T_IEEE_F64LE
+
+/*
+ * These types are for DEC Alpha CPU's. They are little endian with IEEE
+ * floating point.
+ */
+#define H5T_ALPHA_I8 H5T_STD_I8LE
+#define H5T_ALPHA_I16 H5T_STD_I16LE
+#define H5T_ALPHA_I32 H5T_STD_I32LE
+#define H5T_ALPHA_I64 H5T_STD_I64LE
+#define H5T_ALPHA_U8 H5T_STD_U8LE
+#define H5T_ALPHA_U16 H5T_STD_U16LE
+#define H5T_ALPHA_U32 H5T_STD_U32LE
+#define H5T_ALPHA_U64 H5T_STD_U64LE
+#define H5T_ALPHA_B8 H5T_STD_B8LE
+#define H5T_ALPHA_B16 H5T_STD_B16LE
+#define H5T_ALPHA_B32 H5T_STD_B32LE
+#define H5T_ALPHA_B64 H5T_STD_B64LE
+#define H5T_ALPHA_F32 H5T_IEEE_F32LE
+#define H5T_ALPHA_F64 H5T_IEEE_F64LE
+
+/*
+ * These types are for MIPS cpu's commonly used in SGI systems. They are big
+ * endian with IEEE floating point.
+ */
+#define H5T_MIPS_I8 H5T_STD_I8BE
+#define H5T_MIPS_I16 H5T_STD_I16BE
+#define H5T_MIPS_I32 H5T_STD_I32BE
+#define H5T_MIPS_I64 H5T_STD_I64BE
+#define H5T_MIPS_U8 H5T_STD_U8BE
+#define H5T_MIPS_U16 H5T_STD_U16BE
+#define H5T_MIPS_U32 H5T_STD_U32BE
+#define H5T_MIPS_U64 H5T_STD_U64BE
+#define H5T_MIPS_B8 H5T_STD_B8BE
+#define H5T_MIPS_B16 H5T_STD_B16BE
+#define H5T_MIPS_B32 H5T_STD_B32BE
+#define H5T_MIPS_B64 H5T_STD_B64BE
+#define H5T_MIPS_F32 H5T_IEEE_F32BE
+#define H5T_MIPS_F64 H5T_IEEE_F64BE
+
+/*
+ * The predefined native types. These are the types detected by H5detect and
+ * they violate the naming scheme a little. Instead of a class name,
+ * precision and byte order as the last component, they have a C-like type
+ * name. If the type begins with `U' then it is the unsigned version of the
+ * integer type; other integer types are signed. The type LLONG corresponds
+ * to C's `long long' and LDOUBLE is `long double' (these types might be the
+ * same as `LONG' and `DOUBLE' respectively.
+ */
#define H5T_NATIVE_CHAR (H5open(), H5T_NATIVE_CHAR_g)
#define H5T_NATIVE_UCHAR (H5open(), H5T_NATIVE_UCHAR_g)
#define H5T_NATIVE_SHORT (H5open(), H5T_NATIVE_SHORT_g)
@@ -130,46 +288,14 @@ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
#define H5T_NATIVE_ULONG (H5open(), H5T_NATIVE_ULONG_g)
#define H5T_NATIVE_LLONG (H5open(), H5T_NATIVE_LLONG_g)
#define H5T_NATIVE_ULLONG (H5open(), H5T_NATIVE_ULLONG_g)
-#define H5T_NATIVE_HYPER (H5open(), H5T_NATIVE_HYPER_g)
-#define H5T_NATIVE_UHYPER (H5open(), H5T_NATIVE_UHYPER_g)
-#define H5T_NATIVE_INT8 (H5open(), H5T_NATIVE_INT8_g)
-#define H5T_NATIVE_UINT8 (H5open(), H5T_NATIVE_UINT8_g)
-#define H5T_NATIVE_INT16 (H5open(), H5T_NATIVE_INT16_g)
-#define H5T_NATIVE_UINT16 (H5open(), H5T_NATIVE_UINT16_g)
-#define H5T_NATIVE_INT32 (H5open(), H5T_NATIVE_INT32_g)
-#define H5T_NATIVE_UINT32 (H5open(), H5T_NATIVE_UINT32_g)
-#define H5T_NATIVE_INT64 (H5open(), H5T_NATIVE_INT64_g)
-#define H5T_NATIVE_UINT64 (H5open(), H5T_NATIVE_UINT64_g)
#define H5T_NATIVE_FLOAT (H5open(), H5T_NATIVE_FLOAT_g)
#define H5T_NATIVE_DOUBLE (H5open(), H5T_NATIVE_DOUBLE_g)
-#define H5T_NATIVE_TIME (H5open(), H5T_NATIVE_TIME_g)
-#define H5T_NATIVE_STRING (H5open(), H5T_NATIVE_STRING_g)
-#define H5T_NATIVE_BITFIELD (H5open(), H5T_NATIVE_BITFIELD_g)
+#define H5T_NATIVE_LDOUBLE (H5open(), H5T_NATIVE_LDOUBLE_g)
+#define H5T_NATIVE_B8 (H5open(), H5T_NATIVE_B8_g)
+#define H5T_NATIVE_B16 (H5open(), H5T_NATIVE_B16_g)
+#define H5T_NATIVE_B32 (H5open(), H5T_NATIVE_B32_g)
+#define H5T_NATIVE_B64 (H5open(), H5T_NATIVE_B64_g)
#define H5T_NATIVE_OPAQUE (H5open(), H5T_NATIVE_OPAQUE_g)
-
-/* The predefined standard types */
-#define H5T_IEEE_R32LE (H5open(), H5T_IEEE_R32LE_g)
-#define H5T_IEEE_R32BE (H5open(), H5T_IEEE_R32BE_g)
-#define H5T_IEEE_R64LE (H5open(), H5T_IEEE_R64LE_g)
-#define H5T_IEEE_R64BE (H5open(), H5T_IEEE_R64BE_g)
-#define H5T_IEEE_U16LE (H5open(), H5T_IEEE_U16LE_g)
-#define H5T_IEEE_U16BE (H5open(), H5T_IEEE_U16BE_g)
-#define H5T_IEEE_U32LE (H5open(), H5T_IEEE_U32LE_g)
-#define H5T_IEEE_U32BE (H5open(), H5T_IEEE_U32BE_g)
-#define H5T_IEEE_U64LE (H5open(), H5T_IEEE_U64LE_g)
-#define H5T_IEEE_U64BE (H5open(), H5T_IEEE_U64BE_g)
-#define H5T_IEEE_S16LE (H5open(), H5T_IEEE_S16LE_g)
-#define H5T_IEEE_S16BE (H5open(), H5T_IEEE_S16BE_g)
-#define H5T_IEEE_S32LE (H5open(), H5T_IEEE_S32LE_g)
-#define H5T_IEEE_S32BE (H5open(), H5T_IEEE_S32BE_g)
-#define H5T_IEEE_S64LE (H5open(), H5T_IEEE_S64LE_g)
-#define H5T_IEEE_S64BE (H5open(), H5T_IEEE_S64BE_g)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Native types */
extern hid_t H5T_NATIVE_CHAR_g;
extern hid_t H5T_NATIVE_UCHAR_g;
extern hid_t H5T_NATIVE_SHORT_g;
@@ -177,45 +303,18 @@ extern hid_t H5T_NATIVE_USHORT_g;
extern hid_t H5T_NATIVE_INT_g;
extern hid_t H5T_NATIVE_UINT_g;
extern hid_t H5T_NATIVE_LONG_g;
-extern hid_t H5T_NATIVE_INT8_g;
-extern hid_t H5T_NATIVE_UINT8_g;
-extern hid_t H5T_NATIVE_INT16_g;
-extern hid_t H5T_NATIVE_UINT16_g;
-extern hid_t H5T_NATIVE_INT32_g;
-extern hid_t H5T_NATIVE_UINT32_g;
-extern hid_t H5T_NATIVE_INT64_g;
-extern hid_t H5T_NATIVE_UINT64_g;
extern hid_t H5T_NATIVE_ULONG_g;
extern hid_t H5T_NATIVE_LLONG_g;
extern hid_t H5T_NATIVE_ULLONG_g;
-extern hid_t H5T_NATIVE_HYPER_g;
-extern hid_t H5T_NATIVE_UHYPER_g;
extern hid_t H5T_NATIVE_FLOAT_g;
extern hid_t H5T_NATIVE_DOUBLE_g;
-extern hid_t H5T_NATIVE_TIME_g;
-extern hid_t H5T_NATIVE_STRING_g;
-extern hid_t H5T_NATIVE_BITFIELD_g;
+extern hid_t H5T_NATIVE_LDOUBLE_g;
+extern hid_t H5T_NATIVE_B8_g;
+extern hid_t H5T_NATIVE_B16_g;
+extern hid_t H5T_NATIVE_B32_g;
+extern hid_t H5T_NATIVE_B64_g;
extern hid_t H5T_NATIVE_OPAQUE_g;
-/* Standard types */
-extern hid_t H5T_IEEE_R32LE_g; /*IEEE 4-byte little-endian float */
-extern hid_t H5T_IEEE_R32BE_g; /*IEEE 4-byte big-endian float */
-extern hid_t H5T_IEEE_R64LE_g; /*IEEE 8-byte little-endian float */
-extern hid_t H5T_IEEE_R64BE_g; /*IEEE 8-byte big endian float */
-extern hid_t H5T_IEEE_U16LE_g; /*IEEE 2-byte little-endian unsigned int */
-extern hid_t H5T_IEEE_U16BE_g; /*IEEE 2-byte big-endian unsigned int */
-extern hid_t H5T_IEEE_U32LE_g; /*IEEE 4-byte little-endian unsigned int */
-extern hid_t H5T_IEEE_U32BE_g; /*IEEE 4-byte big-endian unsigned int */
-extern hid_t H5T_IEEE_U64LE_g; /*IEEE 8-byte little-endian unsigned int */
-extern hid_t H5T_IEEE_U64BE_g; /*IEEE 8-byte big-endian unsigned int */
-extern hid_t H5T_IEEE_S16LE_g; /*IEEE 2-byte little-endian signed int */
-extern hid_t H5T_IEEE_S16BE_g; /*IEEE 2-byte big-endian signed int */
-extern hid_t H5T_IEEE_S32LE_g; /*IEEE 4-byte little-endian signed int */
-extern hid_t H5T_IEEE_S32BE_g; /*IEEE 4-byte big-endian signed int */
-extern hid_t H5T_IEEE_S64LE_g; /*IEEE 8-byte little-endian signed int */
-extern hid_t H5T_IEEE_S64BE_g; /*IEEE 8-byte big-endian signed int */
-
-
/* Operations defined on all data types */
hid_t H5Topen (hid_t loc_id, const char *name);
diff --git a/src/H5detect.c b/src/H5detect.c
index 6b47a85..119822c 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -45,6 +45,7 @@ static const char *FileHeader = "\n\
#ifndef MIN
# define MIN(X,Y) ((X)<(Y)?(X):(Y))
+# define MIN3(X,Y,Z) MIN(X,MIN(Y,Z))
#endif
/*
@@ -53,13 +54,14 @@ static const char *FileHeader = "\n\
*/
typedef struct detected_t {
const char *varname;
- int size;
- int padding;
+ int size; /*total byte size*/
+ int precision; /*meaningful bits*/
+ int offset; /*bit offset to meaningful bits*/
int perm[32];
int sign;
int mpos, msize, imp;
int epos, esize;
- unsigned long bias;
+ unsigned long bias;
} detected_t;
static void print_results(int nd, detected_t *d);
@@ -68,10 +70,65 @@ static void print_known_formats(detected_t *);
static int byte_cmp(int, void *, void *);
static int bit_cmp(int, int *, void *, void *);
static void fix_order(int, int, int, int *, const char **);
-static void fix_padding(detected_t *);
static int imp_bit(int, int *, void *, void *);
static unsigned long find_bias(int, int, int, int *, void *);
+static void precision (detected_t*);
static void print_header(void);
+
+
+/*-------------------------------------------------------------------------
+ * Function: precision
+ *
+ * Purpose: Determine the precision and offset.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, June 18, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+precision (detected_t *d)
+{
+ int n;
+
+ if (0==d->msize) {
+ /*
+ * An integer. The permutation can have negative values at the
+ * beginning or end which represent padding of bytes. We must adjust
+ * the precision and offset accordingly.
+ */
+ if (d->perm[0] < 0) {
+ /*
+ * Lower addresses are padded.
+ */
+ for (n=0; n<d->size && d->perm[n]<0; n++) /*void*/;
+ d->precision = 8*(d->size-n);
+ d->offset = 0;
+ } else if (d->perm[d->size - 1] < 0) {
+ /*
+ * Higher addresses are padded.
+ */
+ for (n=0; n<d->size && d->perm[d->size-(n+1)]; n++) /*void*/;
+ d->precision = 8*(d->size-n);
+ d->offset = 8*n;
+ } else {
+ /*
+ * No padding.
+ */
+ d->precision = 8*d->size;
+ d->offset = 0;
+ }
+ } else {
+ /* A floating point */
+ d->offset = MIN3 (d->mpos, d->epos, d->sign);
+ d->precision = d->msize + d->esize + 1;
+ }
+}
+
/*-------------------------------------------------------------------------
* For convenience, we place here in a table descriptions of all
@@ -98,31 +155,31 @@ static detected_t Known[] =
{
/* Single-byte quantities */
{"Byte addressable",
- 1, 0, LE_1, INTEGER},
+ 1, 8, 0, LE_1, INTEGER},
/* Little-endian integer */
{"Little-endian",
- 2, 0, LE_2, INTEGER},
+ 2, 16, 0, LE_2, INTEGER},
{"Little-endian",
- 4, 0, LE_4, INTEGER},
+ 4, 32, 0, LE_4, INTEGER},
/* Big-endian integer */
{"Big-endian",
- 2, 0, BE_2, INTEGER},
+ 2, 16, 0, BE_2, INTEGER},
{"Big-endian",
- 4, 0, BE_4, INTEGER},
+ 4, 32, 0, BE_4, INTEGER},
/* Little-endian IEEE floating-point */
{"Little-endian IEEE",
- 4, 0, LE_4, 31, 0, 23, 1, 23, 8, 127},
+ 4, 32, 0, LE_4, 31, 0, 23, 1, 23, 8, 127},
{"Little-endian IEEE",
- 8, 0, LE_8, 63, 0, 52, 1, 52, 11, 1023},
+ 8, 64, 0, LE_8, 63, 0, 52, 1, 52, 11, 1023},
/* Big-endian IEEE floating-point */
{"Big-endian IEEE",
- 4, 0, BE_4, 31, 0, 23, 1, 23, 8, 127},
+ 4, 32, 0, BE_4, 31, 0, 23, 1, 23, 8, 127},
{"Big-endian IEEE",
- 8, 0, BE_8, 63, 0, 52, 1, 52, 11, 1023},
+ 8, 64, 0, BE_8, 63, 0, 52, 1, 52, 11, 1023},
};
/*-------------------------------------------------------------------------
@@ -167,8 +224,8 @@ static detected_t Known[] =
assert (_j<(signed)sizeof(TYPE)); \
INFO.perm[_i] = _j; \
} \
- fix_padding (&(INFO)); \
INFO.sign = ('U'!=*(#VAR)); \
+ precision (&(INFO)); \
}
/*-------------------------------------------------------------------------
@@ -205,7 +262,6 @@ static detected_t Known[] =
memset (&INFO, 0, sizeof(INFO)); \
INFO.varname = #VAR; \
INFO.size = sizeof(TYPE); \
- INFO.padding = 0; \
\
/* Byte Order */ \
for (_i=0,_v1=0.0,_v2=1.0; _i<(signed)sizeof(TYPE); _i++) { \
@@ -245,6 +301,7 @@ static detected_t Known[] =
\
_v1 = 1.0; \
INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.imp, INFO.perm, &_v1); \
+ precision (&(INFO)); \
}
/*-------------------------------------------------------------------------
@@ -266,7 +323,7 @@ static void
print_results(int nd, detected_t *d)
{
- int i;
+ int i;
/* Include files */
printf("\
@@ -311,13 +368,15 @@ H5T_init (void)\n\
dt->type = H5T_%s;\n\
dt->size = %d;\n\
dt->u.atomic.order = H5T_ORDER_%s;\n\
+ dt->u.atomic.offset = %d;\n\
dt->u.atomic.prec = %d;\n\
dt->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\
dt->u.atomic.msb_pad = H5T_PAD_ZERO;\n",
- d[i].msize ? "FLOAT" : "INTEGER", /*class */
- d[i].size + abs(d[i].padding), /*size */
- d[i].perm[0] ? "BE" : "LE", /*byte order */
- 8 * d[i].size); /*precision */
+ d[i].msize ? "FLOAT" : "INTEGER",/*class */
+ d[i].size, /*size */
+ d[i].perm[0] ? "BE" : "LE", /*byte order */
+ d[i].offset, /*offset */
+ d[i].precision); /*precision */
if (0 == d[i].msize) {
/* The part unique to fixed point types */
@@ -352,11 +411,11 @@ H5T_init (void)\n\
\"failure\");\n\
}\n",
d[i].varname);
-
}
printf(" FUNC_LEAVE (SUCCEED);\n}\n");
}
+
/*-------------------------------------------------------------------------
* Function: iprint
@@ -377,50 +436,45 @@ H5T_init (void)\n\
static void
iprint(detected_t *d)
{
-
- int i, j, k;
-
- /*
- * Print the byte ordering above the bit fields.
- */
- printf(" * ");
- for (i = d->size - 1; i >= 0; --i) {
- printf("%4d", d->perm[i]);
- if (i > 0)
- fputs(" ", stdout);
- if (0 == i % 4)
- putchar(' ');
- }
- putchar('\n');
-
- /*
- * Print the bit fields
- */
- printf(" * ");
- for (i = d->size - 1, k = d->size * 8 - 1; i >= 0; --i) {
- for (j = 7; j >= 0; --j) {
- if (k == d->sign && d->msize) {
- putchar('S');
- } else if (k >= d->epos && k < d->epos + d->esize) {
- putchar('E');
- } else if (k >= d->mpos && k < d->mpos + d->msize) {
- putchar('M');
- } else if (d->msize) {
- putchar('?'); /*unknown floating point bit */
- } else if (d->sign) {
- putchar('I');
- } else {
- putchar('U');
- }
- --k;
- }
- if (i > 0) {
- putchar(' ');
- if (0 == i % 4)
- putchar(' ');
+ int i, j, k, pass;
+
+ for (pass=(d->size-1)/4; pass>=0; --pass) {
+ /*
+ * Print the byte ordering above the bit fields.
+ */
+ printf(" * ");
+ for (i=MIN(pass*4+3,d->size-1); i>=pass*4; --i) {
+ printf ("%4d", d->perm[i]);
+ if (i>pass*4) fputs (" ", stdout);
}
+
+ /*
+ * Print the bit fields
+ */
+ printf("\n * ");
+ for (i=MIN(pass*4+3,d->size-1),
+ k=MIN(pass*32+31,8*d->size-1);
+ i>=pass*4; --i) {
+ for (j=7; j>=0; --j) {
+ if (k==d->sign && d->msize) {
+ putchar('S');
+ } else if (k>=d->epos && k<d->epos+d->esize) {
+ putchar('E');
+ } else if (k>=d->mpos && k<d->mpos+d->msize) {
+ putchar('M');
+ } else if (d->msize) {
+ putchar('?'); /*unknown floating point bit */
+ } else if (d->sign) {
+ putchar('I');
+ } else {
+ putchar('U');
+ }
+ --k;
+ }
+ if (i>pass*4) putchar(' ');
+ }
+ putchar('\n');
}
- putchar('\n');
/*
* Is there an implicit bit in the mantissa.
@@ -429,6 +483,7 @@ iprint(detected_t *d)
printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no");
}
}
+
/*-------------------------------------------------------------------------
* Function: print_known_formats
@@ -450,36 +505,30 @@ static void
print_known_formats(detected_t *d)
{
- int i, j, diff;
- int n = sizeof(Known) / sizeof(Known[0]);
+ int i, j, diff;
+ int n = sizeof(Known) / sizeof(Known[0]);
- for (i = 0; i < n; i++) {
- if (d->size != Known[i].size)
- continue;
+ for (i=0; i<n; i++) {
+ if (d->size != Known[i].size) continue;
+ if (d->precision != Known[i].precision) continue;
+ if (d->offset != Known[i].offset) continue;
for (j = diff = 0; !diff && j < d->size; j++) {
- if (d->perm[j] != Known[i].perm[j])
- diff = 1;
+ if (d->perm[j] != Known[i].perm[j]) diff = 1;
}
- if (diff)
- continue;
+ if (diff) continue;
/* if (d->sign != Known[i].sign) continue; */
- if (d->mpos != Known[i].mpos)
- continue;
- if (d->msize != Known[i].msize)
- continue;
- if (d->imp != Known[i].imp)
- continue;
- if (d->epos != Known[i].epos)
- continue;
- if (d->esize != Known[i].esize)
- continue;
- if (d->bias != Known[i].bias)
- continue;
+ if (d->mpos != Known[i].mpos) continue;
+ if (d->msize != Known[i].msize) continue;
+ if (d->imp != Known[i].imp) continue;
+ if (d->epos != Known[i].epos) continue;
+ if (d->esize != Known[i].esize) continue;
+ if (d->bias != Known[i].bias) continue;
printf(" * %s\n", Known[i].varname);
}
}
+
/*-------------------------------------------------------------------------
* Function: byte_cmp
@@ -503,16 +552,14 @@ print_known_formats(detected_t *d)
static int
byte_cmp(int n, void *_a, void *_b)
{
+ register int i;
+ unsigned char *a = (unsigned char *) _a;
+ unsigned char *b = (unsigned char *) _b;
- register int i;
- unsigned char *a = (unsigned char *) _a;
- unsigned char *b = (unsigned char *) _b;
-
- for (i = 0; i < n; i++)
- if (a[i] != b[i])
- return i;
+ for (i = 0; i < n; i++) if (a[i] != b[i]) return i;
return -1;
}
+
/*-------------------------------------------------------------------------
* Function: bit_cmp
@@ -537,24 +584,23 @@ byte_cmp(int n, void *_a, void *_b)
static int
bit_cmp(int nbytes, int *perm, void *_a, void *_b)
{
-
- int i, j;
- unsigned char *a = (unsigned char *) _a;
- unsigned char *b = (unsigned char *) _b;
- unsigned char aa, bb;
+ int i, j;
+ unsigned char *a = (unsigned char *) _a;
+ unsigned char *b = (unsigned char *) _b;
+ unsigned char aa, bb;
for (i = 0; i < nbytes; i++) {
assert(perm[i] < nbytes);
if ((aa = a[perm[i]]) != (bb = b[perm[i]])) {
for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) {
- if ((aa & 1) != (bb & 1))
- return i * 8 + j;
+ if ((aa & 1) != (bb & 1)) return i * 8 + j;
}
assert("INTERNAL ERROR" && 0);
}
}
return -1;
}
+
/*-------------------------------------------------------------------------
* Function: fix_order
@@ -580,8 +626,7 @@ bit_cmp(int nbytes, int *perm, void *_a, void *_b)
static void
fix_order(int n, int first, int last, int *perm, const char **mesg)
{
-
- int i;
+ int i;
if (first + 1 < last) {
/*
@@ -591,27 +636,22 @@ fix_order(int n, int first, int last, int *perm, const char **mesg)
/*
* Little endian.
*/
- if (mesg)
- *mesg = "Little-endian";
- for (i = 0; i < n; i++)
- perm[i] = i;
+ if (mesg) *mesg = "Little-endian";
+ for (i = 0; i < n; i++) perm[i] = i;
- } else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) {
+ } else if (perm[last] > perm[last-1] && perm[last-1] > perm[last-2]) {
/*
* Big endian.
*/
- if (mesg)
- *mesg = "Big-endian";
- for (i = 0; i < n; i++)
- perm[i] = (n - 1) - i;
+ if (mesg) *mesg = "Big-endian";
+ for (i = 0; i < n; i++) perm[i] = (n - 1) - i;
} else {
/*
* Bi-endian machines like VAX.
*/
assert(0 == n / 2);
- if (mesg)
- *mesg = "VAX";
+ if (mesg) *mesg = "VAX";
for (i = 0; i < n; i += 2) {
perm[i] = (n - 2) - i;
perm[i + 1] = (n - 1) - i;
@@ -623,67 +663,7 @@ fix_order(int n, int first, int last, int *perm, const char **mesg)
exit(1);
}
}
-
-/*-------------------------------------------------------------------------
- * Function: fix_padding
- *
- * Purpose: The permutation can have negative values at the beginning
- * or end which represent zero padding. The amount of padding
- * is subtracted from the size, the negative values are removed
- * from the permutation, and the `padding' field is set to an
- * appropriate value.
- *
- * If N bytes of padding appear to the left (lower address) of
- * the value, then `padding=N'. If N bytes of padding appear
- * to the right of the value then `padding=(-N)'.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Nov 4 1996
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void
-fix_padding(detected_t *d)
-{
-
- int i, n;
- if (d->perm[0] < 0) {
- /*
- * Left padding.
- */
- for (n = 0; n < d->size && d->perm[n] < 0; n++) /*void */
- ;
- for (i = n; i < d->size; i++)
- d->perm[i - n] = d->perm[i];
- for (i = d->size - n; i < d->size; i++)
- d->perm[i] = 0;
- d->padding = n;
- d->size -= n;
-
- } else if (d->perm[d->size - 1] < 0) {
- /*
- * Right padding.
- */
- for (n = 0; n < d->size && d->perm[d->size - (n + 1)]; n++) /*void */
- ;
- for (i = d->size - n; i < d->size; i++)
- d->perm[i] = 0;
- d->padding = -n;
- d->size -= n;
-
- } else {
- /*
- * No padding.
- */
- d->padding = 0;
- }
-}
/*-------------------------------------------------------------------------
* Function: imp_bit
@@ -724,11 +704,10 @@ fix_padding(detected_t *d)
static int
imp_bit(int n, int *perm, void *_a, void *_b)
{
-
- unsigned char *a = (unsigned char *) _a;
- unsigned char *b = (unsigned char *) _b;
- int changed, major, minor;
- int msmb; /*most significant mantissa bit */
+ unsigned char *a = (unsigned char *) _a;
+ unsigned char *b = (unsigned char *) _b;
+ int changed, major, minor;
+ int msmb; /*most significant mantissa bit */
/*
* Look for the least significant bit that has changed between
@@ -748,6 +727,7 @@ imp_bit(int n, int *perm, void *_a, void *_b)
return (a[perm[major]] >> minor) & 0x01 ? 0 : 1;
}
+
/*-------------------------------------------------------------------------
* Function: find_bias
@@ -774,10 +754,9 @@ imp_bit(int n, int *perm, void *_a, void *_b)
static unsigned long
find_bias(int epos, int esize, int imp, int *perm, void *_a)
{
-
- unsigned char *a = (unsigned char *) _a;
- unsigned char mask;
- unsigned long b, shift = 0, nbits, bias = 0;
+ unsigned char *a = (unsigned char *) _a;
+ unsigned char mask;
+ unsigned long b, shift = 0, nbits, bias = 0;
while (esize > 0) {
nbits = MIN(esize, (8 - epos % 8));
@@ -792,6 +771,7 @@ find_bias(int epos, int esize, int imp, int *perm, void *_a)
return bias - (imp ? 0 : 1);
}
+
/*-------------------------------------------------------------------------
* Function: print_header
@@ -866,20 +846,20 @@ bit.\n";
*/
#ifdef HAVE_GETPWUID
{
- size_t n;
- char *comma;
- if ((pwd = getpwuid(getuid()))) {
- if ((comma = strchr(pwd->pw_gecos, ','))) {
- n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos));
- strncpy(real_name, pwd->pw_gecos, n);
- real_name[n] = '\0';
- } else {
- strncpy(real_name, pwd->pw_gecos, sizeof(real_name));
- real_name[sizeof(real_name) - 1] = '\0';
- }
- } else {
- real_name[0] = '\0';
- }
+ size_t n;
+ char *comma;
+ if ((pwd = getpwuid(getuid()))) {
+ if ((comma = strchr(pwd->pw_gecos, ','))) {
+ n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos));
+ strncpy(real_name, pwd->pw_gecos, n);
+ real_name[n] = '\0';
+ } else {
+ strncpy(real_name, pwd->pw_gecos, sizeof(real_name));
+ real_name[sizeof(real_name) - 1] = '\0';
+ }
+ } else {
+ real_name[0] = '\0';
+ }
}
#else
real_name[0] = '\0';
@@ -907,21 +887,16 @@ bit.\n";
month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year);
if (pwd || real_name[0] || host_name[0]) {
printf(" *\t\t\t");
- if (real_name[0])
- printf("%s <", real_name);
- if (pwd)
- fputs(pwd->pw_name, stdout);
- if (host_name[0])
- printf("@%s", host_name);
- if (real_name[0])
- printf(">");
+ if (real_name[0]) printf("%s <", real_name);
+ if (pwd) fputs(pwd->pw_name, stdout);
+ if (host_name[0]) printf("@%s", host_name);
+ if (real_name[0]) printf(">");
putchar('\n');
}
printf(" *\n * Purpose:\t\t");
for (s = purpose; *s; s++) {
putchar(*s);
- if ('\n' == *s && s[1])
- printf(" *\t\t\t");
+ if ('\n' == *s && s[1]) printf(" *\t\t\t");
}
printf(" *\n * Modifications:\n *\n");
@@ -929,11 +904,11 @@ bit.\n";
printf(" *\tIt was generated by code in `H5detect.c'.\n");
printf(" *\n *");
- for (i = 0; i < 73; i++)
- putchar('-');
+ for (i = 0; i < 73; i++) putchar('-');
printf("\n */\n\n");
}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -955,36 +930,25 @@ bit.\n";
int
main(void)
{
- detected_t d[MAXDETECT];
- int nd = 0;
+ detected_t d[MAXDETECT];
+ int nd = 0;
print_header();
- DETECT_I(signed char, CHAR, 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(long long, LLONG, d[nd]);
- nd++;
- DETECT_I(unsigned long long, ULLONG, d[nd]);
- nd++;
- DETECT_F(float, FLOAT, d[nd]);
- nd++;
- DETECT_F(double, DOUBLE, d[nd]);
- nd++;
-
- print_results(nd, d);
+ DETECT_I (signed char, CHAR, 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 (long long, LLONG, d[nd]); nd++;
+ DETECT_I (unsigned long long, ULLONG, d[nd]); nd++;
+ DETECT_F (float, FLOAT, d[nd]); nd++;
+ DETECT_F (double, DOUBLE, d[nd]); nd++;
+ DETECT_F (long double, LDOUBLE, d[nd]); nd++;
+
+ print_results (nd, d);
return 0;
}
diff --git a/src/h5ls.c b/src/h5ls.c
index c1d6965..1766983 100644
--- a/src/h5ls.c
+++ b/src/h5ls.c
@@ -55,7 +55,7 @@ list_attr (hid_t obj, const char *attr_name, void __unused__ *op_data)
if ((attr = H5Aopen_name (obj, attr_name))) {
hid_t space = H5Aget_space (attr);
hsize_t size[64];
- int ndims = H5Sget_dims (space, size);
+ int ndims = H5Sget_dims (space, size, NULL);
H5Sclose (space);
printf (" {");
for (i=0; i<ndims; i++) {
@@ -113,7 +113,7 @@ list (hid_t group, const char *name, void __unused__ *op_data)
if ((obj=H5Dopen (group, name))>=0) {
hsize_t size[64];
hid_t space = H5Dget_space (obj);
- int ndims = H5Sget_dims (space, size);
+ int ndims = H5Sget_dims (space, size, NULL);
printf ("Dataset {");
for (i=0; i<ndims; i++) {
HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]);