diff options
Diffstat (limited to 'tools/h5dump/h5dump_xml.c')
-rw-r--r-- | tools/h5dump/h5dump_xml.c | 3111 |
1 files changed, 1645 insertions, 1466 deletions
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 6e72b56..ca3c501 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -20,7 +20,7 @@ #include "h5dump_extern.h" #include "h5dump_xml.h" -const char *xmlnsprefix="hdf5:"; +const char *xmlnsprefix = "hdf5:"; /* * Alternative formating for data dumped to XML @@ -34,52 +34,53 @@ const char *xmlnsprefix="hdf5:"; * * This table only affects XML output. */ -static h5tool_format_t xml_dataformat = { - 0, /*raw */ - - "", /*fmt_raw */ - "%d", /*fmt_int */ - "%u", /*fmt_uint */ - "%hhd", /*fmt_schar */ - "%u", /*fmt_uchar */ - "%d", /*fmt_short */ - "%u", /*fmt_ushort */ - "%ld", /*fmt_long */ - "%lu", /*fmt_ulong */ - NULL, /*fmt_llong */ - NULL, /*fmt_ullong */ - "%g", /*fmt_double */ - "%g", /*fmt_float */ - - 0, /*ascii */ - 0, /*str_locale */ - 0, /*str_repeat */ - - "", /*arr_pre */ - "", /*arr_sep */ - "", /*arr_suf */ - 1, /*arr_linebreak */ - - "", /*cmpd_name */ - "", /*cmpd_sep */ - "", /*cmpd_pre */ - "", /*cmpd_suf */ - "", /*cmpd_end */ - - " ", /*vlen_sep */ - " ", /*vlen_pre */ - "", /*vlen_suf */ - "", /*vlen_end */ - - "%s", /*elmt_fmt */ - "", /*elmt_suf1 */ - " ", /*elmt_suf2 */ - - "", /*idx_n_fmt */ - "", /*idx_sep */ - "", /*idx_fmt */ - - 80, /*line_ncols *//*standard default columns */ +static h5tool_format_t xml_dataformat = { + 0, /*raw */ + + "", /*fmt_raw */ + "%d", /*fmt_int */ + "%u", /*fmt_uint */ + "%hhd", /*fmt_schar */ + "%u", /*fmt_uchar */ + "%d", /*fmt_short */ + "%u", /*fmt_ushort */ + "%ld", /*fmt_long */ + "%lu", /*fmt_ulong */ + NULL, /*fmt_llong */ + NULL, /*fmt_ullong */ + "%g", /*fmt_double */ + "%g", /*fmt_float */ + + 0, /*ascii */ + 0, /*str_locale */ + 0, /*str_repeat */ + + "", /*arr_pre */ + "", /*arr_sep */ + "", /*arr_suf */ + 1, /*arr_linebreak */ + + "", /*cmpd_name */ + "", /*cmpd_sep */ + "", /*cmpd_pre */ + "", /*cmpd_suf */ + "", /*cmpd_end */ + + " ", /*vlen_sep */ + " ", /*vlen_pre */ + "", /*vlen_suf */ + "", /*vlen_end */ + + "%s", /*elmt_fmt */ + "", /*elmt_suf1 */ + " ", /*elmt_suf2 */ + + "", /*idx_n_fmt */ + "", /*idx_sep */ + "", /*idx_fmt */ + + 80, + /*line_ncols */ /*standard default columns */ 0, /*line_per_line */ "", /*line_pre */ "%s", /*line_1st */ @@ -89,31 +90,30 @@ static h5tool_format_t xml_dataformat = { 1, /*line_multi_new */ " ", /*line_indent */ - 1, /*skip_first */ + 1, /*skip_first */ - 1, /*obj_hidefileno */ - " "H5_PRINTF_HADDR_FMT, /*obj_format */ + 1, /*obj_hidefileno */ + " " H5_PRINTF_HADDR_FMT, /*obj_format */ - 1, /*dset_hidefileno */ - "DATASET %s ", /*dset_format */ - "%s", /*dset_blockformat_pre */ - "%s", /*dset_ptformat_pre */ - "%s", /*dset_ptformat */ - 0, /*array indices */ - 0 /*escape non printable characters */ + 1, /*dset_hidefileno */ + "DATASET %s ", /*dset_format */ + "%s", /*dset_blockformat_pre */ + "%s", /*dset_ptformat_pre */ + "%s", /*dset_ptformat */ + 0, /*array indices */ + 0 /*escape non printable characters */ }; - /* internal functions */ -static int xml_name_to_XID(const char *, char *, int , int ); +static int xml_name_to_XID(const char *, char *, int, int); /* internal functions used by XML option */ -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 char *xml_escape_the_string(const char *, int); -static char *xml_escape_the_name(const char *); +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 char *xml_escape_the_string(const char *, int); +static char *xml_escape_the_name(const char *); /*------------------------------------------------------------------------- * Function: xml_dump_all_cb @@ -132,41 +132,41 @@ static herr_t xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; - herr_t ret = SUCCEED; - char *obj_path = NULL; /* Full path of object */ - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + herr_t ret = SUCCEED; + char * obj_path = NULL; /* Full path of object */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { - string_dataformat.line_ncols = 65535; + if (h5tools_nCols == 0) { + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; /* Build the object's path name */ obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - if(!obj_path) { + if (!obj_path) { ret = FAIL; goto done; } @@ -175,354 +175,361 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); - if(linfo->type == H5L_TYPE_HARD) { - H5O_info_t oinfo; + if (linfo->type == H5L_TYPE_HARD) { + H5O_info_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + if (H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; goto done; } /* end if */ - switch(oinfo.type) { - case H5O_TYPE_GROUP: - if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { - error_msg("unable to dump group \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - char *old_prefix; /* Pointer to previous prefix */ - - /* Keep copy of prefix before iterating into group */ - if((old_prefix = HDstrdup(prefix)) == NULL) { - error_msg("unable to allocate buffer\n"); + switch (oinfo.type) { + case H5O_TYPE_GROUP: + if ((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump group \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } else { - /* Append group name to prefix */ - add_prefix(&prefix, &prefix_len, name); - - /* Iterate into group */ - dump_function_table->dump_group_function(obj, name); - - /* Restore old prefix name */ - HDstrcpy(prefix, old_prefix); - HDfree(old_prefix); - } - - /* Close group */ - H5Gclose(obj); - } - break; - - case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(dset_table, oinfo.addr); - - if(found_obj == NULL) { - ctx.indent_level++; - - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s \"%s\" %s", - h5tools_dump_header_format->datasetbegin, name, - h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { - h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); - if(HDstrlen(h5tools_dump_header_format->datasetend)) - h5tools_str_append(&buffer, " "); - } - if(HDstrlen(h5tools_dump_header_format->datasetend)) - h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - ctx.indent_level--; + char *old_prefix; /* Pointer to previous prefix */ + /* Keep copy of prefix before iterating into group */ + if ((old_prefix = HDstrdup(prefix)) == NULL) { + error_msg("unable to allocate buffer\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - H5Dclose(obj); - goto done; } - else if(found_obj->displayed) { - /* the XML version */ - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_name = xml_escape_the_name(name); - char *t_objname = xml_escape_the_name(found_obj->objname); - char dsetxid[100]; - char parentxid[100]; - char pointerxid[100]; - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); - - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " - "H5Path=\"%s\" Parents=\"%s\" " - "H5ParentPaths=\"%s\">", - xmlnsprefix, - t_name, /* Dataset Name */ - dsetxid, get_next_xid(), /* OBJ-XID */ - t_obj_path, /* H5Path */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); - - ctx.indent_level++; - - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", - xmlnsprefix, - pointerxid,t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - ctx.indent_level--; - - ctx.need_prefix = TRUE; + else { + /* Append group name to prefix */ + add_prefix(&prefix, &prefix_len, name); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Iterate into group */ + dump_function_table->dump_group_function(obj, name); - HDfree(t_name); - HDfree(t_obj_path); - HDfree(t_prefix); - HDfree(t_objname); - - H5Dclose(obj); - goto done; + /* Restore old prefix name */ + HDstrcpy(prefix, old_prefix); + HDfree(old_prefix); } - else - found_obj->displayed = TRUE; - } /* end if */ - dump_function_table->dump_dataset_function(obj, name, NULL); - H5Dclose(obj); - } - else { - error_msg("unable to dump dataset \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - break; + /* Close group */ + H5Gclose(obj); + } + break; - case H5O_TYPE_NAMED_DATATYPE: - if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { - error_msg("unable to dump datatype \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - dump_function_table->dump_named_datatype_function(obj, name); - H5Tclose(obj); - } - break; + case H5O_TYPE_DATASET: + if ((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if (oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if (found_obj == NULL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + if (HDstrlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", + h5tools_dump_header_format->datasetblockend); + if (HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + ctx.indent_level--; + + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + H5Dclose(obj); + goto done; + } + else if (found_obj->displayed) { + /* the XML version */ + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/"); + char *t_name = xml_escape_the_name(name); + char *t_objname = xml_escape_the_name(found_obj->objname); + char dsetxid[100]; + char parentxid[100]; + char pointerxid[100]; + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " + "H5Path=\"%s\" Parents=\"%s\" " + "H5ParentPaths=\"%s\">", + xmlnsprefix, t_name, /* Dataset Name */ + dsetxid, get_next_xid(), /* OBJ-XID */ + t_obj_path, /* H5Path */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", + xmlnsprefix, pointerxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + HDfree(t_name); + HDfree(t_obj_path); + HDfree(t_prefix); + HDfree(t_objname); + + H5Dclose(obj); + goto done; + } + else + found_obj->displayed = TRUE; + } /* end if */ - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - error_msg("unknown object \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - } /* end if */ - else { - char *targbuf; + dump_function_table->dump_dataset_function(obj, name, NULL); + H5Dclose(obj); + } + else { + error_msg("unable to dump dataset \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + break; - switch(linfo->type) { - case H5L_TYPE_SOFT: - if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { - error_msg("unable to allocate buffer\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg("unable to get link value\n"); + case H5O_TYPE_NAMED_DATATYPE: + if ((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } else { - /* print the value of a soft link */ - /* XML */ - char linkxid[100]; - char parentxid[100]; - char targetxid[100]; - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_name = xml_escape_the_name(name); - char *t_targbuf = xml_escape_the_name(targbuf); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_link_path; - int res; - - t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); - if(targbuf[0] == '/') - HDstrcpy(t_link_path, targbuf); - else { - HDstrcpy(t_link_path, prefix); - HDstrcat(HDstrcat(t_link_path, "/"), targbuf); - } /* end else */ - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); - - /* Try to create an OBJ-XID for the object pointed to */ - res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0); - if (res == 0) { - /* target obj found */ - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetPath=\"%s\" TargetObj=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - t_targbuf, /* TargetPath */ - targetxid, /* TargetObj */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - else { - /* dangling link -- omit from xml attributes */ - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - t_targbuf, /* TargetPath */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_targbuf); - HDfree(t_obj_path); - HDfree(t_link_path); + dump_function_table->dump_named_datatype_function(obj, name); + H5Tclose(obj); } + break; - HDfree(targbuf); - } - break; - - case H5L_TYPE_EXTERNAL: - if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { - error_msg("unable to allocate buffer\n"); + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + error_msg("unknown object \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } - else { - if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg("unable to get external link value\n"); + } + } /* end if */ + else { + char *targbuf; + + switch (linfo->type) { + case H5L_TYPE_SOFT: + if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { + error_msg("unable to allocate buffer\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } /* end if */ + } else { - const char *filename; - const char *targname; - - if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { - error_msg("unable to unpack external link value\n"); + if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } /* end if */ + } else { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + /* print the value of a soft link */ + /* XML */ + char linkxid[100]; + char parentxid[100]; + char targetxid[100]; + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/"); + char *t_name = xml_escape_the_name(name); + char *t_targbuf = xml_escape_the_name(targbuf); char *t_obj_path = xml_escape_the_name(obj_path); - char *t_filename = xml_escape_the_name(filename); - char *t_targname = xml_escape_the_name(targname); + char *t_link_path; + int res; + + t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); + if (targbuf[0] == '/') + HDstrcpy(t_link_path, targbuf); + else { + HDstrcpy(t_link_path, prefix); + HDstrcat(HDstrcat(t_link_path, "/"), targbuf); + } /* end else */ /* Create OBJ-XIDs for the parent and object */ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetFilename=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - filename, /* TargetFilename */ - targname, /* TargetPath*/ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Try to create an OBJ-XID for the object pointed to */ + res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0); + if (res == 0) { + /* target obj found */ + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sSoftLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetPath=\"%s\" TargetObj=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + t_targbuf, /* TargetPath */ + targetxid, /* TargetObj */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } + else { + /* dangling link -- omit from xml attributes */ + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sSoftLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + t_targbuf, /* TargetPath */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } HDfree(t_prefix); HDfree(t_name); - HDfree(t_filename); - HDfree(t_targname); + HDfree(t_targbuf); HDfree(t_obj_path); - } /* end else */ - } /* end else */ - HDfree(targbuf); - } - break; + HDfree(t_link_path); + } - case H5L_TYPE_ERROR: - case H5L_TYPE_MAX: - case H5L_TYPE_HARD: - default: - { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + HDfree(targbuf); + } + break; + + case H5L_TYPE_EXTERNAL: + if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { + error_msg("unable to allocate buffer\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + const char *filename; + const char *targname; + + if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { + error_msg("unable to unpack external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_filename = xml_escape_the_name(filename); + char *t_targname = xml_escape_the_name(targname); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sExternalLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetFilename=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + filename, /* TargetFilename */ + targname, /* TargetPath*/ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_filename); + HDfree(t_targname); + HDfree(t_obj_path); + } /* end else */ + } /* end else */ + HDfree(targbuf); + } + break; + + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: + case H5L_TYPE_HARD: + default: { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/"); char *t_obj_path = xml_escape_the_name(obj_path); /* Create OBJ-XIDs for the parent and object */ @@ -533,34 +540,34 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "LinkClass=\"%d\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - linfo->type, /* LinkClass */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, + "<%sUserDefined LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "LinkClass=\"%d\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + linfo->type, /* LinkClass */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_prefix); HDfree(t_name); HDfree(t_obj_path); - } - break; + } break; } /* end switch */ - } /* end else */ + } /* end else */ done: h5tools_str_close(&buffer); - if(obj_path) + if (obj_path) HDfree(obj_path); return ret; } @@ -573,11 +580,12 @@ done: * 1 - generate a fake entry and return fake id. */ int -xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) +xml_name_to_XID(const char *str, char *outstr, int outlen, int gen) { - haddr_t objno; /* Object ID for object at path */ + haddr_t objno; /* Object ID for object at path */ - if (outlen < 22) return 1; + if (outlen < 22) + return 1; objno = ref_path_table_lookup(str); if (objno == HADDR_UNDEF) { @@ -586,7 +594,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) if (objno == HADDR_UNDEF) { if (gen) { objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno); return 0; } else { @@ -597,7 +605,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) else { if (gen) { objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno); return 0; } else { @@ -606,16 +614,16 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } } - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno); - return(0); + return (0); } -static const char *quote = """; -static const char *amp = "&"; -static const char *lt = "<"; -static const char *gt = ">"; -static const char *apos = "'"; +static const char *quote = """; +static const char *amp = "&"; +static const char *lt = "<"; +static const char *gt = ">"; +static const char *apos = "'"; /*------------------------------------------------------------------------- * Function: xml_escape_the_name @@ -628,22 +636,22 @@ static const char *apos = "'"; * Programmer: REMcG *------------------------------------------------------------------------- */ -static char * +static char * xml_escape_the_name(const char *str) { size_t extra; size_t len; size_t i; const char *cp; - char *ncp; - char *rcp; + char * ncp; + char * rcp; size_t ncp_len; if (!str) return NULL; - cp = str; - len = HDstrlen(str); + cp = str; + len = HDstrlen(str); extra = 0; for (i = 0; i < len; i++) { @@ -664,12 +672,12 @@ xml_escape_the_name(const char *str) if (extra == 0) return HDstrdup(str); - cp = str; + cp = str; ncp_len = len + extra + 1; rcp = ncp = (char *)HDmalloc(ncp_len); if (!ncp) - return NULL; /* ?? */ + return NULL; /* ?? */ for (i = 0; i < len; i++) { size_t esc_len; @@ -695,7 +703,7 @@ xml_escape_the_name(const char *str) esc_len = HDstrlen(amp); } else { - *ncp = *cp; + *ncp = *cp; esc_len = 1; } ncp += esc_len; @@ -718,15 +726,15 @@ xml_escape_the_name(const char *str) * Programmer: REMcG *------------------------------------------------------------------------- */ -static char * +static char * xml_escape_the_string(const char *str, int slen) { size_t extra; size_t len; size_t i; const char *cp; - char *ncp; - char *rcp; + char * ncp; + char * rcp; size_t ncp_len; if (!str) @@ -757,9 +765,9 @@ xml_escape_the_string(const char *str, int slen) cp++; } - cp = str; + cp = str; ncp_len = len + extra + 1; - rcp = ncp = (char *) HDcalloc(ncp_len, sizeof(char)); + rcp = ncp = (char *)HDcalloc(ncp_len, sizeof(char)); if (ncp == NULL) return NULL; /* ?? */ @@ -768,13 +776,13 @@ xml_escape_the_string(const char *str, int slen) size_t esc_len; if (*cp == '\\') { - *ncp++ = '\\'; - *ncp = *cp; + *ncp++ = '\\'; + *ncp = *cp; esc_len = 1; } else if (*cp == '\"') { - *ncp++ = '\\'; - *ncp = *cp; + *ncp++ = '\\'; + *ncp = *cp; esc_len = 1; } else if (*cp == '\'') { @@ -794,7 +802,7 @@ xml_escape_the_string(const char *str, int slen) HDstrncpy(ncp, amp, esc_len); } else { - *ncp = *cp; + *ncp = *cp; esc_len = 1; } ncp += esc_len; @@ -825,69 +833,69 @@ xml_escape_the_string(const char *str, int slen) static void xml_print_datatype(hid_t type, unsigned in_group) { - char *mname; - hid_t mtype; - unsigned nmembers; - unsigned ndims; - unsigned i; - size_t size; - hsize_t dims[H5DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - hid_t super; - H5T_order_t ord; - H5T_sign_t sgn; - size_t sz; - size_t spos; - size_t epos; - size_t esize; - size_t mpos; - size_t msize; - int nmembs; - htri_t is_vlstr = FALSE; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; - h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + char * mname; + hid_t mtype; + unsigned nmembers; + unsigned ndims; + unsigned i; + size_t size; + hsize_t dims[H5DUMP_MAX_RANK]; + H5T_str_t str_pad; + H5T_cset_t cset; + hid_t super; + H5T_order_t ord; + H5T_sign_t sgn; + size_t sz; + size_t spos; + size_t epos; + size_t esize; + size_t mpos; + size_t msize; + int nmembs; + htri_t is_vlstr = FALSE; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { - string_dataformat.line_ncols = 65535; + if (h5tools_nCols == 0) { + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; - if(!in_group && H5Tcommitted(type) > 0) { + if (!in_group && H5Tcommitted(type) > 0) { H5O_info_t oinfo; - obj_t *found_obj; /* Found object */ + obj_t * found_obj; /* Found object */ /* detect a shared datatype, output only once */ H5Oget_info(type, &oinfo); found_obj = search_obj(type_table, oinfo.addr); - if(found_obj) { + if (found_obj) { /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - char * dtxid = (char *)HDmalloc((size_t)100); + char *dtxid = (char *)HDmalloc((size_t)100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -898,9 +906,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", - xmlnsprefix, dtxid); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", xmlnsprefix, dtxid); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* point to the NDT by name */ @@ -910,9 +918,10 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", - xmlnsprefix, dtxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, + dtxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); } HDfree(dtxid); @@ -923,7 +932,8 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_setstatus(EXIT_FAILURE); } } @@ -934,8 +944,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */ @@ -946,7 +957,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix); + h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"", xmlnsprefix); switch (ord) { case H5T_ORDER_LE: h5tools_str_append(&buffer, "LE"); @@ -983,15 +994,17 @@ xml_print_datatype(hid_t type, unsigned in_group) sz = H5Tget_size(type); h5tools_str_append(&buffer, "%lu", (unsigned long)sz); h5tools_str_append(&buffer, "\" />"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_FLOAT: @@ -1005,15 +1018,16 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix); + h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"", xmlnsprefix); switch (ord) { case H5T_ORDER_LE: @@ -1037,17 +1051,21 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "%lu", (unsigned long)sz); H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); - h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); - h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", + (unsigned long)esize, (unsigned long)epos); + h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", + (unsigned long)msize, (unsigned long)mpos); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_TIME: @@ -1055,16 +1073,18 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sTimeType />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->"); ctx.indent_level--; @@ -1072,23 +1092,25 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_STRING: /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */ - size = H5Tget_size(type); - str_pad = H5Tget_strpad(type); - cset = H5Tget_cset(type); + size = H5Tget_size(type); + str_pad = H5Tget_strpad(type); + cset = H5Tget_cset(type); is_vlstr = H5Tis_variable_str(type); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -1096,17 +1118,17 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix); + h5tools_str_append(&buffer, "<%sStringType Cset=\"", xmlnsprefix); if (cset == H5T_CSET_ASCII) h5tools_str_append(&buffer, "H5T_CSET_ASCII\" "); else h5tools_str_append(&buffer, "unknown_cset\" "); - if(is_vlstr) + if (is_vlstr) h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\""); else - h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size); + h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int)size); if (str_pad == H5T_STR_NULLTERM) h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>"); @@ -1116,15 +1138,17 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>"); else h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_BITFIELD: @@ -1135,15 +1159,16 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); + h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"", xmlnsprefix); switch (ord) { case H5T_ORDER_LE: @@ -1162,15 +1187,17 @@ xml_print_datatype(hid_t type, unsigned in_group) size = H5Tget_size(type); h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_OPAQUE: @@ -1180,8 +1207,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; mname = H5Tget_tag(type); @@ -1189,19 +1217,21 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); + h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ", xmlnsprefix, mname); H5free_memory(mname); size = H5Tget_size(type); h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_COMPOUND: @@ -1214,8 +1244,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sCompoundType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* List each member Field of the type */ /* <hdf5:Field FieldName="name" > */ @@ -1225,16 +1256,17 @@ xml_print_datatype(hid_t type, unsigned in_group) for (i = 0; i < nmembers; i++) { char *t_fname; - mname = H5Tget_member_name(type, i); - mtype = H5Tget_member_type(type, i); + mname = H5Tget_member_name(type, i); + mtype = H5Tget_member_type(type, i); t_fname = xml_escape_the_name(mname); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">", xmlnsprefix, t_fname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5free_memory(mname); HDfree(t_fname); @@ -1245,11 +1277,12 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; - xml_print_datatype(mtype,0); + xml_print_datatype(mtype, 0); dump_indent -= COL; ctx.indent_level--; @@ -1257,8 +1290,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; @@ -1266,8 +1300,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sField>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sField>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } dump_indent -= COL; ctx.indent_level--; @@ -1276,8 +1311,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sCompoundType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_REFERENCE: @@ -1285,8 +1321,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; /* Only Object references supported at this time */ @@ -1294,32 +1331,36 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sReferenceType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sObjectReferenceType />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sReferenceType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_ENUM: @@ -1330,8 +1371,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent += COL; ctx.indent_level++; @@ -1339,16 +1381,18 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">", xmlnsprefix, nmembs); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); xml_print_enum(type); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sEnumType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; @@ -1356,8 +1400,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_VLEN: @@ -1365,8 +1410,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sVLType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); super = H5Tget_super(type); dump_indent += COL; ctx.indent_level++; @@ -1375,11 +1421,12 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent += COL; ctx.indent_level++; - xml_print_datatype(super,0); + xml_print_datatype(super, 0); dump_indent -= COL; ctx.indent_level--; @@ -1387,8 +1434,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; @@ -1396,8 +1444,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sVLType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Tclose(super); break; @@ -1408,14 +1457,14 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Print lead-in */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); + h5tools_str_append(&buffer, "<%sArrayType Ndims=\"", xmlnsprefix); ndims = (unsigned)H5Tget_array_ndims(type); h5tools_str_append(&buffer, "%u\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Get array information */ H5Tget_array_dims2(type, dims); @@ -1427,8 +1476,10 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, + (int)dims[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; @@ -1439,11 +1490,12 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent += COL; ctx.indent_level++; - xml_print_datatype(super,0); + xml_print_datatype(super, 0); dump_indent -= COL; ctx.indent_level--; @@ -1451,8 +1503,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; @@ -1460,8 +1513,9 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sArrayType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Close array base type */ H5Tclose(super); break; @@ -1474,7 +1528,8 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- unknown datatype -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_setstatus(EXIT_FAILURE); break; } @@ -1496,48 +1551,48 @@ xml_print_datatype(hid_t type, unsigned in_group) void xml_dump_datatype(hid_t type) { - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.indent_level++; dump_indent += COL; - if(H5Tcommitted(type) > 0) { + if (H5Tcommitted(type) > 0) { H5O_info_t oinfo; - obj_t *found_obj; /* Found object */ + obj_t * found_obj; /* Found object */ /* Datatype is a shared or named datatype */ H5Oget_info(type, &oinfo); found_obj = search_obj(type_table, oinfo.addr); - if(found_obj) { + if (found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ char *dtxid = (char *)HDmalloc((size_t)100); @@ -1554,9 +1609,9 @@ xml_dump_datatype(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", - xmlnsprefix, dtxid); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", xmlnsprefix, dtxid); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* pointer to a named datatype already in XML */ @@ -1567,8 +1622,9 @@ xml_dump_datatype(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />", - xmlnsprefix, dtxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + xmlnsprefix, dtxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); } HDfree(dtxid); @@ -1579,7 +1635,8 @@ xml_dump_datatype(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } } else { @@ -1588,7 +1645,8 @@ xml_dump_datatype(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; xml_print_datatype(type, 0); @@ -1600,7 +1658,8 @@ xml_dump_datatype(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; dump_indent -= COL; @@ -1624,38 +1683,38 @@ xml_dump_dataspace(hid_t space) hsize_t size[H5DUMP_MAX_RANK]; hsize_t maxsize[H5DUMP_MAX_RANK]; int i; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ - int ndims = H5Sget_simple_extent_dims(space, size, maxsize); - H5S_class_t space_type = H5Sget_simple_extent_type(space); + int ndims = H5Sget_simple_extent_dims(space, size, maxsize); + H5S_class_t space_type = H5Sget_simple_extent_type(space); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.indent_level++; @@ -1664,96 +1723,111 @@ xml_dump_dataspace(hid_t space) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; switch (space_type) { - case H5S_SCALAR: - /* scalar dataspace (just a tag, no XML attrs. defined */ + case H5S_SCALAR: + /* scalar dataspace (just a tag, no XML attrs. defined */ - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sScalarDataspace />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - case H5S_SIMPLE: - /* simple dataspace */ - /* <hdf5:SimpleDataspace Ndims="nd"> */ + case H5S_SIMPLE: + /* simple dataspace */ + /* <hdf5:SimpleDataspace Ndims="nd"> */ - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">", xmlnsprefix, ndims); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* print the <hdf5:Dimension> elements */ - ctx.indent_level++; - for (i = 0; i < ndims; i++) { - if (maxsize[i] == H5S_UNLIMITED) { - ctx.need_prefix = TRUE; + /* print the <hdf5:Dimension> elements */ + ctx.indent_level++; + for (i = 0; i < ndims; i++) { + if (maxsize[i] == H5S_UNLIMITED) { + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>", - xmlnsprefix,size[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - else if (maxsize[i] == (hsize_t) 0) { - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH + "u\" MaxDimSize=\"UNLIMITED\"/>", + xmlnsprefix, size[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } + else if (maxsize[i] == (hsize_t)0) { + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", - xmlnsprefix,size[i], size[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - else { - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH + "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", + xmlnsprefix, size[i], size[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } + else { + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", - xmlnsprefix, size[i], maxsize[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, + "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH + "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", + xmlnsprefix, size[i], maxsize[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } } - } - ctx.indent_level--; + ctx.indent_level--; - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix ); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; #ifdef TMP - /* Commented out: wait until the schema is updated first */ - case H5S_NULL: - /* null dataspace (just a tag, no XML attrs. defined */ + /* Commented out: wait until the schema is updated first */ + case H5S_NULL: + /* null dataspace (just a tag, no XML attrs. defined */ - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNullDataspace />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; #endif /* TMP */ - case H5S_NULL: - case H5S_NO_CLASS: - default: - ctx.need_prefix = TRUE; + case H5S_NULL: + case H5S_NO_CLASS: + default: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- unknown dataspace -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- unknown dataspace -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; @@ -1763,7 +1837,8 @@ xml_dump_dataspace(hid_t space) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataspace>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; h5tools_str_close(&buffer); @@ -1777,31 +1852,24 @@ xml_dump_dataspace(hid_t space) * the h5tools library. * * Return: void - * - * Programmer: REMcG *------------------------------------------------------------------------- */ void -xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, int H5_ATTR_UNUSED pindex) +xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex) { - hid_t space = -1; - hid_t type = -1; - hid_t p_type = -1; - hsize_t size[64]; - hsize_t nelmts = 1; - int ndims; - int i; - int status = -1; - void *buf = NULL; - hsize_t curr_pos = 0; /* total data element position */ - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; - h5tool_format_t string_dataformat; + hid_t space = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t p_type = H5I_INVALID_HID; + int status = -1; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; /* Print all the values. */ /* setup */ @@ -1811,29 +1879,30 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.cmpd_sep = " "; - string_dataformat.cmpd_pre = ""; - string_dataformat.cmpd_suf = ""; - string_dataformat.cmpd_end = ""; + string_dataformat.cmpd_sep = " "; + string_dataformat.cmpd_pre = ""; + string_dataformat.cmpd_suf = ""; + string_dataformat.cmpd_end = ""; string_dataformat.arr_linebreak = 0; - string_dataformat.arr_pre = ""; - outputformat = &string_dataformat; + string_dataformat.arr_pre = ""; + outputformat = &string_dataformat; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -1842,7 +1911,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -1858,10 +1928,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, else { h5tools_context_t datactx; HDmemset(&datactx, 0, sizeof(datactx)); - datactx.need_prefix = TRUE; + datactx.need_prefix = TRUE; datactx.indent_level = ctx.indent_level; - datactx.cur_column = ctx.cur_column; - status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, NULL); + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id); } } else { @@ -1880,48 +1950,18 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, else if (H5Tget_class(type) == H5T_STRING) { status = xml_print_strs(obj_id, ATTRIBUTE_DATA); } - else { /* all other data */ - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT); - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen(p_type) == TRUE) - vl_data = TRUE; - - H5Tclose(type); - + else { /* all other data */ space = H5Aget_space(obj_id); - if(space == H5S_NULL || space == H5S_NO_CLASS) { + if (space == H5S_NULL || space == H5S_NO_CLASS) { status = SUCCEED; } else { - ndims = H5Sget_simple_extent_dims(space, size, NULL); - - for (i = 0; i < ndims; i++) - nelmts *= size[i]; - - if((buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))))) == NULL) { - error_msg("unable to allocate buffer\n"); - h5tools_setstatus(EXIT_FAILURE); - status = FAIL; - } - else { - if (H5Aread(obj_id, p_type, buf) >= 0) { - h5tools_context_t datactx; - HDmemset(&datactx, 0, sizeof(datactx)); - datactx.need_prefix = TRUE; - datactx.indent_level = ctx.indent_level; - datactx.cur_column = ctx.cur_column; - status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf); - } - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - - HDfree(buf); - } + h5tools_context_t datactx; + HDmemset(&datactx, 0, sizeof(datactx)); + datactx.need_prefix = TRUE; + datactx.indent_level = ctx.indent_level; + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id); } H5Tclose(p_type); H5Sclose(space); @@ -1937,7 +1977,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "Unable to print data."); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -1952,8 +1993,9 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -1962,7 +2004,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -1979,16 +2022,16 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, */ herr_t xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, - void H5_ATTR_UNUSED * op_data) + void H5_ATTR_UNUSED *op_data) { - hid_t attr_id = -1; - hid_t type = -1; - hid_t space = -1; + hid_t attr_id = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; H5S_class_t space_type; - hsize_t curr_pos = 0; /* total data element position */ - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; char *t_aname = xml_escape_the_name(attr_name); @@ -1998,36 +2041,37 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_aname); if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); + type = H5Aget_type(attr_id); + space = H5Aget_space(attr_id); space_type = H5Sget_simple_extent_type(space); dump_function_table->dump_dataspace_function(space); @@ -2038,158 +2082,175 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED if (display_attr_data && space_type != H5S_NULL) { switch (H5Tget_class(type)) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + + case H5T_TIME: + ctx.indent_level++; + dump_indent += COL; - case H5T_TIME: - ctx.indent_level++; - dump_indent += COL; + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<hdf5:Data>"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<hdf5:Data>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; + dump_indent -= COL; + break; - ctx.indent_level--; - dump_indent -= COL; - break; + case H5T_COMPOUND: + ctx.need_prefix = TRUE; - case H5T_COMPOUND: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; + case H5T_REFERENCE: + ctx.need_prefix = TRUE; - case H5T_REFERENCE: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } + else { + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + xml_print_refs(attr_id, ATTRIBUTE_DATA); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_VLEN: ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - else { + h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - xml_print_refs(attr_id, ATTRIBUTE_DATA); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - - case H5T_VLEN: - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - case H5T_NO_CLASS: - case H5T_NCLASSES: - default: - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - ctx.need_prefix = TRUE; + h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type)); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; } } else { @@ -2200,7 +2261,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -2209,7 +2271,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2218,7 +2281,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; dump_indent -= COL; @@ -2232,7 +2296,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); return SUCCEED; @@ -2246,7 +2311,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2255,7 +2321,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); @@ -2277,17 +2344,17 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED void xml_dump_named_datatype(hid_t type, const char *name) { - hsize_t curr_pos = 0; /* total data element position */ - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - char *tmp; - char *dtxid; - char *parentxid; - char *t_tmp; - char *t_prefix; - char *t_name; + char * tmp; + char * dtxid; + char * parentxid; + char * t_tmp; + char * t_prefix; + char * t_name; tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); @@ -2299,34 +2366,34 @@ xml_dump_named_datatype(hid_t type, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; - dtxid = (char *)HDmalloc((size_t)100); + dtxid = (char *)HDmalloc((size_t)100); parentxid = (char *)HDmalloc((size_t)100); - t_tmp = xml_escape_the_name(tmp); - t_prefix = xml_escape_the_name(prefix); - t_name = xml_escape_the_name(name); + t_tmp = xml_escape_the_name(tmp); + t_prefix = xml_escape_the_name(prefix); + t_name = xml_escape_the_name(name); xml_name_to_XID(tmp, dtxid, 100, 1); xml_name_to_XID(prefix, parentxid, 100, 1); - if(HDstrncmp(name, "#", (size_t)1) == 0) { + if (HDstrncmp(name, "#", (size_t)1) == 0) { /* Special: this is an 'anonymous' NDT, deleted but still in use. We follow the dumper's undocumented practice, and @@ -2340,31 +2407,32 @@ xml_dump_named_datatype(hid_t type, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\">", - xmlnsprefix, - name, dtxid, - parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, + "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix, "") ? t_prefix : "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { - H5O_info_t oinfo; /* Object info */ + H5O_info_t oinfo; /* Object info */ ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " - "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", - xmlnsprefix, - t_name, dtxid, - t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, + "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " + "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, t_name, dtxid, t_tmp, parentxid, + (HDstrcmp(prefix, "") ? t_prefix : "/")); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Check uniqueness of named datatype */ H5Oget_info(type, &oinfo); - if(oinfo.rc > 1) { - obj_t *found_obj; /* Found object */ + if (oinfo.rc > 1) { + obj_t *found_obj; /* Found object */ /* Group with more than one link to it... */ found_obj = search_obj(type_table, oinfo.addr); @@ -2375,11 +2443,11 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_setstatus(EXIT_FAILURE); goto done; } - else if(found_obj->displayed) { + else if (found_obj->displayed) { /* We have already printed this named datatype, print it as a * NamedDatatypePtr */ - char pointerxid[100]; + char pointerxid[100]; char *t_objname = xml_escape_the_name(found_obj->objname); ctx.indent_level++; @@ -2390,8 +2458,10 @@ xml_dump_named_datatype(hid_t type, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, + pointerxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2400,7 +2470,8 @@ xml_dump_named_datatype(hid_t type, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); goto done; } @@ -2416,12 +2487,13 @@ xml_dump_named_datatype(hid_t type, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; - xml_print_datatype(type,1); + xml_print_datatype(type, 1); ctx.indent_level--; dump_indent -= COL; @@ -2429,8 +2501,9 @@ xml_dump_named_datatype(hid_t type, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -2439,8 +2512,9 @@ xml_dump_named_datatype(hid_t type, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); done: @@ -2467,23 +2541,23 @@ done: void xml_dump_group(hid_t gid, const char *name) { - H5O_info_t oinfo; - hid_t gcpl_id; - hid_t dset, type; - unsigned crt_order_flags; - unsigned attr_crt_order_flags; - int isRoot = 0; - char type_name[1024]; - char *t_objname = NULL; - char *par_name = NULL; - char *cp = NULL; - char *tmp = NULL; - char *par = NULL; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; - h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + H5O_info_t oinfo; + hid_t gcpl_id; + hid_t dset, type; + unsigned crt_order_flags; + unsigned attr_crt_order_flags; + int isRoot = 0; + char type_name[1024]; + char * t_objname = NULL; + char * par_name = NULL; + char * cp = NULL; + char * tmp = NULL; + char * par = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { error_msg("error in getting group creation property list ID\n"); @@ -2497,12 +2571,12 @@ xml_dump_group(hid_t gid, const char *name) } /* query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { + if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { error_msg("error in getting group creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } - if(H5Pclose(gcpl_id) < 0) { + if (H5Pclose(gcpl_id) < 0) { error_msg("error in closing group creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -2512,36 +2586,36 @@ xml_dump_group(hid_t gid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; - if(HDstrcmp(name, "/") == 0) { + if (HDstrcmp(name, "/") == 0) { isRoot = 1; - tmp = HDstrdup("/"); + tmp = HDstrdup("/"); } else { tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); par = HDstrdup(tmp); - cp = HDstrrchr(par, '/'); - if(cp) { - if((cp == par) && HDstrlen(par) > 1) + cp = HDstrrchr(par, '/'); + if (cp) { + if ((cp == par) && HDstrlen(par) > 1) *(cp + 1) = '\0'; else *cp = '\0'; @@ -2550,8 +2624,8 @@ xml_dump_group(hid_t gid, const char *name) H5Oget_info(gid, &oinfo); - if(oinfo.rc > 1) { - obj_t *found_obj; /* Found object */ + if (oinfo.rc > 1) { + obj_t *found_obj; /* Found object */ /* Group with more than one link to it... */ found_obj = search_obj(group_table, oinfo.addr); @@ -2562,15 +2636,15 @@ xml_dump_group(hid_t gid, const char *name) h5tools_setstatus(EXIT_FAILURE); } else { - char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc((size_t)100); + char *t_name = xml_escape_the_name(name); + char *grpxid = (char *)HDmalloc((size_t)100); char *parentxid = (char *)HDmalloc((size_t)100); - if(found_obj->displayed) { + if (found_obj->displayed) { char *ptrstr = (char *)HDmalloc((size_t)100); /* already seen: enter a groupptr */ - if(isRoot) { + if (isRoot) { /* probably can't happen! */ xml_name_to_XID("/", grpxid, 100, 1); @@ -2578,13 +2652,14 @@ xml_dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", - xmlnsprefix, grpxid, "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, + grpxid, "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { t_objname = xml_escape_the_name(found_obj->objname); - par_name = xml_escape_the_name(par); + par_name = xml_escape_the_name(par); xml_name_to_XID(tmp, grpxid, 100, 1); xml_name_to_XID(par, parentxid, 100, 1); @@ -2592,18 +2667,20 @@ xml_dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\">", - xmlnsprefix,t_name, grpxid, get_next_xid(), - t_objname, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, + "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, t_name, grpxid, get_next_xid(), t_objname, parentxid, + par_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); HDfree(par_name); ctx.indent_level++; - t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ - par_name = xml_escape_the_name(par); + t_objname = xml_escape_the_name(found_obj->objname); /* point to the NDT by name */ + par_name = xml_escape_the_name(par); xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); xml_name_to_XID(par, parentxid, 100, 1); @@ -2611,11 +2688,12 @@ xml_dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />", - xmlnsprefix, - ptrstr, t_objname, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, + "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, ptrstr, t_objname, parentxid, par_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2627,16 +2705,17 @@ xml_dump_group(hid_t gid, const char *name) else { /* first time this group has been seen -- describe it */ - if(isRoot) { + if (isRoot) { xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", - xmlnsprefix, grpxid, "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, + grpxid, "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_tmp = xml_escape_the_name(tmp); @@ -2649,10 +2728,12 @@ xml_dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >", - xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, + "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >", + xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_tmp); HDfree(par_name); @@ -2664,28 +2745,30 @@ xml_dump_group(hid_t gid, const char *name) ctx.indent_level++; dump_indent += COL; - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if (H5Aiterate2(gid, sort_by, sort_order, NULL, + dump_function_table->dump_attribute_function, NULL) < 0) { error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ - } /* end if */ + } /* end if */ else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, + dump_function_table->dump_attribute_function, NULL) < 0) { error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ - } /* end else */ + } /* end else */ - if(isRoot && unamedtype) { + if (isRoot && unamedtype) { unsigned u; /* Very special case: dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) { - if(!type_table->objs[u].recorded) { + for (u = 0; u < type_table->nobjs; u++) { + if (!type_table->objs[u].recorded) { dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -2695,7 +2778,7 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the links */ - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); else H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); @@ -2710,8 +2793,8 @@ xml_dump_group(hid_t gid, const char *name) } else { /* only link -- must be first time! */ - char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc((size_t)100); + char *t_name = xml_escape_the_name(name); + char *grpxid = (char *)HDmalloc((size_t)100); char *parentxid = (char *)HDmalloc((size_t)100); ctx.need_prefix = TRUE; @@ -2719,9 +2802,10 @@ xml_dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - if(isRoot) { + if (isRoot) { xml_name_to_XID("/", grpxid, 100, 1); - h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, + "/"); } else { char *t_tmp = xml_escape_the_name(tmp); @@ -2729,13 +2813,15 @@ xml_dump_group(hid_t gid, const char *name) par_name = xml_escape_the_name(par); xml_name_to_XID(tmp, grpxid, 100, 1); xml_name_to_XID(par, parentxid, 100, 1); - h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >", - xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); + h5tools_str_append(&buffer, + "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >", + xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); HDfree(t_tmp); HDfree(par_name); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); HDfree(grpxid); @@ -2746,28 +2832,30 @@ xml_dump_group(hid_t gid, const char *name) ctx.indent_level++; dump_indent += COL; - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, + NULL) < 0) { error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ - } /* end if */ + } /* end if */ else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, + dump_function_table->dump_attribute_function, NULL) < 0) { error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ - } /* end else */ + } /* end else */ - if(isRoot && unamedtype) { + if (isRoot && unamedtype) { unsigned u; /* Very special case: dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) { - if(!type_table->objs[u].recorded) { + for (u = 0; u < type_table->nobjs; u++) { + if (!type_table->objs[u].recorded) { dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -2777,7 +2865,7 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the links */ - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); else H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); @@ -2790,17 +2878,18 @@ xml_dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - if(isRoot) + if (isRoot) h5tools_str_append(&buffer, "</%sRootGroup>", xmlnsprefix); else h5tools_str_append(&buffer, "</%sGroup>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); - if(par) + if (par) HDfree(par); - if(tmp) + if (tmp) HDfree(tmp); } @@ -2818,18 +2907,18 @@ static int xml_print_refs(hid_t did, int source) { herr_t e; - hid_t type = -1; - hid_t space = -1; - hssize_t ssiz = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hssize_t ssiz = -1; hsize_t i; size_t tsiz; - hobj_ref_t *refbuf = NULL; - char *buf = NULL; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + hobj_ref_t * refbuf = NULL; + char * buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ if (source == DATASET_DATA) { type = H5Dget_type(did); @@ -2857,7 +2946,7 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) HDcalloc((size_t)ssiz, tsiz); + buf = (char *)HDcalloc((size_t)ssiz, tsiz); if (buf == NULL) goto error; e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -2872,7 +2961,7 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) HDcalloc((size_t)ssiz, tsiz); + buf = (char *)HDcalloc((size_t)ssiz, tsiz); if (buf == NULL) goto error; e = H5Aread(did, H5T_STD_REF_OBJ, buf); @@ -2881,31 +2970,31 @@ xml_print_refs(hid_t did, int source) goto error; } - refbuf = (hobj_ref_t *) buf; + refbuf = (hobj_ref_t *)((void *)buf); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; for (i = 0; i < (hsize_t)ssiz; i++) { const char *path = lookup_ref_path(*refbuf); @@ -2917,7 +3006,8 @@ xml_print_refs(hid_t did, int source) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_path = xml_escape_the_string(path, -1); @@ -2927,7 +3017,8 @@ xml_print_refs(hid_t did, int source) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_path); } ctx.indent_level--; @@ -2943,13 +3034,15 @@ xml_print_refs(hid_t did, int source) return SUCCEED; error: - if(buf) + if (buf) HDfree(buf); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Tclose(type); H5Sclose(space); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } @@ -2967,21 +3060,21 @@ static int xml_print_strs(hid_t did, int source) { herr_t e; - hid_t type = -1; - hid_t space = -1; - hssize_t ssiz = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hssize_t ssiz = -1; htri_t is_vlstr = FALSE; - size_t tsiz = 0; + size_t tsiz = 0; hsize_t i; - size_t str_size = 0; - char *bp = NULL; - char *onestring = NULL; - void *buf = NULL; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + size_t str_size = 0; + char * bp = NULL; + char * onestring = NULL; + void * buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ if (source == DATASET_DATA) type = H5Dget_type(did); @@ -2998,9 +3091,9 @@ xml_print_strs(hid_t did, int source) if (source == DATASET_DATA) { space = H5Dget_space(did); - if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - if((tsiz = H5Tget_size(type)) == 0) + if ((tsiz = H5Tget_size(type)) == 0) goto error; buf = HDmalloc((size_t)ssiz * tsiz); @@ -3013,9 +3106,9 @@ xml_print_strs(hid_t did, int source) } else if (source == ATTRIBUTE_DATA) { space = H5Aget_space(did); - if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - if((tsiz = H5Tget_size(type)) == 0) + if ((tsiz = H5Tget_size(type)) == 0) goto error; buf = HDmalloc((size_t)ssiz * tsiz); @@ -3027,37 +3120,37 @@ xml_print_strs(hid_t did, int source) goto error; } - bp = (char*) buf; + bp = (char *)buf; if (!is_vlstr) - onestring = (char *) HDcalloc(tsiz, sizeof(char)); + onestring = (char *)HDcalloc(tsiz, sizeof(char)); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { - onestring = *(char **) bp; + onestring = *(char **)((void *)bp); if (onestring) str_size = HDstrlen(onestring); } @@ -3072,7 +3165,8 @@ xml_print_strs(hid_t did, int source) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_onestring = xml_escape_the_string(onestring, (int)str_size); @@ -3083,7 +3177,8 @@ xml_print_strs(hid_t did, int source) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_onestring); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_onestring); } } @@ -3106,13 +3201,15 @@ xml_print_strs(hid_t did, int source) return SUCCEED; error: - if(buf) + if (buf) HDfree(buf); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Tclose(type); H5Sclose(space); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } @@ -3137,41 +3234,42 @@ check_filters(hid_t dcpl) size_t cd_nelmts = 20; unsigned int cd_values[20]; unsigned int flags; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; nfilt = H5Pget_nfilters(dcpl); if (nfilt <= 0) return; for (i = 0; i < nfilt; i++) { - filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, (size_t)120, namebuf, NULL); + filter = H5Pget_filter2(dcpl, (unsigned)i, &flags, (size_t *)&cd_nelmts, cd_values, (size_t)120, + namebuf, NULL); if (filter == H5Z_FILTER_DEFLATE) { ctx.indent_level++; ctx.need_prefix = TRUE; @@ -3187,7 +3285,8 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "%d", cd_values[0]); } h5tools_str_append(&buffer, "\"/>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (filter == H5Z_FILTER_FLETCHER32) { @@ -3197,7 +3296,8 @@ check_filters(hid_t dcpl) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (filter == H5Z_FILTER_SHUFFLE) { @@ -3207,7 +3307,8 @@ check_filters(hid_t dcpl) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (filter == H5Z_FILTER_SZIP) { @@ -3254,7 +3355,8 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "Header=\"Raw\""); } h5tools_str_append(&buffer, "/>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else { @@ -3271,37 +3373,37 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) size_t sz; size_t i; hsize_t space; - void *buf; - char *name; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; + void * buf; + char * name; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.indent_level++; dump_indent += COL; @@ -3311,31 +3413,34 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; space = H5Tget_size(type); - buf = HDmalloc((size_t) space); + buf = HDmalloc((size_t)space); H5Pget_fill_value(dcpl, type, buf); if (H5Tget_class(type) == H5T_REFERENCE) { - const char * path = lookup_ref_path(*(hobj_ref_t *) buf); + const char *path = lookup_ref_path(*(hobj_ref_t *)buf); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!path) { ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_path = xml_escape_the_string(path, -1); @@ -3345,7 +3450,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_path); } @@ -3354,7 +3460,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else if (H5Tget_class(type) == H5T_STRING) { /* ????? */ @@ -3363,198 +3470,221 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- String fill values not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* all other data */ switch (H5Tget_class(type)) { - case H5T_INTEGER: - ctx.need_prefix = TRUE; + case H5T_INTEGER: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "\"%d\"", *(int *) buf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%d\"", *(int *)buf); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_FLOAT: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_FLOAT: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_BITFIELD: - case H5T_OPAQUE: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_BITFIELD: + case H5T_OPAQUE: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - sz = H5Tget_size(type); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + sz = H5Tget_size(type); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "\""); - for (i = 0; i < sz; i++) { - h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf); - buf = (char *) buf + sizeof(unsigned int); - } - h5tools_str_append(&buffer, "\""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + for (i = 0; i < sz; i++) { + h5tools_str_append(&buffer, "%x ", *(unsigned int *)buf + (i * sizeof(unsigned int))); + } + h5tools_str_append(&buffer, "\""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_ENUM: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_ENUM: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - name = H5Tget_member_name(type, *(unsigned *) buf); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + name = H5Tget_member_name(type, *(unsigned *)buf); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "\"%s\"", name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - if(name) - H5free_memory(name); - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (name) + H5free_memory(name); + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_ARRAY: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_ARRAY: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_TIME: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_TIME: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_COMPOUND: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_COMPOUND: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_VLEN: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_VLEN: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - case H5T_NO_CLASS: - case H5T_NCLASSES: - case H5T_STRING: - case H5T_REFERENCE: - default: - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + case H5T_STRING: + case H5T_REFERENCE: + default: + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type)); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; } } HDfree(buf); @@ -3566,7 +3696,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -3579,39 +3710,37 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) * Purpose: Dump a description of an HDF5 dataset in XML. * * Return: void - * - * Programmer: REMcG *------------------------------------------------------------------------- */ void -xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * sset) +xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *sset) { - hid_t type; - hid_t space; - hid_t dcpl; - H5D_fill_value_t fvstatus; - int maxdims; - hsize_t *chsize; - int ndims; - int i; - H5D_alloc_time_t at; - H5D_fill_time_t ft; - hsize_t tempi; - char *tmp; - char *t_name; - char *t_tmp; - char *t_prefix; - unsigned attr_crt_order_flags; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; - h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ - - char *rstr = (char*) HDmalloc((size_t)100); - char *pstr = (char*) HDmalloc((size_t)100); - - tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + hid_t type; + hid_t space; + hid_t dcpl; + H5D_fill_value_t fvstatus; + int maxdims; + hsize_t * chsize; + int ndims; + int i; + H5D_alloc_time_t at; + H5D_fill_time_t ft; + hsize_t tempi; + char * tmp; + char * t_name; + char * t_tmp; + char * t_prefix; + unsigned attr_crt_order_flags; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + char *rstr = (char *)HDmalloc((size_t)100); + char *pstr = (char *)HDmalloc((size_t)100); + + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); HDstrcat(tmp, "/"); HDstrcat(tmp, name); @@ -3621,28 +3750,28 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; - t_name = xml_escape_the_name(name); - t_tmp = xml_escape_the_name(tmp); + t_name = xml_escape_the_name(name); + t_tmp = xml_escape_the_name(tmp); t_prefix = xml_escape_the_name(prefix); string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; xml_name_to_XID(tmp, rstr, 100, 1); xml_name_to_XID(prefix, pstr, 100, 1); @@ -3651,10 +3780,11 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", - xmlnsprefix, t_name, rstr, t_tmp, pstr, - strcmp(prefix, "") ? t_prefix : "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append( + &buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); HDfree(t_tmp); @@ -3663,8 +3793,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s HDfree(pstr); HDfree(tmp); - dcpl = H5Dget_create_plist(did); - type = H5Dget_type(did); + dcpl = H5Dget_create_plist(did); + type = H5Dget_type(did); space = H5Dget_space(did); /* query the creation properties for attributes */ @@ -3672,7 +3802,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Print information about storage layout */ if (H5D_CHUNKED == H5Pget_layout(dcpl)) { - if((maxdims = H5Sget_simple_extent_ndims(space)) < 0) { + if ((maxdims = H5Sget_simple_extent_ndims(space)) < 0) { error_msg("unable to get maxdims\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -3686,7 +3816,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3697,7 +3828,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix); ndims = H5Pget_chunk(dcpl, maxdims, chsize); h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3708,8 +3840,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", + xmlnsprefix, chsize[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.need_prefix = TRUE; @@ -3717,7 +3851,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3730,7 +3865,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -3740,7 +3876,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -3749,7 +3886,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; HDfree(chsize); @@ -3763,7 +3901,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; @@ -3771,7 +3910,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; @@ -3779,7 +3919,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (H5D_COMPACT == H5Pget_layout(dcpl)) { @@ -3790,7 +3931,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; @@ -3798,7 +3940,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; @@ -3806,7 +3949,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } /* and check for external.... ?? */ @@ -3859,7 +4003,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s } /* end switch */ h5tools_str_append(&buffer, "\""); h5tools_str_append(&buffer, ">"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3869,10 +4014,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Pfill_value_defined(dcpl, &fvstatus); - if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) { + if (fvstatus == H5D_FILL_VALUE_UNDEFINED || + (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) { ctx.indent_level++; ctx.need_prefix = TRUE; @@ -3880,7 +4027,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else { @@ -3892,7 +4040,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sFillValue>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -3902,7 +4051,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sFillValueInfo>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -3914,17 +4064,19 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent += COL; if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < + 0) { error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ - } /* end if */ + } /* end if */ else { - if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, + NULL) < 0) { error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ - } /* end else */ + } /* end else */ ctx.indent_level--; dump_indent -= COL; @@ -3932,166 +4084,182 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s if (display_data && (tempi > 0)) { switch (H5Tget_class(type)) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - ctx.indent_level++; - dump_indent += COL; - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - ctx.indent_level--; - dump_indent -= COL; - break; - - case H5T_TIME: - ctx.indent_level++; + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; - ctx.need_prefix = TRUE; + case H5T_TIME: + ctx.indent_level++; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.need_prefix = TRUE; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; - ctx.indent_level--; - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - case H5T_COMPOUND: - ctx.need_prefix = TRUE; + ctx.indent_level--; + break; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + case H5T_COMPOUND: + ctx.need_prefix = TRUE; - ctx.indent_level++; - dump_indent += COL; - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - ctx.indent_level--; - dump_indent -= COL; - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - case H5T_REFERENCE: - ctx.need_prefix = TRUE; + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + case H5T_REFERENCE: ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } + else { + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + xml_print_refs(did, DATASET_DATA); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - else { + h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; + + case H5T_VLEN: + ctx.indent_level--; + dump_indent -= COL; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - xml_print_refs(did, DATASET_DATA); + h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; + dump_indent += COL; + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; - - case H5T_VLEN: - ctx.indent_level--; - dump_indent -= COL; - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; - dump_indent += COL; - - ctx.indent_level++; - dump_indent += COL; - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - ctx.indent_level--; - dump_indent -= COL; - break; - case H5T_NO_CLASS: - case H5T_NCLASSES: - default: - ctx.need_prefix = TRUE; - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type)); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; + ctx.need_prefix = TRUE; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; } } else { @@ -4103,7 +4271,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; @@ -4111,7 +4280,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; @@ -4119,7 +4289,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } @@ -4132,7 +4303,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -4151,62 +4323,64 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s static void xml_print_enum(hid_t type) { - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned nmembs; /*number of members */ - hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - size_t dst_size; /*destination value type size */ - unsigned i; /*miscellaneous counters */ - size_t j; - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ - h5tool_format_t *outputformat = &xml_dataformat; - h5tool_format_t string_dataformat; - hsize_t curr_pos = 0; /* total data element position */ + char ** name = NULL; /*member names */ + unsigned char * value = NULL; /*value array */ + unsigned nmembs; /*number of members */ + hid_t super; /*enum base integer type */ + hid_t native = H5I_INVALID_HID; /*native integer datatype */ + size_t dst_size; /*destination value type size */ + unsigned i; /*miscellaneous counters */ + size_t j; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t * outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; - ctx.cur_column = dump_indent; + ctx.cur_column = dump_indent; string_dataformat = *outputformat; if (fp_format) { string_dataformat.fmt_double = fp_format; - string_dataformat.fmt_float = fp_format; + string_dataformat.fmt_float = fp_format; } if (h5tools_nCols == 0) { - string_dataformat.line_ncols = 65535; + string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } else string_dataformat.line_ncols = h5tools_nCols; string_dataformat.do_escape = display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; nmembs = (unsigned)H5Tget_nmembers(type); - super = H5Tget_super(type); + super = H5Tget_super(type); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - xml_print_datatype(super,0); + xml_print_datatype(super, 0); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* * Determine what datatype to use for the native values. To simplify @@ -4230,7 +4404,7 @@ xml_print_enum(hid_t type) } /* Get the names and raw values of all members */ - name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)); + name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)); value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size)); for (i = 0; i < nmembs; i++) { @@ -4255,8 +4429,9 @@ xml_print_enum(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sEnumElement>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -4264,7 +4439,8 @@ xml_print_enum(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", t_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); ctx.indent_level--; @@ -4272,15 +4448,17 @@ xml_print_enum(hid_t type) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sEnumElement>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sEnumElement>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<%sEnumValue>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -4294,22 +4472,24 @@ xml_print_enum(hid_t type) h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]); } else if (H5T_SGN_NONE == H5Tget_sign(native)) { - h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) - ((void *) (value + i * dst_size)))); + h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "u", + *((unsigned long long *)((void *)(value + i * dst_size)))); } else { - h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d", - *((long long *) ((void *) (value + i * dst_size)))); + h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "d", + *((long long *)((void *)(value + i * dst_size)))); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sEnumValue>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "</%sEnumValue>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, + (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; dump_indent -= COL; @@ -4324,4 +4504,3 @@ xml_print_enum(hid_t type) HDfree(value); H5Tclose(super); } - |