From cd7b4b8b90adc487f9cd4ee05f2425eeb5f7f84d Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Wed, 17 Dec 2003 09:07:41 -0500 Subject: [svn-r7966] Purpose: h5repack new features Description: added debugging functions and a hard link generated dataset for the test suite Solution: Platforms tested: linux solaris 2.7 IRIX Misc. update: --- tools/h5repack/h5repack.c | 1 + tools/h5repack/h5repack.h | 8 +++---- tools/h5repack/h5repack_copy.c | 5 ++++ tools/h5repack/testh5repack_dset.c | 4 ++++ tools/lib/h5diff.c | 49 -------------------------------------- tools/lib/h5trav.c | 48 +++++++++++++++++++++++++++++++++++++ tools/lib/h5trav.h | 7 ++++++ 7 files changed, 69 insertions(+), 53 deletions(-) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index b989ab3..24a90f7 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -57,6 +57,7 @@ int h5repack(const char* infile, /* copy the file */ if (copy_file(infile,outfile,options)<0) return -1; + return 0; } diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 9e857e7..546ae3a 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -19,6 +19,10 @@ #include "hdf5.h" #include "h5trav.h" +#if 0 +#define H5_REPACK_DEBUG +#endif + #define PFORMAT "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/ #define PFORMAT1 "%-7s %-7s %-7s" /*chunk info, compression info, name*/ @@ -26,10 +30,6 @@ #define MAX_NC_NAME 256 /* max length of a name */ #define MAX_VAR_DIMS 32 /* max per variable dimensions */ -#if 1 -#define H5_REPACK_DEBUG -#endif - /*------------------------------------------------------------------------- * data structures for command line options diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index f236889..f7d5016 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -109,6 +109,11 @@ int copy_file(const char* fnamein, return -1; } +#if defined (H5_REPACK_DEBUG) + h5trav_printinfo(nobjects,travi); +#endif + + /*------------------------------------------------------------------------- * free *------------------------------------------------------------------------- diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index e5fe500..88363f7 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -168,6 +168,10 @@ void write_dset_in(hid_t loc_id, write_dset(loc_id,1,dims,"string",type_id,buf1); status = H5Tclose(type_id); + + /* create hard link */ + status = H5Glink(loc_id, H5G_LINK_HARD, "string", "string_link"); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1a5e1f3..3b59b0e 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -536,55 +536,6 @@ int diff( hid_t file1_id, } -/*------------------------------------------------------------------------- - * Function: diff_list - * - * Purpose: print list of objects in file - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -#ifdef NOT_YET -void diff_list( const char *filename, int nobjects, trav_info_t *info ) -{ - int i; - - printf("File <%s>: # of entries = %d\n", filename, nobjects ); - for ( i = 0; i < nobjects; i++) - { - switch ( info[i].type ) - { - case H5G_GROUP: - printf(" %-10s %s\n", "group", info[i].name ); - break; - case H5G_DATASET: - printf(" %-10s %s\n", "dataset", info[i].name ); - break; - case H5G_TYPE: - printf(" %-10s %s\n", "datatype", info[i].name ); - break; - case H5G_LINK: - printf(" %-10s %s\n", "link", info[i].name ); - break; - default: - printf(" %-10s %s\n", "User defined object", info[i].name ); - break; - } - } - -} -#endif - - diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 4747aad..fc64fc7 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -467,3 +467,51 @@ int traverse( hid_t loc_id, return inserted_objs; } + + + +/*------------------------------------------------------------------------- + * Function: diff_list + * + * Purpose: print list of objects in file + * + * Return: void + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: May 9, 2003 + * + * Comments: + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void h5trav_printinfo(int nobjs, trav_info_t *travi) +{ + int i; + for ( i = 0; i < nobjs; i++) + { + switch ( travi[i].type ) + { + case H5G_GROUP: + printf(" %-10s %s\n", "group", travi[i].name ); + break; + case H5G_DATASET: + printf(" %-10s %s\n", "dataset", travi[i].name ); + break; + case H5G_TYPE: + printf(" %-10s %s\n", "datatype", travi[i].name ); + break; + case H5G_LINK: + printf(" %-10s %s\n", "link", travi[i].name ); + break; + default: + printf(" %-10s %s\n", "User defined object", travi[i].name ); + break; + } + } +} + + + diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index 15c82ca..1f826bb 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -17,6 +17,10 @@ #include "hdf5.h" +#if 0 +#define H5_TRAV_DEBUG +#endif + /*------------------------------------------------------------------------- * public struct to store name and type of an object @@ -73,6 +77,9 @@ extern "C" { int h5trav_getinfo( hid_t file_id, trav_info_t *info ); int h5trav_getindex( const char *obj, int nobjs, trav_info_t *info ); void h5trav_freeinfo( trav_info_t *info, int nobjs ); +void h5trav_printinfo(int nobjs, trav_info_t *info); + + #ifdef __cplusplus } -- cgit v0.12