summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-21 20:05:04 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-21 20:05:04 (GMT)
commit67f5810d8452df6c13ead8056851c390f0d12235 (patch)
tree9b0293cbfa5b08eb0f20756d794a906dc4aec605 /tools/lib
parent1e07756ac265fad1171cd18efcdb2b0ba9bb903d (diff)
downloadhdf5-67f5810d8452df6c13ead8056851c390f0d12235.zip
hdf5-67f5810d8452df6c13ead8056851c390f0d12235.tar.gz
hdf5-67f5810d8452df6c13ead8056851c390f0d12235.tar.bz2
[svn-r13368]
Added a little format alignment to the printing of dimensions
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c11
-rw-r--r--tools/lib/h5diff.h8
-rw-r--r--tools/lib/h5diff_array.c90
-rw-r--r--tools/lib/h5diff_dset.c37
-rw-r--r--tools/lib/h5diff_util.c29
5 files changed, 85 insertions, 90 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 2f850a6..d770769 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -60,12 +60,11 @@ print_objname (diff_opt_t * options, hsize_t nfound)
void
do_print_objname (const char *OBJ, const char *path1, const char *path2)
{
- parallel_print("%s:\n<%s> and <%s> ", OBJ, path1, path2);
+ parallel_print("%-7s: <%s> and <%s>\n", OBJ, path1, path2);
}
-
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
* Function: phdiff_dismiss_workers
@@ -930,7 +929,7 @@ hsize_t diff (hid_t file1_id,
{
if (print_objname (options, (hsize_t)1))
do_print_objname ("dataset", path1, path2);
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 1);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
/* always print the number of differences found */
print_found(nfound);
}
@@ -944,14 +943,14 @@ hsize_t diff (hid_t file1_id,
{
/* shut up temporarily */
options->m_quiet = 1;
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 0);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
/* print again */
options->m_quiet = 0;
if (nfound)
{
if (print_objname (options, nfound))
do_print_objname ("dataset", path1, path2);
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 1);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
/* print the number of differences found only when found
this is valid for the default mode and report mode */
print_found(nfound);
@@ -964,7 +963,7 @@ hsize_t diff (hid_t file1_id,
*/
else
{
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 0);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
}
} /*else verbose */
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 95fc400..d154fc8 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -76,15 +76,13 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options,
- int print_dims);
+ diff_opt_t *options);
hsize_t diff_datasetid( hid_t dset1_id,
hid_t dset2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options,
- int print_dims);
+ diff_opt_t *options);
hsize_t diff( hid_t file1_id,
const char *path1,
@@ -160,7 +158,7 @@ const char* diff_basename(const char *name);
const char* get_type(int type);
const char* get_class(H5T_class_t tclass);
const char* get_sign(H5T_sign_t sign);
-void print_dims( int r, hsize_t *d );
+void print_dimensions (int rank, hsize_t *dims);
int print_objname(diff_opt_t *options, hsize_t nfound);
void do_print_objname (const char *OBJ, const char *path1, const char *path2);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index bf26370..3467116 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -152,6 +152,7 @@ int print_data(diff_opt_t *options)
*
*-------------------------------------------------------------------------
*/
+
static
void print_pos( int *ph, /* print header */
int pp, /* print percentage */
@@ -163,47 +164,53 @@ void print_pos( int *ph, /* print header */
const char *obj1,
const char *obj2 )
{
- int i;
-
- /* print header */
- if ( *ph==1 )
- {
- *ph=0;
-
- if (pp)
- {
- parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
- "position",
- (obj1!=NULL) ? obj1 : " ",
- (obj2!=NULL) ? obj2 : " ",
- "difference",
- "relative");
- parallel_print("------------------------------------------------------------------------\n");
- }
- else
- {
- parallel_print("%-15s %-15s %-15s %-20s\n",
- "position",
- (obj1!=NULL) ? obj1 : " ",
- (obj2!=NULL) ? obj2 : " ",
- "difference");
- parallel_print("------------------------------------------------------------\n");
- }
- }
-
- for ( i = 0; i < rank; i++)
- {
- pos[i] = curr_pos/acc[i];
- curr_pos -= acc[i]*pos[i];
- }
- assert( curr_pos == 0 );
+ int i;
+
+ /* print header */
+ if ( *ph==1 )
+ {
+ *ph=0;
- parallel_print("[ " );
- for ( i = 0; i < rank; i++)
- {
- parallel_print("%"H5_PRINTF_LL_WIDTH"u ", (unsigned long_long)pos[i]);
- }
- parallel_print("]" );
+ parallel_print("%-16s","size:");
+ print_dimensions (rank,dims);
+ parallel_print("%-11s","");
+ print_dimensions (rank,dims);
+ parallel_print("\n");
+
+ if (pp)
+ {
+ parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
+ "position",
+ (obj1!=NULL) ? obj1 : " ",
+ (obj2!=NULL) ? obj2 : " ",
+ "difference",
+ "relative");
+ parallel_print("------------------------------------------------------------------------\n");
+ }
+ else
+ {
+ parallel_print("%-15s %-15s %-15s %-20s\n",
+ "position",
+ (obj1!=NULL) ? obj1 : " ",
+ (obj2!=NULL) ? obj2 : " ",
+ "difference");
+ parallel_print("------------------------------------------------------------\n");
+ }
+ } /* end print header */
+
+ for ( i = 0; i < rank; i++)
+ {
+ pos[i] = curr_pos/acc[i];
+ curr_pos -= acc[i]*pos[i];
+ }
+ assert( curr_pos == 0 );
+
+ parallel_print("[ " );
+ for ( i = 0; i < rank; i++)
+ {
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u ", (unsigned long_long)pos[i]);
+ }
+ parallel_print("]" );
}
@@ -789,8 +796,7 @@ hsize_t diff_datum(void *_mem1,
obj2_id,
NULL,
NULL,
- options,
- 0);
+ options);
break;
default:
parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>",
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index e913e79..993a00f 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -61,8 +61,7 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options,
- int print_dims)
+ diff_opt_t *options)
{
hid_t did1=-1;
hid_t did2=-1;
@@ -110,8 +109,7 @@ hsize_t diff_dataset( hid_t file1_id,
did2,
obj1_name,
obj2_name,
- options,
- print_dims);
+ options);
}
/*-------------------------------------------------------------------------
* close
@@ -160,8 +158,7 @@ hsize_t diff_datasetid( hid_t did1,
hid_t did2,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options,
- int print_dims)
+ diff_opt_t *options)
{
hid_t sid1=-1;
hid_t sid2=-1;
@@ -231,14 +228,6 @@ hsize_t diff_datasetid( hid_t did1,
if ( (f_tid2 = H5Dget_type(did2)) < 0 )
goto error;
-
- /*-------------------------------------------------------------------------
- * print dimensions
- *-------------------------------------------------------------------------
- */
- if (print_dims)
- print_size (rank1, dims1);
-
/*-------------------------------------------------------------------------
* check for empty datasets
*-------------------------------------------------------------------------
@@ -726,14 +715,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */
{
if (options->m_verbose && obj1_name) {
printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
- print_dims(rank1,dims1);
+ print_dimensions(rank1,dims1);
printf(", max dimensions ");
- print_dims(rank1,maxdim1);
+ print_dimensions(rank1,maxdim1);
printf("\n" );
printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
- print_dims(rank2,dims2);
+ print_dimensions(rank2,dims2);
printf(", max dimensions ");
- print_dims(rank2,maxdim2);
+ print_dimensions(rank2,maxdim2);
}
return 0;
}
@@ -764,15 +753,15 @@ int diff_can_type( hid_t f_tid1, /* file data type */
{
if (options->m_verbose && obj1_name) {
printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
- print_dims(rank1,dims1);
+ print_dimensions(rank1,dims1);
if (maxdim1 && maxdim2) {
printf(", max dimensions ");
- print_dims(rank1,maxdim1);
+ print_dimensions(rank1,maxdim1);
printf("\n" );
printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
- print_dims(rank2,dims2);
+ print_dimensions(rank2,dims2);
printf(", max dimensions ");
- print_dims(rank2,maxdim2);
+ print_dimensions(rank2,maxdim2);
}
}
return 0;
@@ -787,10 +776,10 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if (options->m_verbose) {
printf( "Warning: different maximum dimensions\n");
printf("<%s> has max dimensions ", obj1_name);
- print_dims(rank1,maxdim1);
+ print_dimensions(rank1,maxdim1);
printf("\n");
printf("<%s> has max dimensions ", obj2_name);
- print_dims(rank2,maxdim2);
+ print_dimensions(rank2,maxdim2);
printf("\n");
}
}
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index eaaf35b..bd8207f 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -90,27 +90,30 @@ void parallel_print(const char* format, ...)
va_end(ap);
}
-
/*-------------------------------------------------------------------------
- * Function: print_dims
- *
- * Purpose: print dimensions
+ * Function: print_dimensions
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
+ * Purpose: print dimensions
*
*-------------------------------------------------------------------------
*/
-void print_dims( int r, hsize_t *d )
+void
+print_dimensions (int rank, hsize_t *dims)
{
- int i;
- parallel_print("[ " );
- for ( i=0; i<r; i++ )
- parallel_print("%"H5_PRINTF_LL_WIDTH"u ",(unsigned long_long)d[i] );
- parallel_print("] " );
+ int i;
+
+ parallel_print("[" );
+ for ( i = 0; i < rank-1; i++)
+ {
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]);
+ parallel_print("x");
+ }
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]);
+ parallel_print("]" );
+
}
+
/*-------------------------------------------------------------------------
* Function: print_type
*