From 48fa07cd25da23ddca005a4ed475967b81d9d02a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 4 Mar 2011 10:01:43 -0500 Subject: [svn-r20187] Verify/cleanup code due to debugging changes Tested: local linux --- tools/lib/h5diff_util.c | 257 +++++++++++++++++++++++----------------------- tools/lib/h5tools.h | 1 + tools/lib/h5tools_str.c | 4 +- tools/lib/h5tools_utils.c | 3 +- 4 files changed, 131 insertions(+), 134 deletions(-) diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 48e0ecb..6d340d9 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -20,7 +20,6 @@ #include "ph5diff.h" - /* global variables */ int g_nTasks = 1; @@ -74,91 +73,91 @@ print_dimensions (int rank, hsize_t *dims) */ void print_type(hid_t type) { - switch (H5Tget_class(type)) - { - default: - return; - case H5T_INTEGER: - if (H5Tequal(type, H5T_STD_I8BE)) { - parallel_print("H5T_STD_I8BE"); - } else if (H5Tequal(type, H5T_STD_I8LE)) { - parallel_print("H5T_STD_I8LE"); - } else if (H5Tequal(type, H5T_STD_I16BE)) { - parallel_print("H5T_STD_I16BE"); - } else if (H5Tequal(type, H5T_STD_I16LE)) { - parallel_print("H5T_STD_I16LE"); - } else if (H5Tequal(type, H5T_STD_I32BE)) { - parallel_print("H5T_STD_I32BE"); - } else if (H5Tequal(type, H5T_STD_I32LE)) { - parallel_print("H5T_STD_I32LE"); - } else if (H5Tequal(type, H5T_STD_I64BE)) { - parallel_print("H5T_STD_I64BE"); - } else if (H5Tequal(type, H5T_STD_I64LE)) { - parallel_print("H5T_STD_I64LE"); - } else if (H5Tequal(type, H5T_STD_U8BE)) { - parallel_print("H5T_STD_U8BE"); - } else if (H5Tequal(type, H5T_STD_U8LE)) { - parallel_print("H5T_STD_U8LE"); - } else if (H5Tequal(type, H5T_STD_U16BE)) { - parallel_print("H5T_STD_U16BE"); - } else if (H5Tequal(type, H5T_STD_U16LE)) { - parallel_print("H5T_STD_U16LE"); - } else if (H5Tequal(type, H5T_STD_U32BE)) { - parallel_print("H5T_STD_U32BE"); - } else if (H5Tequal(type, H5T_STD_U32LE)) { - parallel_print("H5T_STD_U32LE"); - } else if (H5Tequal(type, H5T_STD_U64BE)) { - parallel_print("H5T_STD_U64BE"); - } else if (H5Tequal(type, H5T_STD_U64LE)) { - parallel_print("H5T_STD_U64LE"); - } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - parallel_print("H5T_NATIVE_SCHAR"); - } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - parallel_print("H5T_NATIVE_UCHAR"); - } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - parallel_print("H5T_NATIVE_SHORT"); - } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - parallel_print("H5T_NATIVE_USHORT"); - } else if (H5Tequal(type, H5T_NATIVE_INT)) { - parallel_print("H5T_NATIVE_INT"); - } else if (H5Tequal(type, H5T_NATIVE_UINT)) { - parallel_print("H5T_NATIVE_UINT"); - } else if (H5Tequal(type, H5T_NATIVE_LONG)) { - parallel_print("H5T_NATIVE_LONG"); - } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { - parallel_print("H5T_NATIVE_ULONG"); - } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { - parallel_print("H5T_NATIVE_LLONG"); - } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { - parallel_print("H5T_NATIVE_ULLONG"); - } else { - parallel_print("undefined integer"); - } - break; + switch (H5Tget_class(type)) + { + default: + return; + case H5T_INTEGER: + if (H5Tequal(type, H5T_STD_I8BE)) { + parallel_print("H5T_STD_I8BE"); + } else if (H5Tequal(type, H5T_STD_I8LE)) { + parallel_print("H5T_STD_I8LE"); + } else if (H5Tequal(type, H5T_STD_I16BE)) { + parallel_print("H5T_STD_I16BE"); + } else if (H5Tequal(type, H5T_STD_I16LE)) { + parallel_print("H5T_STD_I16LE"); + } else if (H5Tequal(type, H5T_STD_I32BE)) { + parallel_print("H5T_STD_I32BE"); + } else if (H5Tequal(type, H5T_STD_I32LE)) { + parallel_print("H5T_STD_I32LE"); + } else if (H5Tequal(type, H5T_STD_I64BE)) { + parallel_print("H5T_STD_I64BE"); + } else if (H5Tequal(type, H5T_STD_I64LE)) { + parallel_print("H5T_STD_I64LE"); + } else if (H5Tequal(type, H5T_STD_U8BE)) { + parallel_print("H5T_STD_U8BE"); + } else if (H5Tequal(type, H5T_STD_U8LE)) { + parallel_print("H5T_STD_U8LE"); + } else if (H5Tequal(type, H5T_STD_U16BE)) { + parallel_print("H5T_STD_U16BE"); + } else if (H5Tequal(type, H5T_STD_U16LE)) { + parallel_print("H5T_STD_U16LE"); + } else if (H5Tequal(type, H5T_STD_U32BE)) { + parallel_print("H5T_STD_U32BE"); + } else if (H5Tequal(type, H5T_STD_U32LE)) { + parallel_print("H5T_STD_U32LE"); + } else if (H5Tequal(type, H5T_STD_U64BE)) { + parallel_print("H5T_STD_U64BE"); + } else if (H5Tequal(type, H5T_STD_U64LE)) { + parallel_print("H5T_STD_U64LE"); + } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { + parallel_print("H5T_NATIVE_SCHAR"); + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { + parallel_print("H5T_NATIVE_UCHAR"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { + parallel_print("H5T_NATIVE_SHORT"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { + parallel_print("H5T_NATIVE_USHORT"); + } else if (H5Tequal(type, H5T_NATIVE_INT)) { + parallel_print("H5T_NATIVE_INT"); + } else if (H5Tequal(type, H5T_NATIVE_UINT)) { + parallel_print("H5T_NATIVE_UINT"); + } else if (H5Tequal(type, H5T_NATIVE_LONG)) { + parallel_print("H5T_NATIVE_LONG"); + } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { + parallel_print("H5T_NATIVE_ULONG"); + } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { + parallel_print("H5T_NATIVE_LLONG"); + } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { + parallel_print("H5T_NATIVE_ULLONG"); + } else { + parallel_print("undefined integer"); + } + break; - case H5T_FLOAT: - if (H5Tequal(type, H5T_IEEE_F32BE)) { - parallel_print("H5T_IEEE_F32BE"); - } else if (H5Tequal(type, H5T_IEEE_F32LE)) { - parallel_print("H5T_IEEE_F32LE"); - } else if (H5Tequal(type, H5T_IEEE_F64BE)) { - parallel_print("H5T_IEEE_F64BE"); - } else if (H5Tequal(type, H5T_IEEE_F64LE)) { - parallel_print("H5T_IEEE_F64LE"); - } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - parallel_print("H5T_NATIVE_FLOAT"); - } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - parallel_print("H5T_NATIVE_DOUBLE"); + case H5T_FLOAT: + if (H5Tequal(type, H5T_IEEE_F32BE)) { + parallel_print("H5T_IEEE_F32BE"); + } else if (H5Tequal(type, H5T_IEEE_F32LE)) { + parallel_print("H5T_IEEE_F32LE"); + } else if (H5Tequal(type, H5T_IEEE_F64BE)) { + parallel_print("H5T_IEEE_F64BE"); + } else if (H5Tequal(type, H5T_IEEE_F64LE)) { + parallel_print("H5T_IEEE_F64LE"); + } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { + parallel_print("H5T_NATIVE_FLOAT"); + } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { + parallel_print("H5T_NATIVE_DOUBLE"); #if H5_SIZEOF_LONG_DOUBLE !=0 - } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { - parallel_print("H5T_NATIVE_LDOUBLE"); + } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { + parallel_print("H5T_NATIVE_LDOUBLE"); #endif - } else { - parallel_print("undefined float"); - } - break; + } else { + parallel_print("undefined float"); + } + break; - }/*switch*/ + }/*switch*/ } /*------------------------------------------------------------------------- @@ -175,21 +174,21 @@ void print_type(hid_t type) const char* diff_basename(const char *name) { - size_t i; + size_t i; - if (name==NULL) - return NULL; + if (name==NULL) + return NULL; - /* Find the end of the base name */ - i = strlen(name); - while (i>0 && '/'==name[i-1]) - --i; + /* Find the end of the base name */ + i = strlen(name); + while (i>0 && '/'==name[i-1]) + --i; - /* Skip backward over base name */ - while (i>0 && '/'!=name[i-1]) - --i; + /* Skip backward over base name */ + while (i>0 && '/'!=name[i-1]) + --i; - return(name+i); + return(name+i); } /*------------------------------------------------------------------------- @@ -238,15 +237,15 @@ get_type(h5trav_type_t type) const char* get_sign(H5T_sign_t sign) { - switch (sign) - { - default: - return("H5T_SGN_ERROR"); - case H5T_SGN_NONE: - return("H5T_SGN_NONE"); - case H5T_SGN_2: - return("H5T_SGN_2"); - } + switch (sign) + { + default: + return("H5T_SGN_ERROR"); + case H5T_SGN_NONE: + return("H5T_SGN_NONE"); + case H5T_SGN_2: + return("H5T_SGN_2"); + } } @@ -264,33 +263,33 @@ get_sign(H5T_sign_t sign) const char* get_class(H5T_class_t tclass) { - switch (tclass) - { - default: - return("Invalid class"); - case H5T_TIME: - return("H5T_TIME"); - case H5T_INTEGER: - return("H5T_INTEGER"); - case H5T_FLOAT: - return("H5T_FLOAT"); - case H5T_STRING: - return("H5T_STRING"); - case H5T_BITFIELD: - return("H5T_BITFIELD"); - case H5T_OPAQUE: - return("H5T_OPAQUE"); - case H5T_COMPOUND: - return("H5T_COMPOUND"); - case H5T_REFERENCE: - return("H5T_REFERENCE"); - case H5T_ENUM: - return("H5T_ENUM"); - case H5T_VLEN: - return("H5T_VLEN"); - case H5T_ARRAY: - return("H5T_ARRAY"); - } + switch (tclass) + { + default: + return("Invalid class"); + case H5T_TIME: + return("H5T_TIME"); + case H5T_INTEGER: + return("H5T_INTEGER"); + case H5T_FLOAT: + return("H5T_FLOAT"); + case H5T_STRING: + return("H5T_STRING"); + case H5T_BITFIELD: + return("H5T_BITFIELD"); + case H5T_OPAQUE: + return("H5T_OPAQUE"); + case H5T_COMPOUND: + return("H5T_COMPOUND"); + case H5T_REFERENCE: + return("H5T_REFERENCE"); + case H5T_ENUM: + return("H5T_ENUM"); + case H5T_VLEN: + return("H5T_VLEN"); + case H5T_ARRAY: + return("H5T_ARRAY"); + } } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index c7836a9..740dd38 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -579,6 +579,7 @@ int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t type); int h5tools_print_enum(h5tools_str_t *buffer/*in,out*/, hid_t type); + #ifdef __cplusplus } #endif diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index fa60389..95b1f5b 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1065,7 +1065,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); - fprintf(stderr, "lb: %d, i: %d, mod: %d, dim: %d, ndim: %d\n", info->arr_linebreak, i, i % dims[ndims - 1], dims[ndims - 1], ndims); if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) { int x; @@ -1079,8 +1078,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai for (x = 0; x < ctx->indent_level + 1; x++) h5tools_str_append(str, "%s", OPT(info->line_indent, "")); } /* end if */ - else - if (i && info->arr_sep) + else if (i && info->arr_sep) h5tools_str_append(str, " "); ctx->indent_level++; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 361cd6a..7586fd0 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -40,8 +40,7 @@ int opt_err = 1; /*get_option prints errors if this is on */ int opt_ind = 1; /*token pointer */ const char *opt_arg; /*flag argument (or value) */ static int h5tools_d_status = 0; -//static const char *h5tools_progname = "h5tools"; -static char *h5tools_progname = "h5tools"; +static const char *h5tools_progname = "h5tools"; /* ``parallel_print'' variables */ unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */ -- cgit v0.12