diff options
author | Robb Matzke <matzke@llnl.gov> | 1999-06-07 15:05:02 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1999-06-07 15:05:02 (GMT) |
commit | b98fcbf5926e81f2e4ead8daa46e650566719e1c (patch) | |
tree | 1653e8084aff321512fb2d2bc842573fef62f220 /tools | |
parent | 2a10e682a13244d5c61982445f2d6ec5bc990a36 (diff) | |
download | hdf5-b98fcbf5926e81f2e4ead8daa46e650566719e1c.zip hdf5-b98fcbf5926e81f2e4ead8daa46e650566719e1c.tar.gz hdf5-b98fcbf5926e81f2e4ead8daa46e650566719e1c.tar.bz2 |
[svn-r1306] Changes since 19990602
----------------------
./doc/html/Datatypes.html
./test/dtypes.c
Added documentation and tests for opaque types.
./tools/h5ls.c
Added a `-x' or `--hexdump' argument which is not fully
implemented (because I want to synchronize h5tools.c first)
but which will eventually print raw data in hexadecimal format
without any translation from disk. This would be useful for
debugging references and VL types.
./tools/h5tools.c
Added support for references (not quite finished yet, but
compiles -- I wanted to sync up this file before Patrick and I
got too far apart...)
./src/H5R.c
Checked for error return value from H5R_get_object_type()
./src/H5A.c
./src/H5D.c
Changed error return values from NULL to FAIL
./test/Makefile.in
./test/trefer.c
Creates trefer1.h5 and trefer2.h5 so that the second test
doesn't clobber the first file since the files might be useful
for debugging.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5ls.c | 23 | ||||
-rw-r--r-- | tools/h5tools.c | 64 |
2 files changed, 75 insertions, 12 deletions
diff --git a/tools/h5ls.c b/tools/h5ls.c index 0a361c3..b4e10f7 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -25,6 +25,7 @@ static hbool_t string_g = FALSE; /*print 1-byte numbers as ASCII? */ static hbool_t fullname_g = FALSE; /*print full path names */ static hbool_t recursive_g = FALSE; /*recursive descent listing */ static hbool_t grp_literal_g = FALSE; /*list group, not contents */ +static hbool_t hexdump_g = FALSE; /*show data as raw hexadecimal */ /* Info to pass to the iteration functions */ typedef struct iter_t { @@ -94,6 +95,7 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ -wN, --width=N Set the number of columns of output\n\ -v, --verbose Generate more verbose output\n\ -V, --version Print version number and exit\n\ + -x, --hexdump Show raw data in hexadecimal format\n\ FILE\n\ The file name may include a printf(3C) integer format such as\n\ \"%%05d\" to open a file family.\n\ @@ -897,6 +899,8 @@ display_string_type(hid_t type, int UNUSED indent) * Thursday, November 5, 1998 * * Modifications: + * Robb Matzke, 1999-06-04 + * Knows about object and dataset region references. * *------------------------------------------------------------------------- */ @@ -905,8 +909,15 @@ display_reference_type(hid_t type, int UNUSED indent) { if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE; - printf("%lu-byte unknown reference", - (unsigned long)H5Tget_size(type)); + if (H5Tequal(type, H5T_STD_REF_OBJ)) { + printf("object reference"); + } else if (H5Tequal(type, H5T_STD_REF_DSETREG)) { + printf("dataset region reference"); + } else { + printf("%lu-byte unknown reference", + (unsigned long)H5Tget_size(type)); + } + return TRUE; } @@ -1787,6 +1798,10 @@ main (int argc, char *argv[]) printf("This is %s version %u.%u release %u\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); exit(0); + } else if (!strcmp(argv[argno], "--hexdump")) { + hexdump_g = TRUE; + fprintf(stderr, "not implemented yet: --hexdump\n"); + exit(1); } else if (!strncmp(argv[argno], "-w", 2)) { if (argv[argno][2]) { s = argv[argno]+2; @@ -1839,6 +1854,10 @@ main (int argc, char *argv[]) progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); exit(0); + case 'x': /* --hexdump */ + hexdump_g = TRUE; + fprintf(stderr, "not implemented yet: -x\n"); + exit(1); default: usage(progname); exit(1); diff --git a/tools/h5tools.c b/tools/h5tools.c index f61a5a5..994433a 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -454,6 +454,10 @@ h5dump_escape(char *s/*in,out*/, size_t size, int escape_spaces) * Made this function safe from overflow problems by allowing it * to reallocate the output string. * + * Robb Matzke, 1999-06-04 + * Added support for object references. The new `container' + * argument is the dataset where the reference came from. + * *------------------------------------------------------------------------- */ @@ -463,7 +467,7 @@ h5dump_escape(char *s/*in,out*/, size_t size, int escape_spaces) */ static char * h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info, - hid_t type, void *vp) + hid_t container, hid_t type, void *vp) { size_t i, n, offset, size, dims[H5S_MAX_RANK], nelmts, start; char *name, quote='\0'; @@ -699,7 +703,8 @@ h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info, OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); } - h5dump_sprint(str, info, memb, (char*)vp+offset+i*size); + h5dump_sprint(str, info, container, memb, + (char*)vp+offset+i*size); } if (nelmts>1) { h5dump_str_append(str, "%s", OPT(info->arr_suf, "]")); @@ -720,6 +725,39 @@ h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info, } } + } else if (H5Tequal(type, H5T_STD_REF_DSETREG)) { + /* + * Dataset region reference -- show the type and OID of the + * referenced object, but we are unable to show the region yet + * because there isn't enough support in the data space layer. + * -rpm 19990604 + */ + int otype = H5Rget_object_type(container, vp); + hid_t obj = H5Rdereference(container, H5R_DATASET_REGION, vp); + switch (otype) { + case H5G_GROUP: + h5dump_str_append(str, "GRP-"); + H5Gclose(obj); + break; + case H5G_DATASET: + h5dump_str_append(str, "DSET-"); + H5Dclose(obj); + break; + case H5G_TYPE: + h5dump_str_append(str, "TYPE-"); + H5Tclose(obj); + break; + default: + h5dump_str_append(str, "%u-", otype); + /* unable to close `obj' since we don't know the type */ + break; + } + + + /* OID */ + + /* SPACE */ + } else { h5dump_str_append(str, "0x"); n = H5Tget_size(type); @@ -836,11 +874,14 @@ h5dump_simple_prefix(FILE *stream, const h5dump_t *info, * Monday, April 26, 1999 * * Modifications: + * Robb Matzke, 1999-06-04 + * The `container' argument is the optional dataset for + * reference types. * *------------------------------------------------------------------------- */ static void -h5dump_simple_data(FILE *stream, const h5dump_t *info, +h5dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, h5dump_context_t *ctx/*in,out*/, unsigned flags, hsize_t nelmts, hid_t type, void *_mem) { @@ -863,7 +904,7 @@ h5dump_simple_data(FILE *stream, const h5dump_t *info, /* Render the element */ h5dump_str_reset(&buffer); - h5dump_sprint(&buffer, info, type, mem+i*size); + h5dump_sprint(&buffer, info, container, type, mem+i*size); if (i+1<nelmts || 0==(flags & END_OF_DATA)) { h5dump_str_append(&buffer, "%s", OPT(info->elmt_suf1, ",")); } @@ -1089,7 +1130,7 @@ h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, return FAIL; } else if (programtype == H5LS){ - h5dump_simple_data(stream, info, &ctx, flags, hs_nelmts, p_type, + h5dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts, p_type, sm_buf); } else if (programtype == H5DUMP){ @@ -1198,8 +1239,8 @@ h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t type, size = H5Tget_size(type); /* Print it */ - h5dump_simple_data(stream, info, &ctx, START_OF_DATA|END_OF_DATA, - nelmts, type, mem); + h5dump_simple_data(stream, info, -1/*no dataset*/, &ctx, + START_OF_DATA|END_OF_DATA, nelmts, type, mem); /* Terminate the output */ if (ctx.cur_column) { @@ -1226,6 +1267,8 @@ h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t type, * Thursday, July 23, 1998 * * Modifications: + * Robb Matzke, 1999-06-04 + * Added support for references. * *------------------------------------------------------------------------- */ @@ -1361,6 +1404,7 @@ h5dump_fixtype(hid_t f_type) break; case H5T_ENUM: + case H5T_REFERENCE: m_type = H5Tcopy(f_type); break; @@ -1554,7 +1598,7 @@ struct h5dump_str_t tempstr; for (i=0; i<hs_nelmts && (elmtno+i) < p_nelmts; i++) { h5dump_str_reset(&tempstr); - h5dump_sprint(&tempstr, &info, p_type, sm_buf+i*p_type_nbytes); + h5dump_sprint(&tempstr, &info, -1/*no container*/, p_type, sm_buf+i*p_type_nbytes); if ((int)(strlen(out_buf)+tempstr.len+1) > (nCols-indent-COL)) { /* first row of member */ if (compound_data && (elmtno+i+1) == dim_n_size) @@ -1666,7 +1710,8 @@ static void display_string row_size++; h5dump_str_reset(&tempstr); - h5dump_sprint(&tempstr, &info,p_type, sm_buf+i*p_type_nbytes); + h5dump_sprint(&tempstr, &info, -1/*no container*/, p_type, + sm_buf+i*p_type_nbytes); memmove(tempstr.s, tempstr.s + 1, tempstr.len -1); tempstr.s[tempstr.len - 2] = '\0'; @@ -1932,7 +1977,6 @@ int nmembs, i, j, k, ndims, perm[4]; * *------------------------------------------------------------------------- */ - static int h5dump_simple(hid_t oid, hid_t p_type, int obj_data) { |