[svn-r825] Added features:

* display selected named data type
* display named/unamed data type
* hard link
Also added testing scripts in testh5dump.sh.
This commit is contained in:
Ruey-Hsia Li 1998-10-29 01:27:31 -05:00
parent 54240b9657
commit 056814423f
4 changed files with 701 additions and 133 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,22 +27,13 @@
#define ATTRIBUTE_DATA 0
#define DATASET_DATA 1
#define H5DUMP_MAX_NDIMS 64
#define begin_obj(obj,name) printf("%s \"%s\" %s\n", obj, name, BEGIN)
#define end_obj() printf("%s\n", END);
#define col 3
/*
typedef enum
{
h, bb, header, a, d, g, l
}
command_t;
*/
#endif

View File

@ -33,6 +33,8 @@
#define NELMTS(X) (sizeof(X)/sizeof(*X))
#define ALIGN(A,Z) ((((A)+(Z)-1)/(Z))*(Z))
extern int indent;
extern int ischar;
/*-------------------------------------------------------------------------
@ -231,7 +233,7 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int
hsize_t elmtno, i; /*counters */
int carry; /*counter carry value */
hssize_t zero[8]; /*vector of zeros */
/* int need_prefix=1;*/ /*indices need printing */
int need_prefix=1; /*indices need printing */
/* Print info */
hsize_t p_min_idx[8]; /*min selected index */
@ -239,9 +241,9 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int
size_t p_type_nbytes; /*size of memory type */
hsize_t p_nelmts; /*total selected elmts */
char p_buf[256]; /*output string */
/* size_t p_column=0;*/ /*output column */
size_t p_column=0; /*output column */
size_t p_ncolumns=80; /*default num columns */
/* char p_prefix[1024];*/ /*line prefix string */
char p_prefix[1024]; /*line prefix string */
/* Stripmine info */
hsize_t sm_size[8]; /*stripmine size */
@ -254,7 +256,7 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int
hssize_t hs_offset[8]; /*starting offset */
hsize_t hs_size[8]; /*size this pass */
hsize_t hs_nelmts; /*elements in request */
int j, print_once=1;
/*
* Check that everything looks okay. The dimensionality must not be too
* great and the dimensionality of the items selected for printing must
@ -331,7 +333,6 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int
}
/* Print the prefix */
/*
if ((p_column +
strlen(p_buf) +
strlen(OPT(info->elmt_suf2, " ")) +
@ -339,26 +340,34 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int
need_prefix = 1;
}
if (need_prefix) {
/*
h5dump_prefix(p_prefix, info, elmtno+i, ndims,
p_min_idx, p_max_idx);
*/
if (p_column) {
fputs(OPT(info->line_suf, ""), stream);
putc('\n', stream);
fputs(OPT(info->line_sep, ""), stream);
}
for (j=0;j<indent+col;j++) putc(' ', stream);
if (ischar && print_once) {
putc('"', stream);
print_once=0;
}
/*
fputs(p_prefix, stream);
*/
p_column = strlen(p_prefix);
need_prefix = 0;
} else {
fputs(OPT(info->elmt_suf2, " "), stream);
p_column += strlen(OPT(info->elmt_suf2, " "));
}
*/
fputs(p_buf, stream);
/*
p_column += strlen(p_buf);
*/
}
@ -373,13 +382,17 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int
}
}
/*
if (p_column) {
/*
fputs(OPT(info->line_suf, ""), stream);
putc('\n', stream);
fputs(OPT(info->line_sep, ""), stream);
}
*/
if (ischar)
putc('"',stream);
putc('\n', stream);
/*
fputs(OPT(info->line_sep, ""), stream);
*/
}
H5Sclose(sm_space);
H5Sclose(f_space);
return 0;
@ -559,6 +572,9 @@ h5dump1(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type, int data_
int status;
h5dump_t info_dflt;
char p_buf[256], sm_buf[256]; /*tmp for scala */
int j;
/* Use default values */
if (!stream) stream = stdout;
if (!info) {
@ -584,10 +600,24 @@ h5dump1(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type, int data_
f_space = H5Aget_space(dset);
if (H5Sis_simple(f_space)<=0) return -1;
if ( H5Sget_simple_extent_ndims(f_space) == 0){
if (data_flag == ATTRIBUTE_DATA) {
if (H5Aread(dset, p_type, sm_buf) < 0)
return -1;
} else return -1;
h5dump_sprint(p_buf, info, p_type, sm_buf);
for (j=0;j<indent+col;j++) putc(' ', stream);
fputs(p_buf, stream);
putc('\n', stream);
H5Sclose(f_space);
} else {
H5Sclose(f_space);
/* Print the data */
status = h5dump_simple(stream, info, dset, p_type, data_flag);
}
if (p_type!=_p_type) H5Tclose(p_type);
return status;
}

View File

@ -190,7 +190,16 @@ TEST tattr-4.ddl -a attr4 tattr.h5
TEST tslink-1.ddl tslink.h5
TEST tslink-2.ddl -l slink2 tslink.h5
#TEST thlink-1.ddl thlink.h5
TEST thlink-1.ddl thlink.h5
TEST thlink-2.ddl -d /g1/link2 /dset /g1/link1/link3 thlink.h5
TEST thlink-3.ddl -d /dset /g1/link1/link3 /g1/link2 thlink.h5
TEST thlink-4.ddl -g /g1 thlink.h5
TEST thlink-5.ddl -d /dset -g /g2 -d /g1/link2 thlink.h5
TEST tcomp-1.ddl tcompound.h5
TEST tcomp-2.ddl -t /type1 /type2 /group1/type3 tcompound.h5
TEST tcomp-3.ddl -d /group2/dset5 -g /group1 tcompound.h5
TEST tcomp-4.ddl -t /#3432:0 -g /group2 tcompound.h5
TEST tall-1.ddl tall.h5
TEST tall-2.ddl -header -g /g1/g1.1 -a attr2 tall.h5