summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
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 /tools/h5repack
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:
Diffstat (limited to 'tools/h5repack')
-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
10 files changed, 76 insertions, 78 deletions
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;