summaryrefslogtreecommitdiffstats
path: root/src/H5Tdbg.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
commite767f44e953047297fece364218147c908e8b585 (patch)
treed4b6909f14b78bb732b6947adc46ac3cd3ca54f6 /src/H5Tdbg.c
parent949649a2b6e00297cbdc49437e70a27e455e92d2 (diff)
parenta08ab621febde7b09e4d86eab80cb029c123e9f6 (diff)
downloadhdf5-e767f44e953047297fece364218147c908e8b585.zip
hdf5-e767f44e953047297fece364218147c908e8b585.tar.gz
hdf5-e767f44e953047297fece364218147c908e8b585.tar.bz2
Merge remote-tracking branch 'origin/develop' into monotonic_timer
Diffstat (limited to 'src/H5Tdbg.c')
-rw-r--r--src/H5Tdbg.c185
1 files changed, 89 insertions, 96 deletions
diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c
index e20113e..693174a 100644
--- a/src/H5Tdbg.c
+++ b/src/H5Tdbg.c
@@ -32,9 +32,9 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Tpkg.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Tpkg.h" /* Datatypes */
/****************/
@@ -74,28 +74,21 @@
/*-------------------------------------------------------------------------
- * Function: H5T__print_stats
+ * Function: H5T__print_stats
*
- * Purpose: Print statistics about a conversion path. Statistics are
- * printed only if all the following conditions are true:
+ * Purpose: Print statistics about a conversion path. Statistics are
+ * printed only if all the following conditions are true:
*
- * 1. The library was compiled with H5T_DEBUG defined.
- * 2. Data type debugging is turned on at run time.
- * 3. The path was called at least one time.
+ * 1. The library was compiled with H5T_DEBUG defined.
+ * 2. Data type debugging is turned on at run time.
+ * 3. The path was called at least one time.
*
- * The optional NPRINT argument keeps track of the number of
- * conversions paths for which statistics have been shown. If
- * its value is zero then table headers are printed before the
- * first line of output.
+ * The optional NPRINT argument keeps track of the number of
+ * conversions paths for which statistics have been shown. If
+ * its value is zero then table headers are printed before the
+ * first line of output.
*
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Robb Matzke
- * Monday, December 14, 1998
- *
- * Modifications:
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -121,9 +114,9 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/*
if(path->src && path->dst)
nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst));
- else if(path->src)
+ else if (path->src)
nbytes = H5T_get_size(path->src);
- else if(path->dst)
+ else if (path->dst)
nbytes = H5T_get_size(path->dst);
else
nbytes = 0;
@@ -146,24 +139,20 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/*
/*-------------------------------------------------------------------------
- * Function: H5T_debug
- *
- * Purpose: Prints information about a data type.
+ * Function: H5T_debug
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Prints information about a data type.
*
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5T_debug(const H5T_t *dt, FILE *stream)
{
- const char *s1 = "", *s2 = "";
- unsigned i;
+ const char *s1 = "";
+ const char *s2 = "";
+ unsigned i;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -172,7 +161,7 @@ H5T_debug(const H5T_t *dt, FILE *stream)
HDassert(dt);
HDassert(stream);
- switch(dt->shared->type) {
+ switch (dt->shared->type) {
case H5T_NO_CLASS:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class");
break;
@@ -222,9 +211,9 @@ H5T_debug(const H5T_t *dt, FILE *stream)
default:
s1 = "";
break;
- } /* end switch */
+ } /* end switch */
- switch(dt->shared->state) {
+ switch (dt->shared->state) {
case H5T_STATE_TRANSIENT:
s2 = "[transient]";
break;
@@ -246,14 +235,14 @@ H5T_debug(const H5T_t *dt, FILE *stream)
break;
default:
HDassert(0 && "This Should never be executed!");
- } /* end switch */
+ } /* end switch */
- fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size));
+ HDfprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size));
- if(H5T_IS_ATOMIC(dt->shared)) {
- uint64_t tmp;
+ if (H5T_IS_ATOMIC(dt->shared)) {
+ uint64_t tmp;
- switch(dt->shared->u.atomic.order) {
+ switch (dt->shared->u.atomic.order) {
case H5T_ORDER_ERROR:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "order error");
break;
@@ -278,17 +267,16 @@ H5T_debug(const H5T_t *dt, FILE *stream)
default:
s1 = "order?";
break;
- } /* end switch */
+ } /* end switch */
+
+ HDfprintf(stream, ", %s", s1);
- fprintf(stream, ", %s", s1);
+ if (dt->shared->u.atomic.offset)
+ HDfprintf(stream, ", offset=%lu", (unsigned long) (dt->shared->u.atomic.offset));
+ if (dt->shared->u.atomic.prec != 8 * dt->shared->size)
+ HDfprintf(stream, ", prec=%lu", (unsigned long) (dt->shared->u.atomic.prec));
- if(dt->shared->u.atomic.offset)
- fprintf(stream, ", offset=%lu",
- (unsigned long) (dt->shared->u.atomic.offset));
- if(dt->shared->u.atomic.prec != 8 * dt->shared->size)
- fprintf(stream, ", prec=%lu",
- (unsigned long) (dt->shared->u.atomic.prec));
- switch(dt->shared->type) {
+ switch (dt->shared->type) {
case H5T_NO_CLASS:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class");
break;
@@ -314,7 +302,7 @@ H5T_debug(const H5T_t *dt, FILE *stream)
} /* end switch */
if(s1)
- fprintf(stream, ", %s", s1);
+ HDfprintf(stream, ", %s", s1);
break;
case H5T_FLOAT:
@@ -340,23 +328,24 @@ H5T_debug(const H5T_t *dt, FILE *stream)
break;
} /* end switch */
- fprintf(stream, ", sign=%lu+1",
+ HDfprintf(stream, ", sign=%lu+1",
(unsigned long)(dt->shared->u.atomic.u.f.sign));
- fprintf(stream, ", mant=%lu+%lu (%s)",
+ HDfprintf(stream, ", mant=%lu+%lu (%s)",
(unsigned long)(dt->shared->u.atomic.u.f.mpos),
(unsigned long)(dt->shared->u.atomic.u.f.msize), s1);
- fprintf(stream, ", exp=%lu+%lu",
+ HDfprintf(stream, ", exp=%lu+%lu",
(unsigned long)(dt->shared->u.atomic.u.f.epos),
(unsigned long)(dt->shared->u.atomic.u.f.esize));
tmp = dt->shared->u.atomic.u.f.ebias >> 32;
- if(tmp) {
+ if (tmp) {
size_t hi = (size_t)tmp;
size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff);
- fprintf(stream, " bias=0x%08lx%08lx",
+ HDfprintf(stream, " bias=0x%08lx%08lx",
(unsigned long)hi, (unsigned long)lo);
- } else {
+ }
+ else {
size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff);
- fprintf(stream, " bias=0x%08lx", (unsigned long)lo);
+ HDfprintf(stream, " bias=0x%08lx", (unsigned long)lo);
}
break;
@@ -373,69 +362,73 @@ H5T_debug(const H5T_t *dt, FILE *stream)
default:
/* No additional info */
break;
- } /* end switch */
- } else if(H5T_COMPOUND == dt->shared->type) {
- /* Compound data type */
- for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
- fprintf(stream, "\n\"%s\" @%lu",
- dt->shared->u.compnd.memb[i].name,
- (unsigned long)(dt->shared->u.compnd.memb[i].offset));
- fprintf(stream, " ");
- H5T_debug(dt->shared->u.compnd.memb[i].type, stream);
- } /* end for */
- fprintf(stream, "\n");
- } else if(H5T_VLEN == dt->shared->type) {
- switch(dt->shared->u.vlen.loc) {
+ } /* end switch */
+ }
+ else if (H5T_COMPOUND == dt->shared->type) {
+ /* Compound data type */
+ for (i = 0; i < dt->shared->u.compnd.nmembs; i++) {
+ HDfprintf(stream, "\n\"%s\" @%lu",
+ dt->shared->u.compnd.memb[i].name,
+ (unsigned long)(dt->shared->u.compnd.memb[i].offset));
+ HDfprintf(stream, " ");
+ H5T_debug(dt->shared->u.compnd.memb[i].type, stream);
+ } /* end for */
+ HDfprintf(stream, "\n");
+ }
+ else if (H5T_VLEN == dt->shared->type) {
+ switch (dt->shared->u.vlen.loc) {
case H5T_LOC_BADLOC:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype location");
break;
case H5T_LOC_MEMORY:
- fprintf(stream, ", loc=memory");
+ HDfprintf(stream, ", loc=memory");
break;
case H5T_LOC_DISK:
- fprintf(stream, ", loc=disk");
+ HDfprintf(stream, ", loc=disk");
break;
case H5T_LOC_MAXLOC:
default:
- fprintf(stream, ", loc=UNKNOWN");
+ HDfprintf(stream, ", loc=UNKNOWN");
break;
} /* end switch */
- if(H5T_IS_VL_STRING(dt->shared))
+ if (H5T_IS_VL_STRING(dt->shared))
/* Variable length string datatype */
- fprintf(stream, ", variable-length");
+ HDfprintf(stream, ", variable-length");
else {
/* Variable length sequence datatype */
- fprintf(stream, " VLEN ");
+ HDfprintf(stream, " VLEN ");
H5T_debug(dt->shared->parent, stream);
- fprintf(stream, "\n");
+ HDfprintf(stream, "\n");
} /* end else */
- } else if(H5T_ENUM == dt->shared->type) {
+ }
+ else if (H5T_ENUM == dt->shared->type) {
size_t base_size;
- /* Enumeration data type */
- fprintf(stream, " ");
- H5T_debug(dt->shared->parent, stream);
- base_size = dt->shared->parent->shared->size;
- for(i = 0; i < dt->shared->u.enumer.nmembs; i++) {
+ /* Enumeration data type */
+ HDfprintf(stream, " ");
+ H5T_debug(dt->shared->parent, stream);
+ base_size = dt->shared->parent->shared->size;
+ for (i = 0; i < dt->shared->u.enumer.nmembs; i++) {
size_t k;
- fprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]);
- for(k = 0; k < base_size; k++)
- fprintf(stream, "%02lx",
- (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k));
- } /* end for */
- fprintf(stream, "\n");
- } else if(H5T_OPAQUE == dt->shared->type) {
- fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag);
- } else {
- /* Unknown */
- fprintf(stream, "unknown class %d\n", (int)(dt->shared->type));
+ HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]);
+ for (k = 0; k < base_size; k++)
+ HDfprintf(stream, "%02lx", (unsigned long)((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k));
+ } /* end for */
+ HDfprintf(stream, "\n");
+ }
+ else if (H5T_OPAQUE == dt->shared->type) {
+ HDfprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag);
+ }
+ else {
+ /* Unknown */
+ HDfprintf(stream, "unknown class %d\n", (int)(dt->shared->type));
}
- fprintf(stream, "}");
+ HDfprintf(stream, "}");
done:
FUNC_LEAVE_NOAPI(ret_value)