diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2009-05-18 22:24:11 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2009-05-18 22:24:11 (GMT) |
commit | c18a27cb3f1a3481fef86ac1526e233f55528fad (patch) | |
tree | 89fc98ea3a30ba9a83f22ca33139403f5e45b7ec | |
parent | 2ccee6c262894c18a8fba970e3355cbfa9bc6fd7 (diff) | |
download | hdf5-c18a27cb3f1a3481fef86ac1526e233f55528fad.zip hdf5-c18a27cb3f1a3481fef86ac1526e233f55528fad.tar.gz hdf5-c18a27cb3f1a3481fef86ac1526e233f55528fad.tar.bz2 |
[svn-r16958] Added display of dataspace unde datatype within region output on use of -R option
-rw-r--r-- | tools/h5dump/h5dump.c | 16 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 131 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 1 | ||||
-rw-r--r-- | tools/testfiles/tdataregR.ddl | 2 |
4 files changed, 138 insertions, 12 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 31b231b..a6df77c 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2405,14 +2405,19 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) hsize_t size[64], nelmts = 1, alloc_size; int depth; int stdindent = COL; /* should be 3 */ - + if (fp_format) { outputformat->fmt_double = fp_format; outputformat->fmt_float = fp_format; } - outputformat->line_ncols = nCols; + if (nCols==0) { + outputformat->line_ncols = 65535; + outputformat->line_per_line = 1; + } + else + outputformat->line_ncols = nCols; outputformat->do_escape=display_escape; /* print the matrix indices */ outputformat->pindex=display_index; @@ -5512,7 +5517,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU int depth; int stdindent = COL; /* should be 3 */ - outputformat->line_ncols = nCols; + if (nCols==0) { + outputformat->line_ncols = 65535; + outputformat->line_per_line = 1; + } + else + outputformat->line_ncols = nCols; indent += COL; /* diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 72c4ece..af7ac8a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -40,6 +40,7 @@ FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ int bin_output; /* binary output */ int bin_form; /* binary form */ int region_output; /* region output */ + int packed_output; /* number of packed bits to display */ int packed_normalize; /* number of bits to shift right to display normalized */ unsigned int packed_counter; /* counter for which packed bits to display */ @@ -865,8 +866,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, char ref_name[1024]; /* region data */ - region_id = H5Rdereference(container, H5R_DATASET_REGION, mem - + i * size); + region_id = H5Rdereference(container, H5R_DATASET_REGION, mem + i * size); if (region_id >= 0) { region_space = H5Rget_region(container, H5R_DATASET_REGION, mem + i * size); @@ -1302,7 +1302,31 @@ hsize_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; - /* Render the datatype element */ + /* Render the dataspace element */ + h5tools_str_reset(buffer); + + ctx->need_prefix = TRUE; + h5tools_str_append(buffer, "%s ", + h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(buffer, info, ctx, region_space); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(buffer, "%s", + h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, "%s", + h5tools_dump_header_format->dataspaceblockend); + + curr_pos = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + flags, ncols, elmt_counter, i_count); + + ctx->need_prefix = TRUE; + + /* Render the data element */ h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s %s ", @@ -1538,7 +1562,32 @@ hsize_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; - /* Render the datatype element */ + + /* Render the dataspace element */ + h5tools_str_reset(buffer); + + ctx->need_prefix = TRUE; + h5tools_str_append(buffer, "%s ", + h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(buffer, info, ctx, region_space); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(buffer, "%s", + h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, "%s", + h5tools_dump_header_format->dataspaceblockend); + + curr_pos = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + flags, ncols, elmt_counter, i_count); + + ctx->need_prefix = TRUE; + + /* Render the data element */ h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s %s ", @@ -2392,11 +2441,6 @@ int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, * * Return: void * - * Programmer: Ruey-Hsia Li - * - * Modifications: pvn, March 28, 2006 - * print information about type when a native match is not possible - * *------------------------------------------------------------------------- */ void h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, @@ -2839,6 +2883,75 @@ void h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, } /*------------------------------------------------------------------------- + * Function: print_dataspace + * + * Purpose: print the dataspace. + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t space) { + + hsize_t size[H5TOOLS_DUMP_MAX_RANK]; + hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK]; + int ndims = H5Sget_simple_extent_dims(space, size, maxsize); + H5S_class_t space_type = H5Sget_simple_extent_type(space); + int i; + + + switch(space_type) { + case H5S_SCALAR: + /* scalar dataspace */ + h5tools_str_append(buffer, "%s %s", + h5tools_dump_header_format->dataspacedescriptionbegin, S_SCALAR); + break; + + case H5S_SIMPLE: + /* simple dataspace */ + h5tools_str_append(buffer, "%s %s { %s %hu", + h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE, + h5tools_dump_header_format->dataspacedimbegin, size[0]); + + for(i = 1; i < ndims; i++) + h5tools_str_append(buffer, ", %hu", size[i]); + + h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend); + + if(maxsize[0] == H5S_UNLIMITED) + h5tools_str_append(buffer, "%s %s", + h5tools_dump_header_format->dataspacedimbegin, + "H5S_UNLIMITED"); + else + h5tools_str_append(buffer, "%s %hu", + h5tools_dump_header_format->dataspacedimbegin, maxsize[0]); + + for(i = 1; i < ndims; i++) + if(maxsize[i] == H5S_UNLIMITED) + h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED"); + else + h5tools_str_append(buffer, ", %hu", maxsize[i]); + + h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend); + break; + + case H5S_NULL: + /* null dataspace */ + h5tools_str_append(buffer, "%s %s", + h5tools_dump_header_format->dataspacedescriptionbegin, S_NULL); + break; + + case H5S_NO_CLASS: + default: + h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END); + break; + } /* end switch */ +} + + +/*------------------------------------------------------------------------- * Function: print_enum * * Purpose: prints the enum data diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index b0e67b8..4a40aab 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -514,6 +514,7 @@ extern FILE *rawdatastream; /* output stream for raw data */ extern int bin_output; /* binary output */ extern int bin_form; /* binary form */ extern int region_output; /* region output */ + extern int packed_output; /* packed bits output count */ extern int packed_normalize; /* number of bits to shift right to display normalized */ extern unsigned int packed_counter; /* counter for which packed bits to display */ diff --git a/tools/testfiles/tdataregR.ddl b/tools/testfiles/tdataregR.ddl index b4ab4f2..1b2a6e0 100644 --- a/tools/testfiles/tdataregR.ddl +++ b/tools/testfiles/tdataregR.ddl @@ -10,6 +10,7 @@ GROUP "/" { (0): DATASET /Dataset2 { (0): REGION_TYPE BLOCK (2,2)-(7,7) (0): DATATYPE H5T_STD_U8LE + (0): DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } (0): DATA { (2,2): 66, 69, 72, 75, 78, 81, (3,2): 96, 99, 102, 105, 108, 111, @@ -23,6 +24,7 @@ GROUP "/" { (1): REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2), (1): (0,4), (9,0), (7,1), (3,3) (1): DATATYPE H5T_STD_U8LE + (1): DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } (1): DATA { (6,9): 207, (2,2): 66, |