summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-10-28 17:40:05 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-10-28 17:40:05 (GMT)
commitf2b52777f461e1f9e9fcdf9d1dc2520b96746382 (patch)
tree3bc1eb0612e9ef9599a5f6424fbcce53a4f09090
parent10b6bab2abbf239495fa59f459ce0134c9a03bb0 (diff)
downloadhdf5-f2b52777f461e1f9e9fcdf9d1dc2520b96746382.zip
hdf5-f2b52777f461e1f9e9fcdf9d1dc2520b96746382.tar.gz
hdf5-f2b52777f461e1f9e9fcdf9d1dc2520b96746382.tar.bz2
[svn-r7769] Purpose:
moved h5diff "public API" routines to tools/lib folder Platforms tested: linux solaris 2.7 IRIX Misc. update:
-rw-r--r--MANIFEST17
-rw-r--r--tools/h5diff/Makefile.in13
-rw-r--r--tools/h5repack/Makefile.in17
-rw-r--r--tools/h5repack/h5repack.c19
-rw-r--r--tools/h5repack/h5repack.h20
-rw-r--r--tools/h5repack/h5repack_list.c44
-rw-r--r--tools/h5repack/h5repack_list.h10
-rw-r--r--tools/h5repack/h5repack_main.c2
-rw-r--r--tools/h5repack/h5repack_opttable.c12
-rw-r--r--tools/h5repack/h5repack_opttable.h10
-rw-r--r--tools/h5repack/test_h5repack_add.c2
-rw-r--r--tools/h5repack/test_h5repack_main.c18
-rw-r--r--tools/lib/Makefile.in4
-rw-r--r--tools/lib/h5diff.c (renamed from tools/h5diff/h5diff.c)124
-rw-r--r--tools/lib/h5diff.h (renamed from tools/h5diff/h5diff.h)74
-rw-r--r--tools/lib/h5diff_array.c (renamed from tools/h5diff/h5diff_array.c)12
-rw-r--r--tools/lib/h5diff_dset.c (renamed from tools/h5diff/h5diff_dset.c)23
-rw-r--r--tools/lib/h5diff_util.c (renamed from tools/h5diff/h5diff_util.c)34
-rw-r--r--tools/lib/h5trav.c (renamed from tools/h5diff/h5trav.c)88
-rw-r--r--tools/lib/h5trav.h (renamed from tools/h5diff/h5trav.h)63
-rw-r--r--tools/lib/h5trav_table.c (renamed from tools/h5diff/h5trav_table.c)71
21 files changed, 347 insertions, 330 deletions
diff --git a/MANIFEST b/MANIFEST
index 775bec2..473f086 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1111,15 +1111,7 @@
./tools/h5diff/Dependencies
./tools/h5diff/Makefile.in
-./tools/h5diff/h5diff.c
-./tools/h5diff/h5diff_array.c
-./tools/h5diff/h5diff_dset.c
./tools/h5diff/h5diff_main.c
-./tools/h5diff/h5diff_util.c
-./tools/h5diff/h5trav.c
-./tools/h5diff/h5trav_table.c
-./tools/h5diff/h5trav.h
-./tools/h5diff/h5diff.h
./tools/h5diff/test_h5diff.c
./tools/h5diff/testh5diff.sh
@@ -1153,7 +1145,14 @@
./tools/lib/h5tools_str.h
./tools/lib/h5tools_utils.c
./tools/lib/h5tools_utils.h
-./tools/lib/talign.c
+./tools/lib/h5diff.c
+./tools/lib/h5diff_array.c
+./tools/lib/h5diff_dset.c
+./tools/lib/h5diff_util.c
+./tools/lib/h5trav.c
+./tools/lib/h5trav_table.c
+./tools/lib/h5trav.h
+./tools/lib/h5diff.h
./tools/misc/Dependencies
./tools/misc/Makefile.in
diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in
index ae5b212..3726718 100644
--- a/tools/h5diff/Makefile.in
+++ b/tools/h5diff/Makefile.in
@@ -32,6 +32,7 @@ TEST_SCRIPTS=$(srcdir)/testh5diff.sh
## These are our main targets: library and tools.
##
LIBHDF5=$(top_builddir)/src/libhdf5.la
+LIBTOOLS=../lib/libh5tools.la
PUB_PROGS=h5diff
PROGS=$(PUB_PROGS) $(TEST_PROGS)
@@ -48,11 +49,11 @@ MOSTLYCLEAN=*.h5
## Source and object files for programs...
##
-PROG_SRC=h5diff.c h5diff_array.c h5diff_dset.c h5diff_main.c h5diff_util.c h5trav.c h5trav_table.c test_h5diff.c
+PROG_SRC= h5diff_main.c test_h5diff.c
PROG_OBJ=$(PROG_SRC:.c=.lo)
-OBJS=h5diff.lo h5diff_array.lo h5diff_dset.lo h5diff_main.lo h5diff_util.lo h5trav.lo h5trav_table.lo
+OBJS= h5diff_main.lo
-PRIVATE_HDR=h5trav.h h5diff.h
+PRIVATE_HDR=
## Source and object files for the tests
##
@@ -66,13 +67,13 @@ check test _test: $(PROGS)
## How to build the programs...They all depend on the hdf5 library and
## the tools library compiled in this directory.
##
-$(PROGS): $(LIBHDF5)
+$(PROGS): $(LIBTOOLS) $(LIBHDF5)
h5diff: $(OBJS)
- @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(OBJS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
h5difftst: test_h5diff.lo
- @$(LT_LINK_EXE) $(CFLAGS) -o $@ test_h5diff.lo $(LIBHDF5) $(LDFLAGS) $(LIBS)
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ test_h5diff.lo $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
@CONCLUDE@
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 8768d36..7ea6e23 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -21,11 +21,9 @@ srcdir=@srcdir@
## Add include directory to the C preprocessor flags, add -lh5tools and
## -lhdf5 to the list of libraries.
## Add also the test include directory for #defines
-## Add include for H5DIFF
CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \
-I$(top_srcdir)/test \
- -I$(top_srcdir)/tools/lib @CPPFLAGS@ \
- -I$(top_srcdir)/tools/h5diff
+ -I$(top_srcdir)/tools/lib @CPPFLAGS@
## Test programs and scripts.
##
@@ -35,6 +33,7 @@ TEST_SCRIPTS=$(srcdir)/h5repack.sh
## These are our main targets: library and tools.
##
LIBHDF5=$(top_builddir)/src/libhdf5.la
+LIBTOOLS=../lib/libh5tools.la
PUB_PROGS=h5repack
PROGS=$(PUB_PROGS) $(TEST_PROGS)
@@ -51,10 +50,10 @@ MOSTLYCLEAN=*.h5
## Source and object files for programs...
##
-PROG_SRC=h5repack.c h5repack_list.c h5repack_main.c h5repack_opttable.c h5repack_parse.c ../h5diff/h5trav.c ../h5diff/h5trav_table.c test_h5repack_add.c test_h5repack_main.c
+PROG_SRC=h5repack.c h5repack_list.c h5repack_main.c h5repack_opttable.c h5repack_parse.c test_h5repack_add.c test_h5repack_main.c
PROG_OBJ=$(PROG_SRC:.c=.lo)
-OBJS=h5repack.lo h5repack_list.lo h5repack_main.lo h5repack_opttable.lo h5repack_parse.lo ../h5diff/h5trav.lo ../h5diff/h5trav_table.lo
-TEST_OBJS=../h5diff/h5diff.lo ../h5diff/h5diff_array.lo ../h5diff/h5diff_dset.lo ../h5diff/h5diff_util.lo h5repack.lo h5repack_list.lo h5repack_opttable.lo h5repack_parse.lo ../h5diff/h5trav.lo ../h5diff/h5trav_table.lo test_h5repack_add.lo test_h5repack_main.lo
+OBJS=h5repack.lo h5repack_list.lo h5repack_main.lo h5repack_opttable.lo h5repack_parse.lo
+TEST_OBJS=h5repack.lo h5repack_list.lo h5repack_opttable.lo h5repack_parse.lo test_h5repack_add.lo test_h5repack_main.lo
PRIVATE_HDR=
@@ -70,13 +69,13 @@ check test _test: $(PROGS)
## How to build the programs...They all depend on the hdf5 library and
## the tools library compiled in this directory.
##
-$(PROGS): $(LIBHDF5)
+$(PROGS): $(LIBTOOLS) $(LIBHDF5)
h5repack: $(OBJS)
- @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(OBJS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
h5repacktst: $(TEST_OBJS)
- @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_OBJS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS)
@CONCLUDE@
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index d88196c..fa66ae4 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -21,7 +21,7 @@
-static void print_options(packoptions_t *options);
+static void print_options(pack_opt_t *options);
/*-------------------------------------------------------------------------
* Function: h5repack
@@ -44,7 +44,7 @@ static void print_options(packoptions_t *options);
*/
int h5repack(char* infile,
char* outfile,
- packoptions_t *options)
+ pack_opt_t *options)
{
options->trip=0;
@@ -80,10 +80,10 @@ int h5repack(char* infile,
*-------------------------------------------------------------------------
*/
-int h5repack_init (packoptions_t *options,
+int h5repack_init (pack_opt_t *options,
int verbose)
{
- memset(options,0,sizeof(packoptions_t));
+ memset(options,0,sizeof(pack_opt_t));
options->threshold = 1024;
options->verbose = verbose;
return (options_table_init(&(options->op_tbl)));
@@ -97,7 +97,7 @@ int h5repack_init (packoptions_t *options,
*-------------------------------------------------------------------------
*/
-int h5repack_end (packoptions_t *options)
+int h5repack_end (pack_opt_t *options)
{
return options_table_free(options->op_tbl);
}
@@ -114,7 +114,7 @@ int h5repack_end (packoptions_t *options)
*/
int h5repack_addcomp(char* str,
- packoptions_t *options)
+ pack_opt_t *options)
{
obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */
comp_info_t comp; /*compression info for the current -t option entry */
@@ -167,7 +167,7 @@ int h5repack_addcomp(char* str,
int h5repack_addchunk(char* str,
- packoptions_t *options)
+ pack_opt_t *options)
{
obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */
@@ -227,7 +227,7 @@ int h5repack_addchunk(char* str,
*-------------------------------------------------------------------------
*/
static
-void print_options(packoptions_t *options)
+void print_options(pack_opt_t *options)
{
int i, k, j, has_cp=0, has_ck=0;
@@ -339,7 +339,8 @@ void print_options(packoptions_t *options)
*-------------------------------------------------------------------------
*/
-void read_info(char *filename,packoptions_t *options)
+void read_info(char *filename,
+ pack_opt_t *options)
{
char stype[10];
char comp_info[1024];
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 17c2b52..a661e76 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -62,12 +62,12 @@ typedef struct {
chunk_info_t chunk; /* chunk information */
} pack_info_t;
-/* store a list of all objects */
+/* store a table of all objects */
typedef struct {
int size;
int nelems;
pack_info_t *objs;
-} options_table_t;
+} pack_opttbl_t;
/*-------------------------------------------------------------------------
@@ -77,7 +77,7 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- options_table_t *op_tbl; /*table with all -c and -t options */
+ pack_opttbl_t *op_tbl; /*table with all -c and -t options */
int all_chunk; /*chunk all objects, input of "*" */
int all_comp; /*comp all objects, input of "*" */
comp_info_t comp_g; /*global compress INFO for the ALL case */
@@ -86,7 +86,7 @@ typedef struct {
int trip; /*which cycle are we in */
int threshold; /*minimum size to compress, in bytes */
-} packoptions_t;
+} pack_opt_t;
@@ -99,11 +99,11 @@ typedef struct {
extern "C" {
#endif
-int h5repack (char* infile, char* outfile, packoptions_t *options);
-int h5repack_addcomp (char* str, packoptions_t *options);
-int h5repack_addchunk(char* str, packoptions_t *options);
-int h5repack_init (packoptions_t *options, int verbose);
-int h5repack_end (packoptions_t *options);
+int h5repack (char* infile, char* outfile, pack_opt_t *options);
+int h5repack_addcomp (char* str, pack_opt_t *options);
+int h5repack_addchunk(char* str, pack_opt_t *options);
+int h5repack_init (pack_opt_t *options, int verbose);
+int h5repack_end (pack_opt_t *options);
#ifdef __cplusplus
}
@@ -115,7 +115,7 @@ int h5repack_end (packoptions_t *options);
*/
-void read_info(char *filename,packoptions_t *options);
+void read_info(char *filename,pack_opt_t *options);
diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c
index 138cb5b..f444218 100644
--- a/tools/h5repack/h5repack_list.c
+++ b/tools/h5repack/h5repack_list.c
@@ -37,11 +37,11 @@
*/
-int get_objlist(char* fname, packoptions_t *options)
+int get_objlist(char* fname, pack_opt_t *options)
{
- hid_t fid;
- int nobjects, i;
- info_t *info=NULL;
+ hid_t fid;
+ int nobjects, i;
+ trav_info_t *info=NULL;
/*-------------------------------------------------------------------------
* open the file
@@ -65,7 +65,7 @@ int get_objlist(char* fname, packoptions_t *options)
*-------------------------------------------------------------------------
*/
- if ((nobjects = H5get_object_info(fid, NULL ))<0) {
+ if ((nobjects = h5trav_getinfo(fid, NULL ))<0) {
printf("h5repack: <%s>: Could not obtain object list\n", fname );
return -1;
}
@@ -75,11 +75,11 @@ int get_objlist(char* fname, packoptions_t *options)
*-------------------------------------------------------------------------
*/
- if ((info = (info_t*) malloc( nobjects * sizeof(info_t)))==NULL){
+ if ((info = (trav_info_t*) malloc( nobjects * sizeof(trav_info_t)))==NULL){
printf("h5repack: <%s>: Could not allocate object list\n", fname );
return -1;
}
- if (H5get_object_info(fid, info )<0) {
+ if (h5trav_getinfo(fid, info )<0) {
printf("h5repack: <%s>: Could not obtain object list\n", fname );
return -1;
}
@@ -99,12 +99,12 @@ int get_objlist(char* fname, packoptions_t *options)
printf(PFORMAT1,"","",obj_name);
/* the input object names are present in the file and are valid */
- if (info_getindex(obj_name,nobjects,info)<0)
+ if (h5trav_getindex(obj_name,nobjects,info)<0)
{
printf("\nError: Could not find <%s> in file <%s>. Exiting...\n",
obj_name,fname);
H5Fclose(fid);
- info_free(info,nobjects);
+ h5trav_freeinfo(info,nobjects);
exit(1);
}
if (options->verbose)
@@ -118,7 +118,7 @@ int get_objlist(char* fname, packoptions_t *options)
*-------------------------------------------------------------------------
*/
H5Fclose(fid);
- info_free(info,nobjects);
+ h5trav_freeinfo(info,nobjects);
return 0;
}
@@ -141,12 +141,12 @@ int get_objlist(char* fname, packoptions_t *options)
int copy_file(char* fnamein,
char* fnameout,
- packoptions_t *options)
+ pack_opt_t *options)
{
- hid_t fidin;
- hid_t fidout;
- int nobjects;
- info_t *info=NULL;
+ hid_t fidin;
+ hid_t fidout;
+ int nobjects;
+ trav_info_t *info=NULL;
/*-------------------------------------------------------------------------
* open the files
@@ -174,7 +174,7 @@ int copy_file(char* fnamein,
*-------------------------------------------------------------------------
*/
- if ((nobjects = H5get_object_info(fidin, NULL ))<0) {
+ if ((nobjects = h5trav_getinfo(fidin, NULL ))<0) {
printf("h5repack: <%s>: Could not obtain object list\n", fnamein );
return -1;
}
@@ -184,11 +184,11 @@ int copy_file(char* fnamein,
*-------------------------------------------------------------------------
*/
- if ((info = (info_t*) malloc( nobjects * sizeof(info_t)))==NULL){
+ if ((info = (trav_info_t*) malloc( nobjects * sizeof(trav_info_t)))==NULL){
printf("h5repack: <%s>: Could not allocate object list\n", fnamein );
return -1;
}
- if (H5get_object_info(fidin, info )<0) {
+ if (h5trav_getinfo(fidin, info )<0) {
printf("h5repack: <%s>: Could not obtain object list\n", fnamein );
return -1;
}
@@ -209,7 +209,7 @@ int copy_file(char* fnamein,
*/
H5Fclose(fidin);
H5Fclose(fidout);
- info_free(info,nobjects);
+ h5trav_freeinfo(info,nobjects);
return 0;
}
@@ -231,7 +231,7 @@ int copy_file(char* fnamein,
*/
void print_objlist(char *filename,
int nobjects,
- info_t *info )
+ trav_info_t *info )
{
int i;
@@ -278,8 +278,8 @@ void print_objlist(char *filename,
int do_copy_file(hid_t fidin,
hid_t fidout,
int nobjects,
- info_t *info,
- packoptions_t *options)
+ trav_info_t *info,
+ pack_opt_t *options)
{
hid_t grp_id; /* group ID */
hid_t dset_in; /* read dataset ID */
diff --git a/tools/h5repack/h5repack_list.h b/tools/h5repack/h5repack_list.h
index 36f1907..905057e 100644
--- a/tools/h5repack/h5repack_list.h
+++ b/tools/h5repack/h5repack_list.h
@@ -28,21 +28,21 @@
int get_objlist(char* infname,
- packoptions_t *options);
+ pack_opt_t *options);
int copy_file(char* fnamein,
char* fnameout,
- packoptions_t *options);
+ pack_opt_t *options);
void print_objlist(char *filename,
int nobjects,
- info_t *info );
+ trav_info_t *info );
int do_copy_file(hid_t fidin,
hid_t fidout,
int nobjects,
- info_t *info,
- packoptions_t *options);
+ trav_info_t *info,
+ pack_opt_t *options);
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 2956adb..39f18f8 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
{
char *infile = NULL;
char *outfile = NULL;
- packoptions_t options; /*the global options */
+ pack_opt_t options; /*the global options */
int i;
/* initialize options */
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index cd0e7a2..b7019eb 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -28,10 +28,10 @@
*-------------------------------------------------------------------------
*/
-int options_table_init( options_table_t **tbl )
+int options_table_init( pack_opttbl_t **tbl )
{
int i;
- options_table_t* table = (options_table_t*) malloc(sizeof(options_table_t));
+ pack_opttbl_t* table = (pack_opttbl_t*) malloc(sizeof(pack_opttbl_t));
if (table==NULL) {
printf("Error: not enough memory for options table\n");
return -1;
@@ -66,7 +66,7 @@ int options_table_init( options_table_t **tbl )
*-------------------------------------------------------------------------
*/
-int options_table_free( options_table_t *table )
+int options_table_free( pack_opttbl_t *table )
{
free(table->objs);
free(table);
@@ -88,7 +88,7 @@ int options_add_chunk( obj_list_t *obj_list,
int n_objs,
hsize_t *chunk_lengths,
int chunk_rank,
- options_table_t *table )
+ pack_opttbl_t *table )
{
int i, j, k, I, added=0, found=0;
@@ -185,7 +185,7 @@ int options_add_chunk( obj_list_t *obj_list,
int options_add_comp( obj_list_t *obj_list,
int n_objs,
comp_info_t comp,
- options_table_t *table )
+ pack_opttbl_t *table )
{
int i, j, I, added=0, found=0;
@@ -273,7 +273,7 @@ int options_add_comp( obj_list_t *obj_list,
*/
pack_info_t* options_get_object( char *path,
- options_table_t *table )
+ pack_opttbl_t *table )
{
int i;
diff --git a/tools/h5repack/h5repack_opttable.h b/tools/h5repack/h5repack_opttable.h
index 9122ea7..0bb1292 100644
--- a/tools/h5repack/h5repack_opttable.h
+++ b/tools/h5repack/h5repack_opttable.h
@@ -25,19 +25,19 @@ extern "C" {
#endif
-int options_table_init( options_table_t **tbl );
-int options_table_free( options_table_t *table );
+int options_table_init( pack_opttbl_t **tbl );
+int options_table_free( pack_opttbl_t *table );
int options_add_chunk ( obj_list_t *obj_list,
int n_objs,
hsize_t *chunk_lengths,
int chunk_rank,
- options_table_t *table );
+ pack_opttbl_t *table );
int options_add_comp ( obj_list_t *obj_list,
int n_objs,
comp_info_t comp,
- options_table_t *table );
+ pack_opttbl_t *table );
pack_info_t* options_get_object( char *path,
- options_table_t *table);
+ pack_opttbl_t *table);
#ifdef __cplusplus
diff --git a/tools/h5repack/test_h5repack_add.c b/tools/h5repack/test_h5repack_add.c
index b357220..faaa9c3 100644
--- a/tools/h5repack/test_h5repack_add.c
+++ b/tools/h5repack/test_h5repack_add.c
@@ -177,7 +177,7 @@ int make_dsets()
TEST_ERROR;
nerrors += make_deflate(fid);
-#if 0
+#if 1
nerrors += make_szip(fid);
#endif
diff --git a/tools/h5repack/test_h5repack_main.c b/tools/h5repack/test_h5repack_main.c
index 9ec780a..828bc3a 100644
--- a/tools/h5repack/test_h5repack_main.c
+++ b/tools/h5repack/test_h5repack_main.c
@@ -44,29 +44,27 @@
static int
test()
{
- packoptions_t options;
- options_t diff_options;
- memset(&diff_options, 0, sizeof (options_t));
-
+ pack_opt_t pack_options;
+ diff_opt_t diff_options;
+ memset(&diff_options, 0, sizeof (diff_opt_t));
TESTING(" deflate filter");
- if (h5repack_init (&options, 0)<0)
+ if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
- if (h5repack_addcomp("dset1:GZIP 9",&options)<0)
+ if (h5repack_addcomp("dset1:GZIP 9",&pack_options)<0)
TEST_ERROR;
- if (h5repack_addchunk("dset1:5x4",&options)<0)
+ if (h5repack_addchunk("dset1:5x4",&pack_options)<0)
TEST_ERROR;
- if (h5repack(FILENAME,FILENAME_OUT,&options)<0)
+ if (h5repack(FILENAME,FILENAME_OUT,&pack_options)<0)
TEST_ERROR;
- if (h5repack_end (&options)<0)
+ if (h5repack_end (&pack_options)<0)
TEST_ERROR;
if (h5diff(FILENAME,FILENAME,NULL,NULL,diff_options) == 1)
TEST_ERROR;
PASSED();
return 0;
-
error:
return 1;
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index 6918d32..aed2411 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -41,7 +41,7 @@ PROGS=$(PUB_PROGS) $(TEST_PROGS)
## Source and object files for the library; do not install
##
-LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c
+LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c
LIB_OBJ=$(LIB_SRC:.c=.lo)
PUB_LIB=
AUX_LIB=$(LIB)
@@ -49,7 +49,7 @@ AUX_LIB=$(LIB)
TEST_SRC=talign.c
TEST_OBJ=$(TEST_SRC:.c=.lo)
-PRIVATE_HDR=h5tools.h h5tools_str.h
+PRIVATE_HDR=h5tools.h h5tools_str.h h5diff.h h5trav.h
## Programs have to be built before they can be tested!
##
diff --git a/tools/h5diff/h5diff.c b/tools/lib/h5diff.c
index 9ea7423..8a013c7 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -39,13 +39,13 @@ int h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
- options_t options)
+ diff_opt_t options)
{
- int nobjects1, nobjects2;
- info_t *info1=NULL;
- info_t *info2=NULL;
- hid_t file1_id, file2_id;
- int nfound;
+ int nobjects1, nobjects2;
+ trav_info_t *info1=NULL;
+ trav_info_t *info2=NULL;
+ hid_t file1_id, file2_id;
+ int nfound;
/*-------------------------------------------------------------------------
@@ -76,21 +76,21 @@ int h5diff(const char *fname1,
*-------------------------------------------------------------------------
*/
- nobjects1 = H5get_object_info( file1_id, NULL );
- nobjects2 = H5get_object_info( file2_id, NULL );
+ nobjects1 = h5trav_getinfo( file1_id, NULL );
+ nobjects2 = h5trav_getinfo( file2_id, NULL );
/*-------------------------------------------------------------------------
* get the list of objects in the files
*-------------------------------------------------------------------------
*/
- info1 = (info_t*) malloc( nobjects1 * sizeof(info_t));
- info2 = (info_t*) malloc( nobjects2 * sizeof(info_t));
+ info1 = (trav_info_t*) malloc( nobjects1 * sizeof(trav_info_t));
+ info2 = (trav_info_t*) malloc( nobjects2 * sizeof(trav_info_t));
if (info1==NULL || info2==NULL)
return 0;
- H5get_object_info( file1_id, info1 );
- H5get_object_info( file2_id, info2 );
+ h5trav_getinfo( file1_id, info1 );
+ h5trav_getinfo( file2_id, info2 );
/*-------------------------------------------------------------------------
* object name was supplied
@@ -100,8 +100,8 @@ int h5diff(const char *fname1,
if ( objname1 )
{
assert(objname2);
- nfound=compare(file1_id,fname1,objname1,nobjects1,info1,
- file2_id,fname2,objname2,nobjects2,info2,options);
+ nfound=diff_compare(file1_id,fname1,objname1,nobjects1,info1,
+ file2_id,fname2,objname2,nobjects2,info2,options);
}
/*-------------------------------------------------------------------------
@@ -111,13 +111,13 @@ int h5diff(const char *fname1,
else
{
- nfound=match(file1_id,nobjects1,info1,
- file2_id,nobjects2,info2,options);
+ nfound=diff_match(file1_id,nobjects1,info1,
+ file2_id,nobjects2,info2,options);
}
- info_free(info1,nobjects1);
- info_free(info2,nobjects2);
+ h5trav_freeinfo(info1,nobjects1);
+ h5trav_freeinfo(info2,nobjects2);
/* close */
assert( (H5Fclose(file1_id)) >=0);
assert( (H5Fclose(file2_id)) >=0);
@@ -128,7 +128,7 @@ int h5diff(const char *fname1,
/*-------------------------------------------------------------------------
- * Function: match
+ * Function: diff_match
*
* Purpose: Find common objects; the algorithm used for this search is the
* cosequential match algorithm and is described in
@@ -140,32 +140,30 @@ int h5diff(const char *fname1,
*
* Date: May 9, 2003
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-int match( hid_t file1_id, int nobjects1, info_t *info1,
- hid_t file2_id, int nobjects2, info_t *info2,
- options_t options )
+int diff_match( hid_t file1_id,
+ int nobjects1,
+ trav_info_t *info1,
+ hid_t file2_id,
+ int nobjects2,
+ trav_info_t *info2,
+ diff_opt_t options )
{
- int cmp;
- int more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0;
- int curr1=0;
- int curr2=0;
- int i;
- /*build a common list */
- table_t *table=NULL;
- unsigned infile[2];
- char c1, c2;
- int nfound=0;
+ int more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0;
+ trav_table_t *table=NULL;
+ int cmp;
+ int curr1=0;
+ int curr2=0;
+ unsigned infile[2];
+ char c1, c2;
+ int nfound=0, i;
/*-------------------------------------------------------------------------
* build the list
*-------------------------------------------------------------------------
*/
- table_init( &table );
+ trav_table_init( &table );
while ( more_names_exist )
@@ -175,7 +173,7 @@ int match( hid_t file1_id, int nobjects1, info_t *info1,
if ( cmp == 0 )
{
infile[0]=1; infile[1]=1;
- table_add_flags(infile, info1[curr1].name, info1[curr1].type, table );
+ trav_table_addflags(infile, info1[curr1].name, info1[curr1].type, table );
curr1++;
curr2++;
@@ -183,13 +181,13 @@ int match( hid_t file1_id, int nobjects1, info_t *info1,
else if ( cmp < 0 )
{
infile[0]=1; infile[1]=0;
- table_add_flags(infile, info1[curr1].name, info1[curr1].type, table );
+ trav_table_addflags(infile, info1[curr1].name, info1[curr1].type, table );
curr1++;
}
else
{
infile[0]=0; infile[1]=1;
- table_add_flags(infile, info2[curr2].name, info2[curr2].type, table );
+ trav_table_addflags(infile, info2[curr2].name, info2[curr2].type, table );
curr2++;
}
@@ -204,7 +202,7 @@ int match( hid_t file1_id, int nobjects1, info_t *info1,
while ( curr1<nobjects1 )
{
infile[0]=1; infile[1]=0;
- table_add_flags(infile, info1[curr1].name, info1[curr1].type, table );
+ trav_table_addflags(infile, info1[curr1].name, info1[curr1].type, table );
curr1++;
}
}
@@ -215,7 +213,7 @@ int match( hid_t file1_id, int nobjects1, info_t *info1,
while ( curr2<nobjects2 )
{
infile[0]=0; infile[1]=1;
- table_add_flags(infile, info2[curr2].name, info2[curr2].type, table );
+ trav_table_addflags(infile, info2[curr2].name, info2[curr2].type, table );
curr2++;
}
}
@@ -254,15 +252,15 @@ int match( hid_t file1_id, int nobjects1, info_t *info1,
}
/* free table */
- table_free(table);
+ trav_table_free(table);
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: compare
+ * Function: diff_compare
*
- * Purpose: get objects form list, and check for the same type
+ * Purpose: get objects from list, and check for the same type
*
* Return: Number of differences found
*
@@ -270,25 +268,27 @@ int match( hid_t file1_id, int nobjects1, info_t *info1,
*
* Date: May 9, 2003
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-int compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
- int nobjects1, info_t *info1,
- hid_t file2_id, const char *file2_name, const char *obj2_name,
- int nobjects2, info_t *info2,
- options_t options )
+int diff_compare( hid_t file1_id,
+ const char *file1_name,
+ const char *obj1_name,
+ int nobjects1,
+ trav_info_t *info1,
+ hid_t file2_id,
+ const char *file2_name,
+ const char *obj2_name,
+ int nobjects2,
+ trav_info_t *info2,
+ diff_opt_t options )
{
int f1=0, f2=0;
int nfound=0;
- int i = info_getindex( obj1_name, nobjects1, info1 );
- int j = info_getindex( obj2_name, nobjects2, info2 );
+ int i = h5trav_getindex( obj1_name, nobjects1, info1 );
+ int j = h5trav_getindex( obj2_name, nobjects2, info2 );
if ( i == -1 )
{
@@ -341,8 +341,12 @@ int compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
*-------------------------------------------------------------------------
*/
-int diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name,
- options_t options, int type )
+int diff( hid_t file1_id,
+ const char *obj1_name,
+ hid_t file2_id,
+ const char *obj2_name,
+ diff_opt_t options,
+ int type )
{
int nfound=0;
@@ -367,7 +371,7 @@ int diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj
/*-------------------------------------------------------------------------
- * Function: list
+ * Function: diff_list
*
* Purpose: print list of objects in file
*
@@ -384,7 +388,7 @@ int diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj
*-------------------------------------------------------------------------
*/
#ifdef NOT_YET
-void list( const char *filename, int nobjects, info_t *info )
+void diff_list( const char *filename, int nobjects, trav_info_t *info )
{
int i;
diff --git a/tools/h5diff/h5diff.h b/tools/lib/h5diff.h
index 6a244e8..3313765 100644
--- a/tools/h5diff/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -57,7 +57,7 @@ typedef struct {
int n; /* count */
int count; /* count value */
int verbose; /* print information */
-} options_t;
+} diff_opt_t;
@@ -74,7 +74,7 @@ int h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
- options_t options);
+ diff_opt_t options);
#ifdef __cplusplus
@@ -89,35 +89,63 @@ int h5diff(const char *fname1,
*/
-int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
- const char *obj2_name, options_t options );
-int diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name,
- options_t options, int type );
-int compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
- int nobjects1, info_t *info1,
- hid_t file2_id, const char *file2_name, const char *obj2_name,
- int nobjects2, info_t *info2,
- options_t options );
-int match( hid_t file1_id, int nobjects1, info_t *info1,
- hid_t file2_id, int nobjects2, info_t *info2, options_t options );
-int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims,
- options_t options, const char *obj1, const char *obj2,
- hid_t m_type );
+int diff_dataset( hid_t file1_id,
+ hid_t file2_id,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t options );
+
+int diff( hid_t file1_id,
+ const char *obj1_name,
+ hid_t file2_id,
+ const char *obj2_name,
+ diff_opt_t options,
+ int type );
+
+int diff_compare( hid_t file1_id,
+ const char *file1_name,
+ const char *obj1_name,
+ int nobjects1,
+ trav_info_t *info1,
+ hid_t file2_id,
+ const char *file2_name,
+ const char *obj2_name,
+ int nobjects2,
+ trav_info_t *info2,
+ diff_opt_t options );
+
+int diff_match( hid_t file1_id,
+ int nobjects1,
+ trav_info_t *info1,
+ hid_t file2_id,
+ int nobjects2,
+ trav_info_t *info2,
+ diff_opt_t options );
+
+int diff_array( void *buf1,
+ void *buf2,
+ hsize_t tot_cnt,
+ int rank,
+ hsize_t *dims,
+ diff_opt_t options,
+ const char *obj1,
+ const char *obj2,
+ hid_t m_type );
/*-------------------------------------------------------------------------
* utility functions
*-------------------------------------------------------------------------
*/
-int h5diff_can_diff( hid_t type_id );
-void print_datatype(hid_t type);
-const char* h5diff_basename(const char *name);
+int diff_can( hid_t type_id );
+void print_type(hid_t type);
+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_pos( int *ph, int p, unsigned int curr_pos, int *acc,
- int *pos, int rank, const char *obj1, const char *obj2 );
+void print_dims( int r, hsize_t *d );
+void print_pos( int *ph, int p, unsigned int curr_pos, int *acc,
+ int *pos, int rank, const char *obj1, const char *obj2 );
#if defined (H5DIFF_DEBUG)
void print_sizes( const char *obj1, const char *obj2,
@@ -126,7 +154,7 @@ void print_sizes( const char *obj1, const char *obj2,
#endif
#ifdef NOT_YET
-void list( const char *filename, int nobjects, info_t *info );
+void diff_list( const char *filename, int nobjects, trav_info_t *info );
#endif /* NOT_YET */
diff --git a/tools/h5diff/h5diff_array.c b/tools/lib/h5diff_array.c
index 807cecf..f9518de 100644
--- a/tools/h5diff/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -21,7 +21,7 @@
/*-------------------------------------------------------------------------
- * Function: array_diff
+ * Function: diff_array
*
* Purpose: compare array;
* currenttly only the NATIVE types below are supported
@@ -34,8 +34,14 @@
*
*-------------------------------------------------------------------------
*/
-int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims,
- options_t options, const char *obj1, const char *obj2,
+int diff_array( void *buf1,
+ void *buf2,
+ hsize_t tot_cnt,
+ int rank,
+ hsize_t *dims,
+ diff_opt_t options,
+ const char *obj1,
+ const char *obj2,
hid_t m_type )
{
char fmt_llong[255], fmt_ullong[255];
diff --git a/tools/h5diff/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 1ecfb2a..15a8769 100644
--- a/tools/h5diff/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -36,8 +36,11 @@
*
*-------------------------------------------------------------------------
*/
-int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
- const char *obj2_name, options_t options )
+int diff_dataset( hid_t file1_id,
+ hid_t file2_id,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t options )
{
hid_t dset1_id =-1;
hid_t dset2_id =-1;
@@ -266,10 +269,10 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
{
printf("Warning: Different storage datatype\n");
printf("<%s> has file datatype ", obj1_name);
- print_datatype(f_type1);
+ print_type(f_type1);
printf("\n");
printf("<%s> has file datatype ", obj2_name);
- print_datatype(f_type2);
+ print_type(f_type2);
printf("\n");
}
@@ -289,12 +292,12 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
#endif
/*-------------------------------------------------------------------------
- * check for the comparable types in array_diff
+ * check for the comparable types in diff_array
*-------------------------------------------------------------------------
*/
- can1=h5diff_can_diff(m_type1);
- can2=h5diff_can_diff(m_type2);
+ can1=diff_can(m_type1);
+ can2=diff_can(m_type2);
if ( can1==0 || can2==0 )
{
printf("Comparison not supported\n");
@@ -373,9 +376,9 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
*/
if (options.verbose)
printf( "Comparing <%s> with <%s>\n", obj1_name, obj2_name );
- name1=h5diff_basename(obj1_name);
- name2=h5diff_basename(obj2_name);
- nfound = array_diff(buf1,buf2,tot_cnt1,rank1,dims1,options,name1,name2,m_type1);
+ name1=diff_basename(obj1_name);
+ name2=diff_basename(obj2_name);
+ nfound = diff_array(buf1,buf2,tot_cnt1,rank1,dims1,options,name1,name2,m_type1);
if (options.verbose)
printf("%d differences found\n", nfound );
diff --git a/tools/h5diff/h5diff_util.c b/tools/lib/h5diff_util.c
index 6ecd988..0bf4a8e 100644
--- a/tools/h5diff/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -18,14 +18,14 @@
/*-------------------------------------------------------------------------
- * Function: h5diff_can_diff
+ * Function: diff_can
*
* Purpose: Check if TYPE_ID is supported; only the listed types are
* supported in the current version
*
*-------------------------------------------------------------------------
*/
-int h5diff_can_diff(hid_t type_id)
+int diff_can(hid_t type_id)
{
int ret=0;
if ( (H5Tequal(type_id, H5T_NATIVE_FLOAT)==1)||
@@ -59,10 +59,6 @@ int h5diff_can_diff(hid_t type_id)
*
* Date: May 9, 2003
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void print_pos( int *ph, int p, unsigned int curr_pos, int *acc,
@@ -114,8 +110,6 @@ void print_pos( int *ph, int p, unsigned int curr_pos, int *acc,
*
* Date: May 9, 2003
*
- * Comments:
- *
*-------------------------------------------------------------------------
*/
void print_dims( int r, hsize_t *d )
@@ -129,11 +123,11 @@ void print_dims( int r, hsize_t *d )
/*-------------------------------------------------------------------------
- * Function: print_datatype
+ * Function: print_type
*
* Purpose: Print name of datatype
*
- * Return:
+ * Return: void
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -143,7 +137,7 @@ void print_dims( int r, hsize_t *d )
*
*-------------------------------------------------------------------------
*/
-void print_datatype(hid_t type)
+void print_type(hid_t type)
{
switch (H5Tget_class(type))
{
@@ -233,7 +227,7 @@ void print_datatype(hid_t type)
/*-------------------------------------------------------------------------
- * Function: h5diff_basename
+ * Function: diff_basename
*
* Purpose: Returns a pointer to the last component absolute name
*
@@ -241,12 +235,10 @@ void print_datatype(hid_t type)
*
* Date: May 9, 2003
*
- * Comments:
- *
*-------------------------------------------------------------------------
*/
const char*
-h5diff_basename(const char *name)
+diff_basename(const char *name)
{
size_t i;
@@ -271,8 +263,6 @@ h5diff_basename(const char *name)
*
* Date: May 9, 2003
*
- * Comments:
- *
*-------------------------------------------------------------------------
*/
const char*
@@ -330,8 +320,6 @@ get_sign(H5T_sign_t sign)
*
* Date: May 9, 2003
*
- * Comments:
- *
*-------------------------------------------------------------------------
*/
const char*
@@ -395,23 +383,23 @@ void print_sizes( const char *obj1, const char *obj2,
printf("sizeof(long) %u\n", sizeof(long) );
printf("<%s> ------------------\n", obj1);
printf("type on file ");
- print_datatype(f_type1);
+ print_type(f_type1);
printf("\n");
printf("size on file %u\n", f_size1 );
printf("type on memory ");
- print_datatype(m_type1);
+ print_type(m_type1);
printf("\n");
printf("size on memory %u\n", m_size1 );
printf("<%s> ------------------\n", obj2);
printf("type on file ");
- print_datatype(f_type2);
+ print_type(f_type2);
printf("\n");
printf("size on file %u\n", f_size2 );
printf("type on memory ");
- print_datatype(m_type2);
+ print_type(m_type2);
printf("\n");
printf("size on memory %u\n", m_size2 );
printf("\n");
diff --git a/tools/h5diff/h5trav.c b/tools/lib/h5trav.c
index f64bd37..09c2033 100644
--- a/tools/h5diff/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -19,43 +19,51 @@
/* functions for traversal */
-int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info, int *idx );
-herr_t get_nobjects( hid_t loc_id, const char *group_name );
-herr_t get_name_type( hid_t loc_id, const char *group_name, int idx, char **name, int *type );
+int traverse( hid_t loc_id,
+ const char *group_name,
+ trav_table_t *table,
+ trav_info_t *info,
+ int *idx );
+
+herr_t get_nobjects( hid_t loc_id,
+ const char *group_name );
+
+herr_t get_name_type( hid_t loc_id,
+ const char *group_name,
+ int idx,
+ char **name,
+ int *type );
/*-------------------------------------------------------------------------
- * Function: H5get_object_info
+ * Function: h5trav_getinfo
*
- * Purpose:
+ * Purpose: get an array of "trav_info_t" , containing the name and type of
+ * objects in the file
*
- * Return:
+ * Return: number of objects in file
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 6, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-int H5get_object_info( hid_t file_id, info_t *info )
+int h5trav_getinfo( hid_t file_id, trav_info_t *info )
{
- table_t *table=NULL;
- int nobjects=0;
+ trav_table_t *table=NULL;
+ int nobjects=0;
/* init table */
- table_init( &table );
+ trav_table_init( &table );
/* iterate starting on the root group */
if (( nobjects = traverse( file_id, "/", table, info, &nobjects )) < 0 )
return -1;
/* free table */
- table_free( table );
+ trav_table_free( table );
return nobjects;
@@ -63,7 +71,7 @@ int H5get_object_info( hid_t file_id, info_t *info )
/*-------------------------------------------------------------------------
- * Function: info_getindex
+ * Function: h5trav_getindex
*
* Purpose: get index of OBJ in list
*
@@ -73,14 +81,10 @@ int H5get_object_info( hid_t file_id, info_t *info )
*
* Date: May 9, 2003
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-int info_getindex( const char *obj, int nobjs, info_t *info )
+int h5trav_getindex( const char *obj, int nobjs, trav_info_t *info )
{
char *pdest;
int result;
@@ -104,14 +108,14 @@ int info_getindex( const char *obj, int nobjs, info_t *info )
/*-------------------------------------------------------------------------
- * Function: info_free
+ * Function: h5trav_freeinfo
*
* Purpose: free info memory
*
*-------------------------------------------------------------------------
*/
-void info_free( info_t *info, int nobjs )
+void h5trav_freeinfo( trav_info_t *info, int nobjs )
{
int i;
if ( info )
@@ -213,8 +217,8 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data)
if (H5Gget_objinfo( loc_id, name, 0, &statbuf) < 0 )
return -1;
- ((info_t *)op_data)->type = statbuf.type;
- ((info_t *)op_data)->name = (char *)HDstrdup(name);
+ ((trav_info_t *)op_data)->type = statbuf.type;
+ ((trav_info_t *)op_data)->name = (char *)HDstrdup(name);
/* Define 1 for return. This will cause the iterator to stop */
return 1;
@@ -245,7 +249,7 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data)
herr_t get_name_type( hid_t loc_id, const char *group_name, int idx, char **name, int *type )
{
- info_t info;
+ trav_info_t info;
if (H5Giterate( loc_id, group_name, &idx, opget_info, (void *)&info) < 0 )
return -1;
@@ -259,22 +263,22 @@ herr_t get_name_type( hid_t loc_id, const char *group_name, int idx, char **name
/*-------------------------------------------------------------------------
* Function: traverse
*
- * Purpose:
+ * Purpose: recursive function that searches HDF5 objects in LOC_ID
*
- * Return:
+ * Return: number of objects found in LOC_ID
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 4, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info, int *idx )
+int traverse( hid_t loc_id,
+ const char *group_name,
+ trav_table_t *table,
+ trav_info_t *info,
+ int *idx )
{
char *name=NULL;
@@ -334,10 +338,10 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.nlink > 0 && table_search_obj(statbuf.objno, table ) == -1)
+ if (statbuf.nlink > 0 && trav_table_search(statbuf.objno, table ) == -1)
{
/* add object to table */
- table_add_obj(statbuf.objno, path, H5G_GROUP, table );
+ trav_table_add(statbuf.objno, path, H5G_GROUP, table );
/* recurse with the absolute name */
inserted_objs += traverse( loc_id, path, table, info, idx );
@@ -347,7 +351,7 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
group with more than one link to it */
if (statbuf.nlink > 1)
{
- if ((j = table_search_obj(statbuf.objno, table )) < 0 )
+ if ((j = trav_table_search(statbuf.objno, table )) < 0 )
return -1;
if ( table->objs[j].displayed == 0 )
@@ -374,17 +378,17 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.nlink > 0 && table_search_obj(statbuf.objno, table ) == -1)
+ if (statbuf.nlink > 0 && trav_table_search(statbuf.objno, table ) == -1)
{
/* add object to table */
- table_add_obj(statbuf.objno, path, H5G_DATASET, table );
+ trav_table_add(statbuf.objno, path, H5G_DATASET, table );
}
/* search table
dataset with more than one link to it */
if (statbuf.nlink > 1)
{
- if ((j = table_search_obj(statbuf.objno, table )) < 0 )
+ if ((j = trav_table_search(statbuf.objno, table )) < 0 )
return -1;
if ( table->objs[j].displayed == 0 )
@@ -412,10 +416,10 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.nlink > 0 && table_search_obj(statbuf.objno, table ) == -1)
+ if (statbuf.nlink > 0 && trav_table_search(statbuf.objno, table ) == -1)
{
/* add object to table */
- table_add_obj(statbuf.objno, path, H5G_TYPE, table );
+ trav_table_add(statbuf.objno, path, H5G_TYPE, table );
}
break;
@@ -452,8 +456,6 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
} /* i */
-
-
return inserted_objs;
}
diff --git a/tools/h5diff/h5trav.h b/tools/lib/h5trav.h
index 250e0c3..cb61cd1 100644
--- a/tools/h5diff/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -19,45 +19,50 @@
/*-------------------------------------------------------------------------
- * struct to store name and type of an object
+ * public struct to store name and type of an object
+ * the TYPE can be:
+ * H5G_UNKNOWN = -1,
+ * H5G_LINK, Object is a symbolic link
+ * H5G_GROUP, Object is a group
+ * H5G_DATASET, Object is a dataset
+ * H5G_TYPE, Object is a named data type
*-------------------------------------------------------------------------
*/
-typedef struct info_t {
- char *name;
- int type;
-} info_t;
-
+typedef struct trav_info_t {
+ char *name;
+ H5G_obj_t type;
+} trav_info_t;
/*-------------------------------------------------------------------------
- * struct to store basic info about an object
+ * struct to store basic info needed for the h5trav table traversal algorythm
*-------------------------------------------------------------------------
*/
-typedef struct obj_t {
- haddr_t objno;
- unsigned flags[2];
- char *objname;
- int displayed;
- int type;
-} obj_t;
+typedef struct trav_obj_t {
+ haddr_t objno;
+ unsigned flags[2];
+ char *objname;
+ int displayed;
+ H5G_obj_t type;
+} trav_obj_t;
/*-------------------------------------------------------------------------
- * struct that stores all objects, excluding shared objects
+ * private struct that stores all objects
*-------------------------------------------------------------------------
*/
-typedef struct table_t {
- int size;
- int nobjs;
- obj_t *objs;
-} table_t;
+typedef struct trav_table_t {
+ int size;
+ int nobjs;
+ trav_obj_t *objs;
+} trav_table_t;
/*-------------------------------------------------------------------------
- * "info" public functions
+ * "h5trav info" public functions
*-------------------------------------------------------------------------
*/
@@ -65,9 +70,9 @@ typedef struct table_t {
extern "C" {
#endif
-int H5get_object_info( hid_t file_id, info_t *info );
-int info_getindex( const char *obj, int nobjs, info_t *info );
-void info_free(info_t *info, int nobjs);
+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 );
#ifdef __cplusplus
}
@@ -78,11 +83,11 @@ void info_free(info_t *info, int nobjs);
*-------------------------------------------------------------------------
*/
-void table_init(table_t **table);
-void table_free(table_t *table);
-int table_search_obj(haddr_t objno, table_t *table );
-void table_add_obj(haddr_t objno, char *objname, int type, table_t *table);
-void table_add_flags(unsigned *flags, char *objname, int type, table_t *table);
+void trav_table_init(trav_table_t **table);
+void trav_table_free(trav_table_t *table);
+int trav_table_search(haddr_t objno, trav_table_t *table );
+void trav_table_add(haddr_t objno, char *objname, int type, trav_table_t *table);
+void trav_table_addflags(unsigned *flags, char *objname, int type, trav_table_t *table);
diff --git a/tools/h5diff/h5trav_table.c b/tools/lib/h5trav_table.c
index a6943bc..8d29c7c 100644
--- a/tools/h5diff/h5trav_table.c
+++ b/tools/lib/h5trav_table.c
@@ -13,28 +13,24 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "h5diff.h"
+#include "h5trav.h"
#include "H5private.h"
/*-------------------------------------------------------------------------
- * Function: table_search_obj
+ * Function: trav_table_search
*
- * Purpose:
+ * Purpose: Search in the table for OBJNO
*
- * Return:
+ * Return: index of object in table
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 4, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-int table_search_obj(haddr_t objno, table_t *table )
+int trav_table_search(haddr_t objno, trav_table_t *table )
{
int i;
@@ -47,31 +43,28 @@ int table_search_obj(haddr_t objno, table_t *table )
/*-------------------------------------------------------------------------
- * Function: table_add_obj
+ * Function: trav_table_add
*
- * Purpose:
+ * Purpose: Add OBJNO, NAME and TYPE of object to table
*
- * Return:
+ * Return: void
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 4, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
-table_add_obj(haddr_t objno, char *objname, int type, table_t *table)
+trav_table_add(haddr_t objno, char *objname, int type, trav_table_t *table)
{
int i;
if (table->nobjs == table->size) {
table->size *= 2;
- table->objs = (obj_t*)HDrealloc(table->objs, table->size * sizeof(obj_t));
+ table->objs =
+ (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
for (i = table->nobjs; i < table->size; i++) {
table->objs[i].objno = 0;
@@ -92,31 +85,28 @@ table_add_obj(haddr_t objno, char *objname, int type, table_t *table)
/*-------------------------------------------------------------------------
- * Function: table_add_flags
+ * Function: trav_table_addflags
*
- * Purpose:
+ * Purpose: Add FLAGS, NAME and TYPE of object to table
*
- * Return:
+ * Return: void
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 4, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
-table_add_flags(unsigned *flags, char *objname, int type, table_t *table)
+trav_table_addflags(unsigned *flags, char *objname, int type, trav_table_t *table)
{
int i;
if (table->nobjs == table->size) {
table->size *= 2;
- table->objs = (obj_t*)HDrealloc(table->objs, table->size * sizeof(obj_t));
+ table->objs =
+ (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
for (i = table->nobjs; i < table->size; i++) {
table->objs[i].objno = 0;
@@ -138,31 +128,28 @@ table_add_flags(unsigned *flags, char *objname, int type, table_t *table)
/*-------------------------------------------------------------------------
- * Function: table_init
+ * Function: trav_table_init
*
- * Purpose:
+ * Purpose: Initialize the table
*
- * Return:
+ * Return: void
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 4, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void table_init( table_t **tbl )
+void trav_table_init( trav_table_t **tbl )
{
int i;
- table_t* table = (table_t*) HDmalloc(sizeof(table_t));
+ trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t));
table->size = 20;
table->nobjs = 0;
- table->objs = (obj_t*) HDmalloc(table->size * sizeof(obj_t));
+ table->objs =
+ (trav_obj_t*)HDmalloc(table->size * sizeof(trav_obj_t));
for (i = 0; i < table->size; i++) {
table->objs[i].objno = 0;
@@ -178,24 +165,20 @@ void table_init( table_t **tbl )
/*-------------------------------------------------------------------------
- * Function: table_free
+ * Function: trav_table_free
*
* Purpose: free table memory
*
- * Return:
+ * Return: void
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Date: November 4, 2002
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void table_free( table_t *table )
+void trav_table_free( trav_table_t *table )
{
int i;