diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5repack/h5repack.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 3 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 3 | ||||
-rw-r--r-- | tools/h5repack/h5repack_list.c | 4 | ||||
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_parse.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 5 | ||||
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 3 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 5 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_detect_szip.c | 3 | ||||
-rw-r--r-- | tools/lib/Makefile.am | 2 | ||||
-rw-r--r-- | tools/lib/Makefile.in | 7 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 238 | ||||
-rw-r--r-- | tools/lib/h5trav_table.c | 257 |
15 files changed, 259 insertions, 279 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index ade6cc1..5ebd68b 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -15,8 +15,8 @@ #include <stdlib.h> #include <string.h> -#include "h5tools_utils.h" #include "h5repack.h" +#include "h5tools_utils.h" extern char *progname; diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index e59e7dc..a397d0a 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -19,8 +19,7 @@ #include "hdf5.h" #include "h5trav.h" -#include "h5diff.h" -#include "h5tools.h" + #define H5FOPENERROR "unable to open file" diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 1782502..4253678 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -16,10 +16,10 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include "h5repack.h" #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" -#include "h5repack.h" extern char *progname; diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 4ed1fad..32b2e36 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -13,9 +13,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdf5.h" -#include "h5test.h" #include "h5repack.h" +#include "h5test.h" /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 203f8a2..3de8101 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -16,9 +16,11 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include "h5repack.h" #include "H5private.h" #include "h5tools_utils.h" -#include "h5repack.h" +#include "h5diff.h" +#include "h5tools.h" extern char *progname; diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 2ac7890..8492885 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -15,8 +15,8 @@ #include <stdlib.h> #include <string.h> -#include "h5tools_utils.h" #include "h5repack.h" +#include "h5tools_utils.h" extern char *progname; diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 4623828..cf78cac 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -17,8 +17,8 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "h5tools_utils.h" #include "h5repack.h" +#include "h5tools_utils.h" extern char *progname; diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 3b272c8..538c99f 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -18,8 +18,11 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> -#include "H5private.h" #include "h5repack.h" +#include "H5private.h" +#include "h5diff.h" +#include "h5tools.h" + /*------------------------------------------------------------------------- * local functions diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 7a2fae9..049e059 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -13,10 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdf5.h" +#include "h5repack.h" #include "h5test.h" #include "h5tools_utils.h" -#include "h5repack.h" extern char *progname; diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 81c0e3c..38e050c 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -13,11 +13,10 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "hdf5.h" -#include "h5test.h" #include "h5repack.h" +#include "h5test.h" #include "h5diff.h" +#include "h5tools.h" #define GOERROR {H5_FAILED(); goto error;} diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 31999bb..9e6d74e 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -14,9 +14,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <stdio.h> -#include "hdf5.h" -#include "h5test.h" #include "h5repack.h" +#include "h5test.h" diff --git a/tools/lib/Makefile.am b/tools/lib/Makefile.am index 69ad1a7..c7e26e0 100644 --- a/tools/lib/Makefile.am +++ b/tools/lib/Makefile.am @@ -28,7 +28,7 @@ noinst_LTLIBRARIES=libh5tools.la libh5tools_la_SOURCES=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c \ h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c \ - h5trav_table.c h5tools_filters.c h5tools_ref.c h5tools_type.c + h5tools_filters.c h5tools_ref.c h5tools_type.c # Test program. Link using libhdf5 and libh5tools TEST_PROG=talign diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 9c6f8b7..9a37cc2 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -69,8 +69,8 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) libh5tools_la_LIBADD = am_libh5tools_la_OBJECTS = h5tools.lo h5tools_str.lo h5tools_utils.lo \ h5diff.lo h5diff_array.lo h5diff_attr.lo h5diff_dset.lo \ - h5diff_util.lo h5trav.lo h5trav_table.lo h5tools_filters.lo \ - h5tools_ref.lo h5tools_type.lo + h5diff_util.lo h5trav.lo h5tools_filters.lo h5tools_ref.lo \ + h5tools_type.lo libh5tools_la_OBJECTS = $(am_libh5tools_la_OBJECTS) am__EXEEXT_1 = talign$(EXEEXT) talign_SOURCES = talign.c @@ -338,7 +338,7 @@ INCLUDES = -I$(top_srcdir)/src noinst_LTLIBRARIES = libh5tools.la libh5tools_la_SOURCES = h5tools.c h5tools_str.c h5tools_utils.c h5diff.c \ h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c \ - h5trav_table.c h5tools_filters.c h5tools_ref.c h5tools_type.c + h5tools_filters.c h5tools_ref.c h5tools_type.c # Test program. Link using libhdf5 and libh5tools @@ -437,7 +437,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools_type.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools_utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5trav.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5trav_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/talign.Po@am__quote@ .c.o: diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 3646827..456b56b 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -715,3 +715,241 @@ static int traverse( hid_t loc_id, return inserted_objs; } +/*------------------------------------------------------------------------- + * Function: trav_table_search + * + * Purpose: Search in the table for OBJNO + * + * Return: index of object in table + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 4, 2002 + * + *------------------------------------------------------------------------- + */ + +int trav_table_search(haddr_t objno, trav_table_t *table ) +{ + unsigned int i; + + for (i = 0; i < table->nobjs; i++) + if (table->objs[i].objno == objno) + return i; + + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: trav_table_add + * + * Purpose: Add OBJNO, NAME and TYPE of object to table + * + * Return: void + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 4, 2002 + * + *------------------------------------------------------------------------- + */ + +void trav_table_add(haddr_t objno, + char *name, + H5G_obj_t type, + trav_table_t *table) +{ + unsigned int i; + + if (table->nobjs == table->size) { + table->size *= 2; + 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; + table->objs[i].flags[0] = table->objs[i].flags[1] = 0; + table->objs[i].displayed = 0; + table->objs[i].type = H5G_UNKNOWN; + table->objs[i].name = NULL; + table->objs[i].links = NULL; + table->objs[i].nlinks = 0; + table->objs[i].sizelinks = 0; + } + } + + i = table->nobjs++; + table->objs[i].objno = objno; + table->objs[i].flags[0] = table->objs[i].flags[1] = 0; + HDfree(table->objs[i].name); + table->objs[i].name = (char *)HDstrdup(name); + table->objs[i].type = type; + table->objs[i].links = NULL; + table->objs[i].nlinks = 0; +} + + +/*------------------------------------------------------------------------- + * Function: trav_table_addflags + * + * Purpose: Add FLAGS, NAME and TYPE of object to table + * + * Return: void + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 4, 2002 + * + *------------------------------------------------------------------------- + */ + +void trav_table_addflags(unsigned *flags, + char *name, + H5G_obj_t type, + trav_table_t *table) +{ + unsigned int i; + + if (table->nobjs == table->size) { + table->size *= 2; + 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; + table->objs[i].flags[0] = table->objs[i].flags[1] = 0; + table->objs[i].displayed = 0; + table->objs[i].type = H5G_UNKNOWN; + table->objs[i].name = NULL; + table->objs[i].links = NULL; + table->objs[i].nlinks = 0; + table->objs[i].sizelinks = 0; + } + } + + i = table->nobjs++; + table->objs[i].objno = 0; + table->objs[i].flags[0] = flags[0]; + table->objs[i].flags[1] = flags[1]; + HDfree(table->objs[i].name); + table->objs[i].name = (char *)HDstrdup(name); + table->objs[i].type = type; + table->objs[i].links = NULL; + table->objs[i].nlinks = 0; +} + + +/*------------------------------------------------------------------------- + * Function: trav_table_init + * + * Purpose: Initialize the table + * + * Return: void + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 4, 2002 + * + *------------------------------------------------------------------------- + */ + +void trav_table_init( trav_table_t **tbl ) +{ + unsigned int i; + trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t)); + + table->size = 20; + table->nobjs = 0; + table->objs = + (trav_obj_t*)HDmalloc(table->size * sizeof(trav_obj_t)); + + for (i = 0; i < table->size; i++) { + table->objs[i].objno = 0; + table->objs[i].flags[0] = table->objs[i].flags[1] = 0; + table->objs[i].displayed = 0; + table->objs[i].type = H5G_UNKNOWN; + table->objs[i].name = NULL; + table->objs[i].links = NULL; + table->objs[i].nlinks = 0; + table->objs[i].sizelinks = 0; + } + + *tbl = table; +} + + + +/*------------------------------------------------------------------------- + * Function: trav_table_free + * + * Purpose: free table memory + * + * Return: void + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 4, 2002 + * + *------------------------------------------------------------------------- + */ + +void trav_table_free( trav_table_t *table ) +{ + unsigned int i, j; + + for ( i = 0; i < table->nobjs; i++) + { + HDfree( table->objs[i].name ); + if (table->objs[i].nlinks) + { + for ( j=0; j<table->objs[i].nlinks; j++) + HDfree( table->objs[i].links[j].new_name ); + + HDfree(table->objs[i].links); + } + } + HDfree(table->objs); + HDfree(table); + +} + + +/*------------------------------------------------------------------------- + * Function: trav_table_addlink + * + * Purpose: Add a hardlink name to the object + * + * Return: void + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: December 17, 2003 + * + *------------------------------------------------------------------------- + */ + +void trav_table_addlink(trav_table_t *table, + int j /* the object index */, + char *path ) +{ + unsigned int k; + + /* already inserted */ + if (strcmp(table->objs[j].name,path)==0) + return; + + /* allocate space if necessary */ + if (table->objs[j].nlinks == (unsigned)table->objs[j].sizelinks) { + table->objs[j].sizelinks += 2; + table->objs[j].links = + (trav_link_t*)HDrealloc(table->objs[j].links, + table->objs[j].sizelinks * sizeof(trav_link_t)); + } + + /* insert it */ + k=table->objs[j].nlinks++; + table->objs[j].links[k].new_name = (char*)HDstrdup(path); +} + + diff --git a/tools/lib/h5trav_table.c b/tools/lib/h5trav_table.c deleted file mode 100644 index c16938b..0000000 --- a/tools/lib/h5trav_table.c +++ /dev/null @@ -1,257 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -#include "h5trav.h" -#include "H5private.h" - -/*------------------------------------------------------------------------- - * Function: trav_table_search - * - * Purpose: Search in the table for OBJNO - * - * Return: index of object in table - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - *------------------------------------------------------------------------- - */ - -int trav_table_search(haddr_t objno, trav_table_t *table ) -{ - unsigned int i; - - for (i = 0; i < table->nobjs; i++) - if (table->objs[i].objno == objno) - return i; - - return -1; -} - - -/*------------------------------------------------------------------------- - * Function: trav_table_add - * - * Purpose: Add OBJNO, NAME and TYPE of object to table - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - *------------------------------------------------------------------------- - */ - -void trav_table_add(haddr_t objno, - char *name, - H5G_obj_t type, - trav_table_t *table) -{ - unsigned int i; - - if (table->nobjs == table->size) { - table->size *= 2; - 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; - table->objs[i].flags[0] = table->objs[i].flags[1] = 0; - table->objs[i].displayed = 0; - table->objs[i].type = H5G_UNKNOWN; - table->objs[i].name = NULL; - table->objs[i].links = NULL; - table->objs[i].nlinks = 0; - table->objs[i].sizelinks = 0; - } - } - - i = table->nobjs++; - table->objs[i].objno = objno; - table->objs[i].flags[0] = table->objs[i].flags[1] = 0; - HDfree(table->objs[i].name); - table->objs[i].name = (char *)HDstrdup(name); - table->objs[i].type = type; - table->objs[i].links = NULL; - table->objs[i].nlinks = 0; -} - - -/*------------------------------------------------------------------------- - * Function: trav_table_addflags - * - * Purpose: Add FLAGS, NAME and TYPE of object to table - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - *------------------------------------------------------------------------- - */ - -void trav_table_addflags(unsigned *flags, - char *name, - H5G_obj_t type, - trav_table_t *table) -{ - unsigned int i; - - if (table->nobjs == table->size) { - table->size *= 2; - 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; - table->objs[i].flags[0] = table->objs[i].flags[1] = 0; - table->objs[i].displayed = 0; - table->objs[i].type = H5G_UNKNOWN; - table->objs[i].name = NULL; - table->objs[i].links = NULL; - table->objs[i].nlinks = 0; - table->objs[i].sizelinks = 0; - } - } - - i = table->nobjs++; - table->objs[i].objno = 0; - table->objs[i].flags[0] = flags[0]; - table->objs[i].flags[1] = flags[1]; - HDfree(table->objs[i].name); - table->objs[i].name = (char *)HDstrdup(name); - table->objs[i].type = type; - table->objs[i].links = NULL; - table->objs[i].nlinks = 0; -} - - -/*------------------------------------------------------------------------- - * Function: trav_table_init - * - * Purpose: Initialize the table - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - *------------------------------------------------------------------------- - */ - -void trav_table_init( trav_table_t **tbl ) -{ - unsigned int i; - trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t)); - - table->size = 20; - table->nobjs = 0; - table->objs = - (trav_obj_t*)HDmalloc(table->size * sizeof(trav_obj_t)); - - for (i = 0; i < table->size; i++) { - table->objs[i].objno = 0; - table->objs[i].flags[0] = table->objs[i].flags[1] = 0; - table->objs[i].displayed = 0; - table->objs[i].type = H5G_UNKNOWN; - table->objs[i].name = NULL; - table->objs[i].links = NULL; - table->objs[i].nlinks = 0; - table->objs[i].sizelinks = 0; - } - - *tbl = table; -} - - - -/*------------------------------------------------------------------------- - * Function: trav_table_free - * - * Purpose: free table memory - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - *------------------------------------------------------------------------- - */ - -void trav_table_free( trav_table_t *table ) -{ - unsigned int i, j; - - for ( i = 0; i < table->nobjs; i++) - { - HDfree( table->objs[i].name ); - if (table->objs[i].nlinks) - { - for ( j=0; j<table->objs[i].nlinks; j++) - HDfree( table->objs[i].links[j].new_name ); - - HDfree(table->objs[i].links); - } - } - HDfree(table->objs); - HDfree(table); - -} - - -/*------------------------------------------------------------------------- - * Function: trav_table_addlink - * - * Purpose: Add a hardlink name to the object - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 17, 2003 - * - *------------------------------------------------------------------------- - */ - -void trav_table_addlink(trav_table_t *table, - int j /* the object index */, - char *path ) -{ - unsigned int k; - - /* already inserted */ - if (strcmp(table->objs[j].name,path)==0) - return; - - /* allocate space if necessary */ - if (table->objs[j].nlinks == (unsigned)table->objs[j].sizelinks) { - table->objs[j].sizelinks += 2; - table->objs[j].links = - (trav_link_t*)HDrealloc(table->objs[j].links, - table->objs[j].sizelinks * sizeof(trav_link_t)); - } - - /* insert it */ - k=table->objs[j].nlinks++; - table->objs[j].links[k].new_name = (char*)HDstrdup(path); -} - - |