diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:29:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:29:13 (GMT) |
commit | fd70b2afa883f94718ffb7f4f33d104d76e3fe0a (patch) | |
tree | c1add8db2a4848202d86a9b274bfaf8c7b80e961 /tools/lib/h5tools.c | |
parent | 35b0159a0a5f1f4b80e305204ea51a742b052403 (diff) | |
download | hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.zip hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.tar.gz hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.tar.bz2 |
[svn-r18197] Description:
Trim trailing whitespace from source code files with this command:
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.f90" \) -print |xargs -n 1 sed -i "" 's/[[:blank:]]*$//'
Tested on:
None - eyeballed only
Diffstat (limited to 'tools/lib/h5tools.c')
-rw-r--r-- | tools/lib/h5tools.c | 314 |
1 files changed, 157 insertions, 157 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 7f1019a..e997d03 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -43,7 +43,7 @@ int bin_output; /* binary output */ int bin_form; /* binary form */ int region_output; /* region output */ -static h5tool_format_t h5tools_dataformat = { +static h5tool_format_t h5tools_dataformat = { 0, /*raw */ "", /*fmt_raw */ @@ -112,7 +112,7 @@ NULL, /*fmt_ullong */ 1 /*escape non printable characters */ }; -static const h5tools_dump_header_t h5tools_standardformat = { +static const h5tools_dump_header_t h5tools_standardformat = { "standardformat", /*name */ "HDF5", /*fileebgin */ "", /*fileend */ @@ -217,8 +217,8 @@ hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, hsize_t elmt_counter); int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, @@ -230,8 +230,8 @@ hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hsize_t elmt_counter); int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer, size_t ncols, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, @@ -299,13 +299,13 @@ void h5tools_init(void) { char lib_str[256]; - + if (!h5tools_init_g) { /* register the error class */ sprintf(lib_str, "%d.%d.%d",H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - + H5TOOLS_INIT_ERROR() - + if (!rawdatastream) rawdatastream = stdout; @@ -346,7 +346,7 @@ h5tools_close(void) term_ref_path_table(); H5TOOLS_CLOSE_ERROR() - + /* Shut down the library */ H5close(); @@ -445,7 +445,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if(drivernum) *drivernum = MPIO_IDX; } /* end if */ - } + } else if (!strcmp(driver, drivernames[MPIPOSIX_IDX])) { /* MPI-I/O Driver */ /* check if MPI has been initialized. */ @@ -727,9 +727,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * None *------------------------------------------------------------------------- */ -static void +static void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) + h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) { h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ @@ -841,7 +841,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, * new field sm_pos in h5tools_context_t, the current stripmine element position *------------------------------------------------------------------------- */ -void +void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, h5tools_context_t *ctx/*in,out*/, unsigned flags, hsize_t nelmts, hid_t type, void *_mem) @@ -928,13 +928,13 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai if(H5Sclose(region_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); } /* end if (region_space >= 0) */ - else + else HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); if(H5Dclose(region_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); } /* if (region_id >= 0) */ - else + else HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); ctx->need_prefix = TRUE; @@ -966,17 +966,17 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * Purpose: Render an element to output STREAM. * Description: * Prints the string buffer to the output STREAM. The string is - * printed according to the format described in INFO. The CTX struct - * contains context information shared between calls to this function. - * + * printed according to the format described in INFO. The CTX struct + * contains context information shared between calls to this function. + * * Return: * False if a dimension end is reached, otherwise true - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *buffer * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -985,10 +985,10 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) + size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) { hbool_t dimension_break = TRUE; char *s; @@ -1002,9 +1002,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * If the element would split on multiple lines if printed at our * current location... */ - if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + (ctx->cur_column + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* @@ -1013,8 +1013,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + else if ((ctx->prev_prefix_len + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we @@ -1045,11 +1045,11 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * is too long to fit on a line then start this element at the * beginning of the line. */ - if (info->line_multi_new == 1 && - ctx->prev_multiline && - (ctx->cur_column + - h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + ctx->prev_multiline && + (ctx->cur_column + + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; @@ -1066,8 +1066,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * one-at a time. */ multiline = 0; - for (secnum = 0, multiline = 0; - (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); + for (secnum = 0, multiline = 0; + (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { /* * If the current section plus possible suffix and end-of-line @@ -1079,10 +1079,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * Added the info->skip_first because the dumper does not want * this check to happen for the first line */ - if ((!info->skip_first || local_elmt_counter) && - (ctx->cur_column + - strlen(section) + - strlen(OPT(info->elmt_suf2, " ")) + + if ((!info->skip_first || local_elmt_counter) && + (ctx->cur_column + + strlen(section) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; @@ -1122,17 +1122,17 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * Purpose: Render a region element to output STREAM. * Description: * Prints the string buffer to the output STREAM. The string is - * printed according to the format described in INFO. The CTX struct - * contains context information shared between calls to this function. - * + * printed according to the format described in INFO. The CTX struct + * contains context information shared between calls to this function. + * * Return: * False if a dimension end is reached, otherwise true - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *buffer * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -1142,10 +1142,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) + size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) { hbool_t dimension_break = TRUE; char *s; @@ -1159,9 +1159,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * If the element would split on multiple lines if printed at our * current location... */ - if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + (ctx->cur_column + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* @@ -1170,8 +1170,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + else if ((ctx->prev_prefix_len + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we @@ -1202,11 +1202,11 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * is too long to fit on a line then start this element at the * beginning of the line. */ - if (info->line_multi_new == 1 && - ctx->prev_multiline && - (ctx->cur_column + - h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + ctx->prev_multiline && + (ctx->cur_column + + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; @@ -1235,10 +1235,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * Added the info->skip_first because the dumper does not want * this check to happen for the first line */ - if ((!info->skip_first || local_elmt_counter) && - (ctx->cur_column + - strlen(section) + - strlen(OPT(info->elmt_suf2, " ")) + + if ((!info->skip_first || local_elmt_counter) && + (ctx->cur_column + + strlen(section) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; @@ -1276,13 +1276,13 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * Audience: Public * Chapter: H5Tools Library * Purpose: Print the data values from a dataset referenced by region blocks. - * + * * Description: * This is a special case subfunction to print the data in a region reference of type blocks. - * + * * Return: * The function returns FAIL if there was an error, otherwise SUCEED - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * size_t ncols @@ -1290,10 +1290,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * hssize_t nblocks is the number of blocks in the region *------------------------------------------------------------------------- */ -int +int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) { HERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; @@ -1364,12 +1364,12 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, ctx.indent_level++; if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - + /* assume entire data space to be printed */ for (jndx = 0; jndx < (size_t) ctx.ndims; jndx++) ctx.p_min_idx[jndx] = start[jndx]; init_acc_pos(&ctx, total_size); - + /* print the data */ region_flags = START_OF_DATA; if (blkndx == nblocks - 1) @@ -1390,7 +1390,7 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); - h5tools_str_sprint(buffer, info, region_id, type_id, + h5tools_str_sprint(buffer, info, region_id, type_id, ((char*)region_buf + jndx * type_size), &ctx); if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0) @@ -1399,7 +1399,7 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, ncols, ptdata, jndx, elmtno); /* Render the region data element end */ - + if(FALSE == dimension_break) elmtno = 0; } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ @@ -1412,12 +1412,12 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, HDfree(count); HDfree(region_buf); HDfree(dims1); - + if(H5Sclose(mem_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); if(H5Sclose(sid1) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - + CATCH return ret_value; } @@ -1426,17 +1426,17 @@ CATCH * Audience: Public * Chapter: H5Tools Library * Purpose: Print some values from a dataset referenced by region blocks. - * + * * Description: * This is a special case subfunction to dump a region reference using blocks. - * + * * Return: * The function returns False if the last dimension has been reached, otherwise True - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -1445,7 +1445,7 @@ CATCH * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, @@ -1469,7 +1469,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, /* Print block information */ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - + /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -1483,7 +1483,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, ctx->indent_level++; ctx->need_prefix = TRUE; h5tools_str_append(buffer, "REGION_TYPE BLOCK "); - + alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL) @@ -1580,10 +1580,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, done: free(ptdata); - + if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - + if(H5Tclose(dtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -1594,7 +1594,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->dataend, h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the dataend element end */ @@ -1604,7 +1604,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, /* Render the region } element begin */ h5tools_str_reset(buffer); h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the region } element end */ @@ -1618,13 +1618,13 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, * Audience: Public * Chapter: H5Tools Library * Purpose: Print the data values from a dataset referenced by region points. - * + * * Description: * This is a special case subfunction to print the data in a region reference of type points. - * + * * Return: * The function returns FAIL on error, otherwise SUCCEED - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * size_t ncols @@ -1632,10 +1632,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -int +int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer, size_t ncols, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) { HERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; @@ -1688,7 +1688,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if (ctx.ndims > 0) { ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } + } else ctx.size_last_dim = 0; @@ -1702,17 +1702,17 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, curr_pos = 0; /* points requires constant 0 */ ctx.sm_pos = jndx * ndims; - + h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - h5tools_str_sprint(buffer, info, region_id, type_id, + h5tools_str_sprint(buffer, info, region_id, type_id, ((char*)region_buf + jndx * type_size), &ctx); if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0) h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); - dimension_break = - h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, + dimension_break = + h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, ncols, ptdata, 0, elmtno); /* Render the point element end */ @@ -1724,7 +1724,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, done: HDfree(region_buf); HDfree(dims1); - + if(H5Sclose(mem_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); CATCH @@ -1735,17 +1735,17 @@ CATCH * Audience: Public * Chapter: H5Tools Library * Purpose: Print some values from a dataset referenced by region points. - * + * * Description: * This is a special case subfunction to dump a region reference using points. - * + * * Return: * The function returns False if the last dimension has been reached, otherwise True - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -1754,9 +1754,9 @@ CATCH * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter) { HERR_INIT(hbool_t, TRUE) @@ -1819,7 +1819,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, if((dtype = H5Dget_type(region_id)) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); - + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); @@ -1882,7 +1882,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, done: free(ptdata); - + if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -1896,7 +1896,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->dataend, h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the dataend element end*/ @@ -1906,7 +1906,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, /* Render the region } element begin */ h5tools_str_reset(buffer); h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the region } element end */ @@ -1948,7 +1948,7 @@ CATCH *------------------------------------------------------------------------- */ static herr_t -h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, +h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type, struct subset_t *sset, hid_t f_space, hsize_t hyperslab_count, hsize_t *temp_start,/* start inside offset count loop */ @@ -1987,7 +1987,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { /* jump rows if size of block exceeded cases where block > 1 only and stride > block */ - if (size_row_block > 1 + if (size_row_block > 1 && row_counter == size_row_block && sset->stride[row_dim] > sset->block[row_dim]) { @@ -2001,7 +2001,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* calculate the potential number of elements we're going to print */ if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - + if((sm_nelmts = H5Sget_select_npoints(f_space)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); @@ -2012,7 +2012,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - + if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; @@ -2022,35 +2022,35 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); - + if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - + if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - + /* read the data */ if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - + /* print the data */ flags = START_OF_DATA; - + if (hyperslab_count == 1) flags |= END_OF_DATA; - + for (i = 0; i < ctx->ndims; i++) ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); - + /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); - + elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { hsize_t offset = 1; /* accumulation of the previous dimensions */ @@ -2059,11 +2059,11 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c elmtno += low[i] * offset; } elmtno += low[ctx->ndims - 1]; - + /* initialize the current stripmine position; this is necessary to print the array indices */ ctx->sm_pos = elmtno; - + h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); if(H5Sclose(sm_space) < 0) @@ -2121,7 +2121,7 @@ CATCH *------------------------------------------------------------------------- */ static herr_t -h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, +h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type, struct subset_t *sset, hid_t f_space, hsize_t *total_size) { @@ -2192,11 +2192,11 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools else { count = 1; } - + h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset, - f_space, count, temp_start, temp_count, + f_space, count, temp_start, temp_count, temp_block, temp_stride, total_size, row_dim); - + if (ctx->ndims > 2) { /* dimension for start */ current_outer_dim = (ctx->ndims - 2) - 1; @@ -2337,9 +2337,9 @@ CATCH * returns FAIL. *------------------------------------------------------------------------- */ -static int +static int h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, - hid_t dset, hid_t p_type, int indentlevel) + hid_t dset, hid_t p_type, int indentlevel) { hid_t f_space; /* file data space */ hsize_t elmtno; /* counter */ @@ -2612,9 +2612,9 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, * *------------------------------------------------------------------------- */ -int +int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t _p_type, struct subset_t *sset, int indentlevel) + hid_t _p_type, struct subset_t *sset, int indentlevel) { hid_t f_space; hid_t p_type = _p_type; @@ -2727,9 +2727,9 @@ CATCH * *------------------------------------------------------------------------- */ -int -h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) +int +h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) { HERR_INIT(int, FAIL) char *mname; @@ -3081,7 +3081,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, case H5T_COMPOUND: if((nmembers = H5Tget_nmembers(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - + h5tools_str_append(buffer, "H5T_COMPOUND %s\n", h5tools_dump_header_format->structblockbegin); for (i = 0; i < nmembers; i++) { @@ -3089,12 +3089,12 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, if((mtype = H5Tget_member_type(type, i))>=0) { if (H5Tget_class(mtype) == H5T_COMPOUND) ctx->indent_level++; - + h5tools_print_datatype(buffer, info, ctx, mtype); - + if (H5Tget_class(mtype) == H5T_COMPOUND) ctx->indent_level--; - + h5tools_str_append(buffer, " \"%s\";\n", mname); if(H5Tclose(mtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -3129,10 +3129,10 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_print_datatype(buffer, info, ctx, super); if(H5Tclose(super) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - + h5tools_str_append(buffer, ";\n"); h5tools_print_enum(buffer, type); - + ctx->indent_level--; h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); @@ -3161,7 +3161,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, /* Print array dimensions */ for (i = 0; i < ndims; i++) h5tools_str_append(buffer, "[%d]", (int) dims[i]); - + h5tools_str_append(buffer, " "); } else @@ -3206,8 +3206,8 @@ CATCH * *------------------------------------------------------------------------- */ -int -h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) +int +h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) { HERR_INIT(int, SUCCEED) hsize_t size[H5TOOLS_DUMP_MAX_RANK]; @@ -3282,8 +3282,8 @@ CATCH * h5tools_context_t *ctx * *-----------------------------------------------------------------------*/ -int -h5tools_print_enum(h5tools_str_t *buffer, hid_t type) +int +h5tools_print_enum(h5tools_str_t *buffer, hid_t type) { HERR_INIT(int, SUCCEED) char **name = NULL; /*member names */ @@ -3293,7 +3293,7 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) int nchars; /*number of output characters */ hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer datatype */ - H5T_sign_t sign_type; /*sign of value type */ + H5T_sign_t sign_type; /*sign of value type */ size_t type_size; /*value type size */ size_t dst_size; /*destination value type size */ int snmembs; @@ -3303,10 +3303,10 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); nmembs = (unsigned)snmembs; assert(nmembs > 0); - + if((super = H5Tget_super(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); - + if((type_size = H5Tget_size(type)) <= 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); @@ -3410,13 +3410,13 @@ CATCH * atomic datatype or committed/transient datatype. * * Return: void - * + * * In/Out: h5tools_context_t *ctx *------------------------------------------------------------------------- */ -void +void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) + h5tools_context_t *ctx, hid_t type) { size_t ncols = 80; /* available output width */ h5tools_str_t buffer; /* string into which to render */ @@ -3470,8 +3470,8 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, * Return: void *------------------------------------------------------------------------- */ -void -init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) +void +init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { int i; @@ -3525,7 +3525,7 @@ CATCH * Failure: FAIL *------------------------------------------------------------------------- */ -static int +static int render_bin_output(FILE *stream, hid_t tid, void *_mem) { HERR_INIT(int, SUCCEED) @@ -3880,8 +3880,8 @@ CATCH * Return: TRUE if all bytes are zero; FALSE otherwise *------------------------------------------------------------------------- */ -static -hbool_t h5tools_is_zero(const void *_mem, size_t size) +static +hbool_t h5tools_is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *) _mem; |