summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-06-10 16:20:29 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-06-10 16:20:29 (GMT)
commitf4492a33c1bc1f794e5887fc76f3dc365d56d181 (patch)
treea853bcc5395605f430d5848824e08c19521cab3d /tools
parent2a7d7e5121587291d551460275d3b8e1e8daee49 (diff)
downloadhdf5-f4492a33c1bc1f794e5887fc76f3dc365d56d181.zip
hdf5-f4492a33c1bc1f794e5887fc76f3dc365d56d181.tar.gz
hdf5-f4492a33c1bc1f794e5887fc76f3dc365d56d181.tar.bz2
[svn-r8643] Purpose:
h5dump new features Description: added the code for print strings with new line and display the path of references (new source files h5tools_ref.c and .h ) added a test suite in testh5dump.sh.in for ( note : to create testh5dump.sh , one must redo ./configure; this detects the availability of filters and generates testh5dump.sh accordingly) 1) storage layout 2) fill value 3) print reference with path 4) print strings with new lines 5) filters Solution: Platforms tested: linux solaris AIX Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c469
-rw-r--r--tools/h5dump/h5dumpgentest.c60
-rw-r--r--tools/h5dump/testh5dump.sh.in73
-rw-r--r--tools/h5ls/h5ls.c5
-rw-r--r--tools/lib/Makefile.in2
-rw-r--r--tools/lib/h5tools.h5
-rw-r--r--tools/lib/h5tools_ref.c389
-rw-r--r--tools/lib/h5tools_ref.h48
-rw-r--r--tools/lib/h5tools_str.c17
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/testfiles/tchunked.ddl18
-rw-r--r--tools/testfiles/tcompact.ddl18
-rw-r--r--tools/testfiles/tcontiguos.ddl8
-rw-r--r--tools/testfiles/tdeflate.ddl20
-rw-r--r--tools/testfiles/texternal.ddl18
-rw-r--r--tools/testfiles/tfillearly.ddl17
-rw-r--r--tools/testfiles/tfillifset.ddl17
-rw-r--r--tools/testfiles/tfillnever.ddl17
-rw-r--r--tools/testfiles/tfletcher32.ddl20
-rw-r--r--tools/testfiles/treference.ddl14
-rw-r--r--tools/testfiles/tshuffle.ddl20
-rw-r--r--tools/testfiles/tstring.ddl20
-rw-r--r--tools/testfiles/tszip.ddl8
-rw-r--r--tools/testfiles/tuserfilter.ddl9
24 files changed, 862 insertions, 432 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index e3f05f5..5bc3eeb 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -18,12 +18,13 @@
#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
+#include "h5tools_ref.h"
#include "h5trav.h"
/* module-scoped variables */
-static const char *progname = "h5dump";
+const char *progname = "h5dump";
/* 3 private values: can't be set, but can be read.
Note: these are defined in H5Zprivate, they are
@@ -33,11 +34,11 @@ static const char *progname = "h5dump";
#define H5_SZIP_MSB_OPTION_MASK 16
#define H5_SZIP_RAW_OPTION_MASK 128
-static int d_status = EXIT_SUCCESS;
+int d_status = EXIT_SUCCESS;
static int unamedtype = 0; /* shared data type with no name */
static size_t prefix_len = 1024;
static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
-static char *prefix;
+char *prefix;
static const char *driver = NULL; /* The driver to open the file with. */
static const dump_header *dump_header_format;
@@ -49,34 +50,26 @@ static int display_data = TRUE;
static int display_attr_data = TRUE;
static int display_char = FALSE; /*print 1-byte numbers as ASCII */
static int usingdasho = FALSE;
-static int display_bb = FALSE; /*superblock */
-static int display_dcpl = FALSE; /*dcpl */
+static int display_bb = FALSE; /*superblock */
+static int display_dcpl = FALSE; /*dcpl */
static int display_fi = FALSE; /*file index */
static int display_ai = TRUE; /*array index */
+static int display_lf = FALSE; /*do CR/LF */
/**
** Added for XML **
**/
-/* fill_ref_path_table is called to inialize the object reference paths. */
-static herr_t fill_ref_path_table(hid_t, const char *, void *);
-
/* module-scoped variables for XML option */
#define DEFAULT_XSD "http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.xsd"
#define DEFAULT_DTD "http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.dtd"
static int doxml = 0;
static int useschema = 1;
-static const char *xml_dtd_uri = NULL;
-static const char *xmlnsprefix="hdf5:";
-static hid_t thefile = -1;
-struct ref_path_table_entry_t {
- hid_t obj;
- hobj_ref_t *obj_ref;
- char *apath;
- H5G_stat_t statbuf;
- struct ref_path_table_entry_t *next;
-};
+static const char *xml_dtd_uri = NULL;
+static const char *xmlnsprefix="hdf5:";
+hid_t thefile = -1;
+
/** end XML **/
/* internal functions */
@@ -84,17 +77,7 @@ static hid_t h5_fileaccess(void);
static void dump_oid(hid_t oid);
static void print_enum(hid_t type);
static herr_t dump_all(hid_t group, const char *name, void *op_data);
-static char *lookup_ref_path(hobj_ref_t *);
-#ifdef LATER
-static void check_compression(hid_t);
-#endif /* LATER */
-static struct ref_path_table_entry_t *ref_path_table_lookup(const char *);
-static int xml_name_to_XID(const char *, char *, int , int );
-static int get_next_xid(void);
-static haddr_t get_fake_xid (void);
-
-/* external functions */
-extern int print_data(hid_t, hid_t, int);
+static int xml_name_to_XID(const char *, char *, int , int );
static h5dump_t dataformat = {
0, /*raw */
@@ -161,7 +144,8 @@ static h5dump_t dataformat = {
"%s", /*dset_blockformat_pre */
"%s", /*dset_ptformat_pre */
"%s", /*dset_ptformat */
- 1 /*array indices */
+ 1 , /*array indices */
+ 1 /*interpret CR/LF information */
};
/**
@@ -244,7 +228,8 @@ static h5dump_t xml_dataformat = {
"%s", /*dset_blockformat_pre */
"%s", /*dset_ptformat_pre */
"%s", /*dset_ptformat */
- 0 /*array indices */
+ 0, /*array indices */
+ 0 /*interpret CR/LF information */
};
/** XML **/
@@ -331,8 +316,6 @@ static void xml_print_datatype(hid_t, unsigned);
static void xml_print_enum(hid_t);
static int xml_print_refs(hid_t, int);
static int xml_print_strs(hid_t, int);
-static hobj_ref_t *ref_path_table_put(hid_t, const char *);
-static struct ref_path_table_entry_t *ref_path_table_gen_fake(const char *);
static char *xml_escape_the_string(const char *, int);
static char *xml_escape_the_name(const char *);
@@ -352,7 +335,7 @@ struct handler_t {
/* binary: not implemented yet */
static const char *s_opts = "hbBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A";
#else
-static const char *s_opts = "hnpBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A";
+static const char *s_opts = "hnpeBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A";
#endif /* 0 */
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
@@ -577,6 +560,7 @@ usage(const char *prog)
fprintf(stdout, " -A Print the header and value of attributes; data of datasets is not displayed\n");
fprintf(stdout, " -i, --object-ids Print the object ids\n");
fprintf(stdout, " -r, --string Print 1-byte integer datasets as ASCII\n");
+ fprintf(stdout, " -e, Interpret carriage return (\\n) as new line\n");
fprintf(stdout, " -V, --version Print version number and exit\n");
fprintf(stdout, " -a P, --attribute=P Print the specified attribute\n");
fprintf(stdout, " -d P, --dataset=P Print the specified dataset\n");
@@ -1937,6 +1921,9 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
depth=0;
}
+ /*interpret CR/LF information */
+ outputformat->do_lf=display_lf;
+
status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth);
H5Tclose(f_type);
@@ -2053,16 +2040,22 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
void *buf=NULL;
int nelmts=1;
h5dump_t *outputformat = &dataformat;
+ herr_t ret;
+ hid_t n_type;
memset(&ctx, 0, sizeof(ctx));
ctx.indent_level=2;
size = H5Tget_size(type_id);
buf = malloc(size);
- H5Pget_fill_value(dcpl, type_id, buf);
+ n_type = H5Tget_native_type(type_id,H5T_DIR_DEFAULT);
+
+ ret=H5Pget_fill_value(dcpl, n_type, buf);
h5tools_dump_simple_data(stdout, outputformat, obj_id, &ctx,
- START_OF_DATA | END_OF_DATA, nelmts, type_id, buf);
+ START_OF_DATA | END_OF_DATA, nelmts, n_type, buf);
+
+ H5Tclose(n_type);
if (buf)
free (buf);
@@ -2125,11 +2118,11 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
/*start indent */
indent += COL;
indentation(indent + COL);
- printf("SIZE %d ", storage_size);
+ HDfprintf(stdout, "SIZE %Hu ", storage_size);
rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize);
- printf("%s %d", dump_header_format->dataspacedimbegin, chsize[0]);
+ HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]);
for ( i=1; i<rank; i++)
- printf(", %d", chsize[i]);
+ HDfprintf(stdout, ", %Hu", chsize[i]);
printf(" %s\n", dump_header_format->dataspacedimend);
/*end indent */
indent -= COL;
@@ -2142,7 +2135,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
/*start indent */
indent += COL;
indentation(indent + COL);
- printf("SIZE %d\n", storage_size);
+ HDfprintf(stdout, "SIZE %Hu\n", storage_size);
/*end indent */
indent -= COL;
indentation(indent + COL);
@@ -2163,7 +2156,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
for ( i=0; i<next; i++) {
H5Pget_external(dcpl_id,i,sizeof(name),name,&offset,&size);
indentation(indent + COL);
- printf("FILENAME %s SIZE %d OFFSET %d\n",name,size,offset);
+ HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset);
}
/*end indent */
indent -= COL;
@@ -2177,7 +2170,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
/*start indent */
indent += COL;
indentation(indent + COL);
- printf("SIZE %d OFFSET %d\n", storage_size, ioffset);
+ HDfprintf(stdout,"SIZE %Hu OFFSET %Hu\n", storage_size, ioffset);
/*end indent */
indent -= COL;
indentation(indent + COL);
@@ -3019,6 +3012,9 @@ parse_start:
case 'p':
display_dcpl = TRUE;
break;
+ case 'e':
+ display_lf = TRUE;
+ break;
case 'H':
display_data = FALSE;
display_attr_data = FALSE;
@@ -3383,20 +3379,19 @@ main(int argc, const char *argv[])
info.dset_table = dset_table;
info.status = d_status;
+ thefile = fid;
+ /* find all objects that might be targets of a refernce */
+ if ((gid = H5Gopen(fid, "/")) < 0) {
+ error_msg(progname, "unable to open root group\n");
+ d_status = EXIT_FAILURE;
+ goto done;
+ }
+ ref_path_table_put(gid, "/");
+ H5Giterate(fid, "/", NULL, fill_ref_path_table, NULL);
+ H5Gclose(gid);
+
if (doxml) {
/* initialize XML */
- thefile = fid;
-
- /* find all objects that might be targets of a refernce */
- if ((gid = H5Gopen(fid, "/")) < 0) {
- error_msg(progname, "unable to open root group\n");
- d_status = EXIT_FAILURE;
- goto done;
- }
-
- ref_path_table_put(gid, "/");
- H5Giterate(fid, "/", NULL, fill_ref_path_table, NULL);
- H5Gclose(gid);
/* reset prefix! */
strcpy(prefix, "");
@@ -3551,7 +3546,7 @@ done:
/*-------------------------------------------------------------------------
* Function: print_enum
*
- * Purpose: prints the enum data -
+ * Purpose: prints the enum data
*
* Return: void
*
@@ -3651,370 +3646,6 @@ print_enum(hid_t type)
printf("\n%*s <empty>", indent + 4, "");
}
-/*
- * XML support
- */
-
-/*
- * XML needs a table to look up a path name for an object
- * reference.
- *
- * This table stores mappings of reference -> path
- * for all objects in the file that may be the target of
- * an object reference.
- *
- * The 'path' is an absolute path by which the object
- * can be accessed. When an object has > 1 such path,
- * only one will be used in the table, with no particular
- * method of selecting which one.
- */
-
-
-struct ref_path_table_entry_t *ref_path_table = NULL; /* the table */
-int npte = 0; /* number of entries in the table */
-
-/*-------------------------------------------------------------------------
- * Function: ref_path_table_lookup
- *
- * Purpose: Looks up a table entry given a path name.
- * Used during construction of the table.
- *
- * Return: The table entre (pte) or NULL if not in the
- * table.
- *
- * Programmer: REMcG
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static struct ref_path_table_entry_t *
-ref_path_table_lookup(const char *thepath)
-{
- int i;
- hobj_ref_t *ref;
- herr_t status;
- struct ref_path_table_entry_t *pte = ref_path_table;
-
- if (ref_path_table == NULL)
- return NULL;
-
- ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
-
- if (ref == NULL) {
- /* fatal error ? */
- return NULL;
- }
-
- status = H5Rcreate(ref, thefile, thepath, H5R_OBJECT, -1);
-
- if (status < 0) {
- /* fatal error ? */
- return NULL;
- }
-
- for (i = 0; i < npte; i++) {
- if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) {
- return pte;
- }
-
- pte = pte->next;
- }
-
- return NULL;
-}
-
-/*-------------------------------------------------------------------------
- * Function: ref_path_table_put
- *
- * Purpose: Enter the 'obj' with 'path' in the table if
- * not already there.
- * Create an object reference, pte, and store them
- * in the table.
- *
- * Return: The object reference for the object.
- *
- * Programmer: REMcG
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static hobj_ref_t *
-ref_path_table_put(hid_t obj, const char *path)
-{
- hobj_ref_t *ref;
- H5G_stat_t *sb;
- herr_t status;
- struct ref_path_table_entry_t *pte;
-
- /* look up 'obj'. If already in table, return */
- pte = ref_path_table_lookup(path);
- if (pte != NULL)
- return pte->obj_ref;
-
- /* if not found, then make new entry */
-
- pte = (struct ref_path_table_entry_t *)
- malloc(sizeof(struct ref_path_table_entry_t));
- if (pte == NULL) {
- /* fatal error? */
- return NULL;
- }
-
- pte->obj = obj;
- ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
- if (ref == NULL) {
- /* fatal error? */
- free(pte);
- return NULL;
- }
-
- status = H5Rcreate(ref, thefile, path, H5R_OBJECT, -1);
- if (status < 0) {
- /* fatal error? */
- free(ref);
- free(pte);
- return NULL;
- }
-
- pte->obj_ref = ref;
-
- pte->apath = HDstrdup(path);
-
- sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t));
- if (sb == NULL) {
- /* fatal error? */
- free(pte);
- return NULL;
- }
- H5Gget_objinfo(thefile, path, TRUE, sb);
-
- memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t));
-
- pte->next = ref_path_table;
- ref_path_table = pte;
-
- npte++;
-
- return ref;
-}
-
-/*
- * counter used to disambiguate multiple instances of same object.
- */
-static int xid = 1;
-
-static int get_next_xid() {
- return xid++;
-}
-
-/*
- * This counter is used to create fake object ID's
- * The idea is to set it to the largest possible offest, which
- * minimizes the chance of collision with a real object id.
- *
- */
-haddr_t fake_xid = HADDR_MAX;
-static haddr_t
-get_fake_xid () {
- return (fake_xid--);
-}
-
-/*
- * for an object that does not have an object id (e.g., soft link),
- * create a table entry with a fake object id as the key.
- */
-
-static struct ref_path_table_entry_t *
-ref_path_table_gen_fake(const char *path)
-{
- union {
- hobj_ref_t rr;
- char cc[16];
- unsigned long ll[2];
- } uu;
- hobj_ref_t *ref;
- H5G_stat_t *sb;
- struct ref_path_table_entry_t *pte;
-
- /* look up 'obj'. If already in table, return */
- pte = ref_path_table_lookup(path);
- if (pte != NULL) {
- return pte;
- }
-
- /* if not found, then make new entry */
-
- pte = (struct ref_path_table_entry_t *)
- malloc(sizeof(struct ref_path_table_entry_t));
- if (pte == NULL) {
- /* fatal error? */
- return NULL;
- }
-
- pte->obj = (hid_t)-1;
-
- sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t));
- if (sb == NULL) {
- /* fatal error? */
- free(pte);
- return NULL;
- }
- sb->objno[0] = (unsigned long)get_fake_xid();
- sb->objno[1] = (unsigned long)get_fake_xid();
-
- memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t));
-
- ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
- if (ref == NULL) {
- free(pte);
- return NULL;
- }
-
- uu.ll[0] = sb->objno[0];
- uu.ll[1] = sb->objno[1];
-
- memcpy((char *)ref,(char *)&uu.rr,sizeof(ref));
-
- pte->obj_ref = ref;
-
- pte->apath = HDstrdup(path);
-
- pte->next = ref_path_table;
- ref_path_table = pte;
-
- npte++;
-
- return pte;
-}
-
-/*-------------------------------------------------------------------------
- * Function: lookup_ref_path
- *
- * Purpose: Lookup the path to the object with refernce 'ref'.
- *
- * Return: Return a path to the object, or NULL if not found.
- *
- * Programmer: REMcG
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static char *
-lookup_ref_path(hobj_ref_t * ref)
-{
- int i;
- struct ref_path_table_entry_t *pte = NULL;
-
- if (ref_path_table == NULL)
- return NULL;
-
- pte = ref_path_table;
- if (pte == NULL) {
- /* fatal -- not initialized? */
- return NULL;
- }
- for (i = 0; i < npte; i++) {
- if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) {
- return pte->apath;
- }
- pte = pte->next;
- }
- return NULL;
-}
-
-/*-------------------------------------------------------------------------
- * Function: fill_ref_path_table
- *
- * Purpose: Called by interator to create references for
- * all objects and enter them in the table.
- *
- * Return: Error status.
- *
- * Programmer: REMcG
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data)
-{
- hid_t obj;
- char *tmp;
- H5G_stat_t statbuf;
- struct ref_path_table_entry_t *pte;
- char *thepath;
-
- H5Gget_objinfo(group, name, FALSE, &statbuf);
- tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2);
-
- if (tmp == NULL)
- return FAIL;
-
- thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2);
-
- if (thepath == NULL) {
- free(tmp);
- return FAIL;
- }
-
- strcpy(tmp, prefix);
-
- strcpy(thepath, prefix);
- strcat(thepath, "/");
- strcat(thepath, name);
-
- switch (statbuf.type) {
- case H5G_DATASET:
- if ((obj = H5Dopen(group, name)) >= 0) {
- pte = ref_path_table_lookup(thepath);
- if (pte == NULL) {
- ref_path_table_put(obj, thepath);
- }
- H5Dclose(obj);
- } else {
- error_msg(progname, "unable to get dataset \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- }
- break;
- case H5G_GROUP:
- if ((obj = H5Gopen(group, name)) >= 0) {
- strcat(strcat(prefix, "/"), name);
- pte = ref_path_table_lookup(thepath);
- if (pte == NULL) {
- ref_path_table_put(obj, thepath);
- H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL);
- strcpy(prefix, tmp);
- }
- H5Gclose(obj);
- } else {
- error_msg(progname, "unable to dump group \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- }
- break;
- case H5G_TYPE:
- if ((obj = H5Topen(group, name)) >= 0) {
- pte = ref_path_table_lookup(thepath);
- if (pte == NULL) {
- ref_path_table_put(obj, thepath);
- }
- H5Tclose(obj);
- } else {
- error_msg(progname, "unable to get dataset \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- }
- break;
- default:
- break;
- }
-
- free(tmp);
- free(thepath);
- return 0;
-}
/*
* create a string suitable for and XML NCNAME. Uses the
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 96f3aff..f9fcdd7 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -1,4 +1,4 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
@@ -4452,19 +4452,24 @@ static void gent_filters()
hid_t sid1; /* dataspace ID */
hid_t tid; /* datatype ID */
hid_t did; /* dataset ID */
+#if defined (H5_HAVE_FILTER_SZIP)
unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=4;
+#endif
hsize_t dims1[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf1[DIM1][DIM2];
hsize_t dims2[1]={2};
hvl_t buf2[2];
hsize_t dims3[1]={1};
- /*char buf3[]={"this is a string\n with a newline"};*/
- char buf3[]={"string\n new"};
+ char buf3[]={"this is\n a string with three\n newline\n escape characters"};
hsize_t dims4[1]={6};
char buf4[6]={"abcdef"};
- int i, j, n, ret, fillval, val;
+ hobj_ref_t buf5[5];
+ hsize_t dims5[1]={5};
+ int i, j, n, ret, val;
+ int fillval = -99;
+
typedef enum
{
@@ -4489,6 +4494,10 @@ static void gent_filters()
/* create a dataset creation property list; the same DCPL is used for all dsets */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
+ assert(ret>=0);
+
+
/*-------------------------------------------------------------------------
* create a compact and contiguous storage layout dataset
* add a comment to the datasets
@@ -4512,6 +4521,18 @@ static void gent_filters()
ret=H5Gset_comment(fid,"contiguous", "This is a dataset with contiguous storage");
assert(ret>=0);
+ ret=H5Pset_layout(dcpl, H5D_CHUNKED);
+ assert(ret>=0);
+
+ ret=H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
+ assert(ret>=0);
+
+ ret=make_dset(fid,"chunked",sid,dcpl,buf1);
+ assert(ret>=0);
+
+ ret=H5Gset_comment(fid,"chunked", "This is a dataset with chunked storage");
+ assert(ret>=0);
+
/*-------------------------------------------------------------------------
* make several dataset with filters
*-------------------------------------------------------------------------
@@ -4659,12 +4680,11 @@ static void gent_filters()
*/
make_external(fid);
-/*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* make datasets with fill value combinations
*-------------------------------------------------------------------------
*/
- fillval = -99;
ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
assert(ret>=0);
@@ -4675,31 +4695,32 @@ static void gent_filters()
ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
assert(ret>=0);
- ret=make_dset(fid,"fill early",sid,dcpl,buf1);
+ ret=make_dset(fid,"fill_early",sid,dcpl,buf1);
assert(ret>=0);
ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER);
assert(ret>=0);
- ret=make_dset(fid,"fill never",sid,dcpl,buf1);
+ ret=make_dset(fid,"fill_never",sid,dcpl,buf1);
assert(ret>=0);
ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET);
assert(ret>=0);
- ret=make_dset(fid,"fill ifset",sid,dcpl,buf1);
+ ret=make_dset(fid,"fill_ifset",sid,dcpl,buf1);
assert(ret>=0);
+
/*-------------------------------------------------------------------------
* commit a H5G_TYPE type with a comment
*-------------------------------------------------------------------------
*/
tid=H5Tcopy(H5T_STD_B8LE);
- ret=H5Tcommit(fid, "my type", tid);
+ ret=H5Tcommit(fid, "mytype", tid);
assert(ret>=0);
- ret=H5Gset_comment(fid,"my type", "This is a commited datatype");
+ ret=H5Gset_comment(fid,"mytype", "This is a commited datatype");
assert(ret>=0);
ret=H5Tclose(tid);
@@ -4768,6 +4789,23 @@ static void gent_filters()
*-------------------------------------------------------------------------
*/
write_dset(fid,1,dims4,"char",H5T_NATIVE_CHAR,buf4);
+
+/*-------------------------------------------------------------------------
+ * reference
+ *-------------------------------------------------------------------------
+ */
+ ret=H5Rcreate(&buf5[0],fid,"compact",H5R_OBJECT,-1);
+ assert(ret>=0);
+ ret=H5Rcreate(&buf5[1],fid,"myvlen",H5R_OBJECT,-1);
+ assert(ret>=0);
+ ret=H5Rcreate(&buf5[2],fid,"compact",H5R_OBJECT,-1);
+ assert(ret>=0);
+ ret=H5Rcreate(&buf5[3],fid,"myvlen",H5R_OBJECT,-1);
+ assert(ret>=0);
+ ret=H5Rcreate(&buf5[4],fid,"contiguous",H5R_OBJECT,-1);
+ assert(ret>=0);
+ write_dset(fid,1,dims5,"reference",H5T_STD_REF_OBJ,buf5);
+
/*-------------------------------------------------------------------------
* close
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index ee45788..064923f 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -89,6 +89,15 @@ TOOLTEST() {
fi
}
+
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $DUMPER $@
+ echo " -SKIP-"
+}
+
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -208,6 +217,70 @@ TOOLTEST tboot.ddl -H -B -d compact tfilters.h5
# test for file contents
TOOLTEST tcontents.ddl -n tfilters.h5
+# tests for storage layout
+# compact
+TOOLTEST tcompact.ddl -H -p -d compact tfilters.h5
+# contiguous
+TOOLTEST tcontiguos.ddl -H -p -d contiguos tfilters.h5
+# chunked
+TOOLTEST tchunked.ddl -H -p -d chunked tfilters.h5
+# external
+TOOLTEST texternal.ddl -H -p -d external tfilters.h5
+
+# Fill values
+TOOLTEST tfillearly.ddl -H -p -d fill_early tfilters.h5
+TOOLTEST tfillnever.ddl -H -p -d fill_never tfilters.h5
+TOOLTEST tfillifset.ddl -H -p -d fill_ifset tfilters.h5
+
+# references , print path
+TOOLTEST treference.ddl -d reference tfilters.h5
+
+# string , print new lines
+TOOLTEST tstring.ddl -e -d string tfilters.h5
+
+
+# tests for filters
+# SZIP
+option="-H -p -d szip tfilters.h5"
+if test $USE_FILTER_SZIP != "yes"; then
+ SKIP $option
+else
+ TOOLTEST tszip.ddl $option
+fi
+# deflate
+option="-H -p -d deflate tfilters.h5"
+if test $USE_FILTER_DEFLATE != "yes"; then
+ SKIP $option
+else
+ TOOLTEST tdeflate.ddl $option
+fi
+# shuffle
+option="-H -p -d shuffle tfilters.h5"
+if test $USE_FILTER_SHUFFLE != "yes"; then
+ SKIP $option
+else
+ TOOLTEST tshuffle.ddl $option
+fi
+# fletcher32
+option="-H -p -d fletcher32 tfilters.h5"
+if test $USE_FILTER_FLETCHER32 != "yes"; then
+ SKIP $option
+else
+ TOOLTEST tfletcher32.ddl $option
+fi
+# user defined
+TOOLTEST tuserfilter.ddl -H -d myfilter tfilters.h5
+
+
+
+
+
+
+
+
+
+
+
if test $nerrors -eq 0 ; then
echo "All $DUMPER tests passed."
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 58fb782..6fdb7ef 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -78,6 +78,11 @@ static herr_t list (hid_t group, const char *name, void *cd);
static void display_type(hid_t type, int ind);
static char *fix_name(const char *path, const char *base);
+hid_t thefile;
+char *prefix;
+char *progname;
+int d_status;
+
/*-------------------------------------------------------------------------
* Function: usage
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index 070bdcc..2fff656 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 h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c
+LIB_SRC=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
LIB_OBJ=$(LIB_SRC:.c=.lo)
PUB_LIB=
AUX_LIB=$(LIB)
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 5e47f10..ad85e3c 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -323,6 +323,9 @@ typedef struct h5dump_t {
/*print array indices in output matrix */
int pindex;
+ /*interpret CR/LF information */
+ int do_lf;
+
} h5dump_t;
typedef struct dump_header{
@@ -509,4 +512,6 @@ extern void h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid
extern int h5tools_canreadf(const char* name,
hid_t dcpl_id);
+
+
#endif /* H5TOOLS_H__ */
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
new file mode 100644
index 0000000..4506994
--- /dev/null
+++ b/tools/lib/h5tools_ref.c
@@ -0,0 +1,389 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "h5tools_ref.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+
+/*
+ * Table to look up a path name for an object
+ * reference.
+ *
+ * This table stores mappings of reference -> path
+ * for all objects in the file that may be the target of
+ * an object reference.
+ *
+ * The 'path' is an absolute path by which the object
+ * can be accessed. When an object has > 1 such path,
+ * only one will be used in the table, with no particular
+ * method of selecting which one.
+ */
+
+
+extern hid_t thefile;
+extern char *prefix;
+extern char *progname;
+extern int d_status;
+
+
+struct ref_path_table_entry_t *ref_path_table = NULL; /* the table */
+int npte = 0; /* number of entries in the table */
+
+/*-------------------------------------------------------------------------
+ * Function: ref_path_table_lookup
+ *
+ * Purpose: Looks up a table entry given a path name.
+ * Used during construction of the table.
+ *
+ * Return: The table entre (pte) or NULL if not in the
+ * table.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+struct ref_path_table_entry_t *
+ref_path_table_lookup(const char *thepath)
+{
+ int i;
+ hobj_ref_t *ref;
+ herr_t status;
+ struct ref_path_table_entry_t *pte = ref_path_table;
+
+ if (ref_path_table == NULL)
+ return NULL;
+
+ ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
+
+ if (ref == NULL) {
+ /* fatal error ? */
+ return NULL;
+ }
+
+ status = H5Rcreate(ref, thefile, thepath, H5R_OBJECT, -1);
+
+ if (status < 0) {
+ /* fatal error ? */
+ return NULL;
+ }
+
+ for (i = 0; i < npte; i++) {
+ if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) {
+ return pte;
+ }
+
+ pte = pte->next;
+ }
+
+ return NULL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: ref_path_table_put
+ *
+ * Purpose: Enter the 'obj' with 'path' in the table if
+ * not already there.
+ * Create an object reference, pte, and store them
+ * in the table.
+ *
+ * Return: The object reference for the object.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hobj_ref_t *
+ref_path_table_put(hid_t obj, const char *path)
+{
+ hobj_ref_t *ref;
+ H5G_stat_t *sb;
+ herr_t status;
+ struct ref_path_table_entry_t *pte;
+
+ /* look up 'obj'. If already in table, return */
+ pte = ref_path_table_lookup(path);
+ if (pte != NULL)
+ return pte->obj_ref;
+
+ /* if not found, then make new entry */
+
+ pte = (struct ref_path_table_entry_t *)
+ malloc(sizeof(struct ref_path_table_entry_t));
+ if (pte == NULL) {
+ /* fatal error? */
+ return NULL;
+ }
+
+ pte->obj = obj;
+ ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
+ if (ref == NULL) {
+ /* fatal error? */
+ free(pte);
+ return NULL;
+ }
+
+ status = H5Rcreate(ref, thefile, path, H5R_OBJECT, -1);
+ if (status < 0) {
+ /* fatal error? */
+ free(ref);
+ free(pte);
+ return NULL;
+ }
+
+ pte->obj_ref = ref;
+
+ pte->apath = HDstrdup(path);
+
+ sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t));
+ if (sb == NULL) {
+ /* fatal error? */
+ free(pte);
+ return NULL;
+ }
+ H5Gget_objinfo(thefile, path, TRUE, sb);
+
+ memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t));
+
+ pte->next = ref_path_table;
+ ref_path_table = pte;
+
+ npte++;
+
+ return ref;
+}
+
+/*
+ * counter used to disambiguate multiple instances of same object.
+ */
+int xid = 1;
+
+int get_next_xid() {
+ return xid++;
+}
+
+/*
+ * This counter is used to create fake object ID's
+ * The idea is to set it to the largest possible offest, which
+ * minimizes the chance of collision with a real object id.
+ *
+ */
+haddr_t fake_xid = HADDR_MAX;
+haddr_t
+get_fake_xid () {
+ return (fake_xid--);
+}
+
+/*
+ * for an object that does not have an object id (e.g., soft link),
+ * create a table entry with a fake object id as the key.
+ */
+
+struct ref_path_table_entry_t *
+ref_path_table_gen_fake(const char *path)
+{
+ union {
+ hobj_ref_t rr;
+ char cc[16];
+ unsigned long ll[2];
+ } uu;
+ hobj_ref_t *ref;
+ H5G_stat_t *sb;
+ struct ref_path_table_entry_t *pte;
+
+ /* look up 'obj'. If already in table, return */
+ pte = ref_path_table_lookup(path);
+ if (pte != NULL) {
+ return pte;
+ }
+
+ /* if not found, then make new entry */
+
+ pte = (struct ref_path_table_entry_t *)
+ malloc(sizeof(struct ref_path_table_entry_t));
+ if (pte == NULL) {
+ /* fatal error? */
+ return NULL;
+ }
+
+ pte->obj = (hid_t)-1;
+
+ sb = (H5G_stat_t *) malloc(sizeof(H5G_stat_t));
+ if (sb == NULL) {
+ /* fatal error? */
+ free(pte);
+ return NULL;
+ }
+ sb->objno[0] = (unsigned long)get_fake_xid();
+ sb->objno[1] = (unsigned long)get_fake_xid();
+
+ memcpy((char *)&(pte->statbuf),(char *)sb,sizeof(H5G_stat_t));
+
+ ref = (hobj_ref_t *) malloc(sizeof(hobj_ref_t));
+ if (ref == NULL) {
+ free(pte);
+ return NULL;
+ }
+
+ uu.ll[0] = sb->objno[0];
+ uu.ll[1] = sb->objno[1];
+
+ memcpy((char *)ref,(char *)&uu.rr,sizeof(ref));
+
+ pte->obj_ref = ref;
+
+ pte->apath = HDstrdup(path);
+
+ pte->next = ref_path_table;
+ ref_path_table = pte;
+
+ npte++;
+
+ return pte;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: lookup_ref_path
+ *
+ * Purpose: Lookup the path to the object with refernce 'ref'.
+ *
+ * Return: Return a path to the object, or NULL if not found.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+char*
+lookup_ref_path(hobj_ref_t * ref)
+{
+ int i;
+ struct ref_path_table_entry_t *pte = NULL;
+
+ if (ref_path_table == NULL)
+ return NULL;
+
+ pte = ref_path_table;
+ if (pte == NULL) {
+ /* fatal -- not initialized? */
+ return NULL;
+ }
+ for (i = 0; i < npte; i++) {
+ if (memcmp(ref, pte->obj_ref, sizeof(hobj_ref_t)) == 0) {
+ return pte->apath;
+ }
+ pte = pte->next;
+ }
+ return NULL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: fill_ref_path_table
+ *
+ * Purpose: Called by interator to create references for
+ * all objects and enter them in the table.
+ *
+ * Return: Error status.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data)
+{
+ hid_t obj;
+ char *tmp;
+ H5G_stat_t statbuf;
+ struct ref_path_table_entry_t *pte;
+ char *thepath;
+
+ H5Gget_objinfo(group, name, FALSE, &statbuf);
+ tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2);
+
+ if (tmp == NULL)
+ return FAIL;
+
+ thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2);
+
+ if (thepath == NULL) {
+ free(tmp);
+ return FAIL;
+ }
+
+ strcpy(tmp, prefix);
+
+ strcpy(thepath, prefix);
+ strcat(thepath, "/");
+ strcat(thepath, name);
+
+ switch (statbuf.type) {
+ case H5G_DATASET:
+ if ((obj = H5Dopen(group, name)) >= 0) {
+ pte = ref_path_table_lookup(thepath);
+ if (pte == NULL) {
+ ref_path_table_put(obj, thepath);
+ }
+ H5Dclose(obj);
+ } else {
+ error_msg(progname, "unable to get dataset \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ }
+ break;
+ case H5G_GROUP:
+ if ((obj = H5Gopen(group, name)) >= 0) {
+ strcat(strcat(prefix, "/"), name);
+ pte = ref_path_table_lookup(thepath);
+ if (pte == NULL) {
+ ref_path_table_put(obj, thepath);
+ H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL);
+ strcpy(prefix, tmp);
+ }
+ H5Gclose(obj);
+ } else {
+ error_msg(progname, "unable to dump group \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ }
+ break;
+ case H5G_TYPE:
+ if ((obj = H5Topen(group, name)) >= 0) {
+ pte = ref_path_table_lookup(thepath);
+ if (pte == NULL) {
+ ref_path_table_put(obj, thepath);
+ }
+ H5Tclose(obj);
+ } else {
+ error_msg(progname, "unable to get dataset \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ }
+ break;
+ default:
+ break;
+ }
+
+ free(tmp);
+ free(thepath);
+ return 0;
+}
+
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
new file mode 100644
index 0000000..5df2d38
--- /dev/null
+++ b/tools/lib/h5tools_ref.h
@@ -0,0 +1,48 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef H5TOOLS_REF_H__
+#define H5TOOLS_REF_H__
+
+#include "hdf5.h"
+
+typedef struct ref_path_table_entry_t {
+ hid_t obj;
+ hobj_ref_t *obj_ref;
+ char *apath;
+ H5G_stat_t statbuf;
+ struct ref_path_table_entry_t *next;
+}ref_path_table_entry_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char* lookup_ref_path(hobj_ref_t * ref);
+herr_t fill_ref_path_table(hid_t, const char *, void *);
+int get_next_xid(void);
+haddr_t get_fake_xid (void);
+struct ref_path_table_entry_t *ref_path_table_lookup(const char *);
+hobj_ref_t *ref_path_table_put(hid_t, const char *);
+struct ref_path_table_entry_t *ref_path_table_gen_fake(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif
+
+
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 80ad868..d774c9a 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -27,6 +27,9 @@
#include "h5tools.h" /*for h5dump_t structure */
#include "h5tools_str.h" /*function prototypes */
+extern char *lookup_ref_path(hobj_ref_t *);
+
+
/*
* If REPEAT_VERBOSE is defined then character strings will be printed so
* that repeated character sequences like "AAAAAAAAAA" are displayed as
@@ -452,6 +455,11 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
h5tools_str_append(str, "\\f");
break;
case '\n':
+ if (info->do_lf) {
+ h5tools_str_append(str, "\n");
+ h5tools_str_append(str, " ");
+ }
+ else
h5tools_str_append(str, "\\n");
break;
case '\r':
@@ -793,6 +801,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
if (h5tools_is_zero(vp, H5Tget_size(type))) {
h5tools_str_append(str, "NULL");
} else {
+ char *path=NULL;
otype = H5Rget_obj_type(container, H5R_OBJECT, vp);
obj = H5Rdereference(container, H5R_OBJECT, vp);
H5Gget_objinfo(obj, ".", FALSE, &sb);
@@ -823,6 +832,14 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
h5tools_str_append(str, info->obj_format,
sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]);
}
+
+ /* Print name */
+ path = lookup_ref_path(vp);
+ if (path) {
+ h5tools_str_append(str, " ");
+ h5tools_str_append(str, path);
+ h5tools_str_append(str, " ");
+ }
}
} else if (H5Tget_class(type) == H5T_ARRAY) {
int k, ndims;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index a942c17..26f894f 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -246,7 +246,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
}
-/*-------------------------------------------------------------------------
+/*---------------------/----------------------------------------------------
* Function: indentation
*
* Purpose: Print spaces for indentation
diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl
new file mode 100644
index 0000000..5d4571b
--- /dev/null
+++ b/tools/testfiles/tchunked.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5dump -H -p -d chunked tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "chunked" {
+COMMENT "This is a dataset with chunked storage"
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 800 ( 10, 5 )
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl
new file mode 100644
index 0000000..ae4f3e7
--- /dev/null
+++ b/tools/testfiles/tcompact.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5dump -H -p -d compact tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "compact" {
+COMMENT "This is a dataset with compact storage"
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT COMPACT {
+ SIZE 800
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME EARLY
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl
new file mode 100644
index 0000000..7c26099
--- /dev/null
+++ b/tools/testfiles/tcontiguos.ddl
@@ -0,0 +1,8 @@
+#############################
+Expected output for 'h5dump -H -p -d contiguos tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "contiguos" {
+ }
+}
+h5dump error: unable to open dataset "contiguos"
diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl
new file mode 100644
index 0000000..8cc5b3a
--- /dev/null
+++ b/tools/testfiles/tdeflate.ddl
@@ -0,0 +1,20 @@
+#############################
+Expected output for 'h5dump -H -p -d deflate tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "deflate" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 385 ( 10, 5 )
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 9 }
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl
new file mode 100644
index 0000000..511bd4f
--- /dev/null
+++ b/tools/testfiles/texternal.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5dump -H -p -d external tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "external" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 100 ) / ( 100 ) }
+ STORAGE_LAYOUT CONTIGUOUS EXTERNAL {
+ FILENAME ext1.bin SIZE 200 OFFSET 0
+ FILENAME ext2.bin SIZE 200 OFFSET 0
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME LATE
+ VALUE 0
+ }
+}
+}
diff --git a/tools/testfiles/tfillearly.ddl b/tools/testfiles/tfillearly.ddl
new file mode 100644
index 0000000..b48d64f
--- /dev/null
+++ b/tools/testfiles/tfillearly.ddl
@@ -0,0 +1,17 @@
+#############################
+Expected output for 'h5dump -H -p -d fill_early tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "fill_early" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 800 ( 10, 5 )
+ }
+ FILLVALUE {
+ FILL_TIME ALLOC
+ ALLOC_TIME EARLY
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tfillifset.ddl b/tools/testfiles/tfillifset.ddl
new file mode 100644
index 0000000..b67f5c7
--- /dev/null
+++ b/tools/testfiles/tfillifset.ddl
@@ -0,0 +1,17 @@
+#############################
+Expected output for 'h5dump -H -p -d fill_ifset tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "fill_ifset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 800 ( 10, 5 )
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME EARLY
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tfillnever.ddl b/tools/testfiles/tfillnever.ddl
new file mode 100644
index 0000000..92f19bc
--- /dev/null
+++ b/tools/testfiles/tfillnever.ddl
@@ -0,0 +1,17 @@
+#############################
+Expected output for 'h5dump -H -p -d fill_never tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "fill_never" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 800 ( 10, 5 )
+ }
+ FILLVALUE {
+ FILL_TIME NEVER
+ ALLOC_TIME EARLY
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl
new file mode 100644
index 0000000..4e44439
--- /dev/null
+++ b/tools/testfiles/tfletcher32.ddl
@@ -0,0 +1,20 @@
+#############################
+Expected output for 'h5dump -H -p -d fletcher32 tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "fletcher32" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 816 ( 10, 5 )
+ }
+ FILTERS {
+ CHECKSUM FLETCHER32
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl
new file mode 100644
index 0000000..754a840
--- /dev/null
+++ b/tools/testfiles/treference.ddl
@@ -0,0 +1,14 @@
+#############################
+Expected output for 'h5dump -d reference tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "reference" {
+ DATATYPE H5T_REFERENCE
+ DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
+ DATA {
+ (0) DATASET 0:976 /compact , DATATYPE 0:15955 /myvlen ,
+ (2) DATASET 0:976 /compact , DATATYPE 0:15955 /myvlen ,
+ (4) DATASET 0:2376 /contiguous
+ }
+}
+}
diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl
new file mode 100644
index 0000000..c68668c
--- /dev/null
+++ b/tools/testfiles/tshuffle.ddl
@@ -0,0 +1,20 @@
+#############################
+Expected output for 'h5dump -H -p -d shuffle tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "shuffle" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT CHUNKED {
+ SIZE 800 ( 10, 5 )
+ }
+ FILTERS {
+ PREPROCESSING SHUFFLE
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tstring.ddl b/tools/testfiles/tstring.ddl
new file mode 100644
index 0000000..d6df34b
--- /dev/null
+++ b/tools/testfiles/tstring.ddl
@@ -0,0 +1,20 @@
+#############################
+Expected output for 'h5dump -e -d string tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "string" {
+ DATATYPE H5T_STRING {
+ STRSIZE 57;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ (0) "this is
+ a string with three
+ newline
+ escape characters"
+ }
+}
+}
diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl
new file mode 100644
index 0000000..02a5fd3
--- /dev/null
+++ b/tools/testfiles/tszip.ddl
@@ -0,0 +1,8 @@
+#############################
+Expected output for 'h5dump -H -p -d szip tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "szip" {
+ }
+}
+h5dump error: unable to open dataset "szip"
diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl
new file mode 100644
index 0000000..c262fb6
--- /dev/null
+++ b/tools/testfiles/tuserfilter.ddl
@@ -0,0 +1,9 @@
+#############################
+Expected output for 'h5dump -H -d myfilter tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "myfilter" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+}
+}