diff options
Diffstat (limited to 'tools/src/h5dump/h5dump_xml.c')
-rw-r--r-- | tools/src/h5dump/h5dump_xml.c | 3042 |
1 files changed, 1631 insertions, 1411 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index bb47f77..e4bbb9b 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -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,53 +34,54 @@ 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 */ - NULL, /*cmpd_listv */ - - " ", /*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 */ + NULL, /*cmpd_listv */ + + " ", /*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 */ @@ -90,31 +91,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(hid_t, const char *, char *, int, int); +static int xml_name_to_XID(hid_t, 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 @@ -133,41 +133,41 @@ static herr_t xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_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 = dump_opts.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; } @@ -176,355 +176,362 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); - if(linfo->type == H5L_TYPE_HARD) { - H5O_info2_t oinfo; + if (linfo->type == H5L_TYPE_HARD) { + H5O_info2_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if (H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, 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.token); - - 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, obj_path, dsetxid, (int)sizeof(dsetxid), 1); - xml_name_to_XID(obj, 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(obj, 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); + else { + /* Append group name to prefix */ + add_prefix(&prefix, &prefix_len, name); - HDfree(t_name); - HDfree(t_obj_path); - HDfree(t_prefix); - HDfree(t_objname); + /* Iterate into group */ + dump_function_table->dump_group_function(obj, name); - 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.token); + + 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, obj_path, dsetxid, (int)sizeof(dsetxid), 1); + xml_name_to_XID(obj, 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(obj, 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_MAP: - 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(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1); - xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1); - - /* Try to create an OBJ-XID for the object pointed to */ - res = xml_name_to_XID(group, 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_MAP: + 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(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1); xml_name_to_XID(group, 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(group, 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(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(group, 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 */ @@ -535,34 +542,34 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_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; } @@ -578,10 +585,11 @@ int xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen) { H5O_token_t obj_token; - char *obj_tok_str = NULL; - int lookup_ret; + char * obj_tok_str = NULL; + int lookup_ret; - if (outlen < 22) return 1; + if (outlen < 22) + return 1; lookup_ret = ref_path_table_lookup(str, &obj_token); if (lookup_ret < 0) { @@ -625,11 +633,11 @@ xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen 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 @@ -642,22 +650,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++) { @@ -678,12 +686,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; @@ -709,7 +717,7 @@ xml_escape_the_name(const char *str) esc_len = HDstrlen(amp); } else { - *ncp = *cp; + *ncp = *cp; esc_len = 1; } ncp += esc_len; @@ -738,9 +746,9 @@ xml_escape_the_string(const char *str, int slen) size_t extra; size_t len; size_t i; - const char *cp = NULL; - char *ncp = NULL; - char *rcp = NULL; + const char *cp = NULL; + char * ncp = NULL; + char * rcp = NULL; size_t ncp_len; if (!str) @@ -771,9 +779,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; /* ?? */ @@ -784,13 +792,13 @@ xml_escape_the_string(const char *str, int slen) if (*cp == '\\') { *ncp++ = '\\'; ncp_len--; - *ncp = *cp; + *ncp = *cp; esc_len = 1; } else if (*cp == '\"') { *ncp++ = '\\'; ncp_len--; - *ncp = *cp; + *ncp = *cp; esc_len = 1; } else if (*cp == '\'') { @@ -810,7 +818,7 @@ xml_escape_the_string(const char *str, int slen) esc_len = HDstrlen(amp); } else { - *ncp = *cp; + *ncp = *cp; esc_len = 1; } ncp += esc_len; @@ -841,69 +849,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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; - if(!in_group && H5Tcommitted(type) > 0) { + if (!in_group && H5Tcommitted(type) > 0) { H5O_info2_t oinfo; - obj_t *found_obj; /* Found object */ + obj_t * found_obj; /* Found object */ /* detect a shared datatype, output only once */ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC); found_obj = search_obj(type_table, &oinfo.token); - 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(type, found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -914,9 +922,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 */ @@ -926,9 +934,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); @@ -939,7 +948,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); } } @@ -950,8 +960,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"/> */ @@ -962,7 +973,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"); @@ -999,15 +1010,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: @@ -1021,15 +1034,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: @@ -1053,17 +1067,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: @@ -1071,16 +1089,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--; @@ -1088,23 +1108,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++; @@ -1112,17 +1134,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\"/>"); @@ -1132,15 +1154,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: @@ -1151,15 +1175,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: @@ -1178,15 +1203,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: @@ -1196,8 +1223,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); @@ -1205,19 +1233,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: @@ -1230,8 +1260,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" > */ @@ -1241,16 +1272,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); @@ -1261,11 +1293,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--; @@ -1273,8 +1306,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--; @@ -1282,8 +1316,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--; @@ -1292,8 +1327,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: @@ -1301,8 +1337,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 */ @@ -1310,32 +1347,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: @@ -1346,8 +1387,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++; @@ -1355,16 +1397,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--; @@ -1372,8 +1416,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: @@ -1381,8 +1426,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++; @@ -1391,11 +1437,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--; @@ -1403,8 +1450,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--; @@ -1412,8 +1460,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; @@ -1427,10 +1476,11 @@ xml_print_datatype(hid_t type, unsigned in_group) /* 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); @@ -1442,8 +1492,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--; @@ -1454,11 +1506,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--; @@ -1466,8 +1519,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--; @@ -1475,8 +1529,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; @@ -1489,7 +1544,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; } @@ -1511,48 +1567,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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.indent_level++; dump_indent += COL; - if(H5Tcommitted(type) > 0) { + if (H5Tcommitted(type) > 0) { H5O_info2_t oinfo; - obj_t *found_obj; /* Found object */ + obj_t * found_obj; /* Found object */ /* Datatype is a shared or named datatype */ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC); found_obj = search_obj(type_table, &oinfo.token); - 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); @@ -1569,9 +1625,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 */ @@ -1582,8 +1638,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); @@ -1594,7 +1651,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 { @@ -1603,7 +1661,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); @@ -1615,7 +1674,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; @@ -1639,38 +1699,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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.indent_level++; @@ -1679,96 +1739,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--; @@ -1778,7 +1853,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); @@ -1797,19 +1873,19 @@ xml_dump_dataspace(hid_t space) void 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 = 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; + 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 */ @@ -1819,29 +1895,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++; @@ -1850,7 +1927,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--; @@ -1866,10 +1944,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); + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id); } } else { @@ -1888,18 +1966,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 */ + 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 { 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_mem(rawoutstream, outputformat, &datactx, obj_id); + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id); } H5Tclose(p_type); H5Sclose(space); @@ -1915,7 +1993,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--; @@ -1930,8 +2009,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--; @@ -1940,7 +2020,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); } @@ -1957,16 +2038,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 = H5I_INVALID_HID; - hid_t type = H5I_INVALID_HID; - hid_t space = 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); @@ -1976,36 +2057,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 = dump_opts.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); @@ -2016,158 +2098,175 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED if (dump_opts.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; - - /* 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); + 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 { @@ -2178,7 +2277,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++; @@ -2187,7 +2287,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--; @@ -2196,7 +2297,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; @@ -2210,7 +2312,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; @@ -2224,7 +2327,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--; @@ -2233,7 +2337,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); @@ -2255,17 +2360,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); @@ -2277,34 +2382,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 = dump_opts.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(type, tmp, dtxid, 100, 1); xml_name_to_XID(type, 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 @@ -2318,31 +2423,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_info2_t oinfo; /* Object info */ + H5O_info2_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_info3(type, &oinfo, H5O_INFO_BASIC); - 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.token); @@ -2353,11 +2459,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++; @@ -2368,8 +2474,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--; @@ -2378,7 +2486,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; } @@ -2394,12 +2503,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; @@ -2407,8 +2517,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; @@ -2417,8 +2528,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: @@ -2445,23 +2557,23 @@ done: void xml_dump_group(hid_t gid, const char *name) { - H5O_info2_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_info2_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"); @@ -2475,12 +2587,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); } @@ -2490,36 +2602,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 = dump_opts.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'; @@ -2528,8 +2640,8 @@ xml_dump_group(hid_t gid, const char *name) H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC); - 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.token); @@ -2540,15 +2652,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(gid, "/", grpxid, 100, 1); @@ -2556,13 +2668,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(gid, tmp, grpxid, 100, 1); xml_name_to_XID(gid, par, parentxid, 100, 1); @@ -2570,18 +2683,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(gid, found_obj->objname, ptrstr, 100, 1); xml_name_to_XID(gid, par, parentxid, 100, 1); @@ -2589,11 +2704,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--; @@ -2605,16 +2721,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(gid, "/", 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); @@ -2627,10 +2744,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); @@ -2642,25 +2761,27 @@ 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) { char *obj_tok_str = NULL; dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); @@ -2679,7 +2800,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)) H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); else H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); @@ -2694,8 +2815,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; @@ -2703,9 +2824,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(gid, "/", 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); @@ -2713,13 +2835,15 @@ xml_dump_group(hid_t gid, const char *name) par_name = xml_escape_the_name(par); xml_name_to_XID(gid, tmp, grpxid, 100, 1); xml_name_to_XID(gid, 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); @@ -2730,25 +2854,27 @@ 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) { char *obj_tok_str = NULL; dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); @@ -2767,7 +2893,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)) H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); else H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); @@ -2780,17 +2906,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); } @@ -2808,17 +2935,17 @@ static int xml_print_refs(hid_t did, int source) { herr_t e; - hid_t type = H5I_INVALID_HID; - hid_t space = H5I_INVALID_HID; - hssize_t ssiz = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hssize_t ssiz = -1; hsize_t i; - H5R_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; + H5R_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); @@ -2844,7 +2971,7 @@ xml_print_refs(hid_t did, int source) if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); + buf = (char *)HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); if (buf == NULL) goto error; e = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -2857,7 +2984,7 @@ xml_print_refs(hid_t did, int source) if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); + buf = (char *)HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); if (buf == NULL) goto error; e = H5Aread(did, H5T_STD_REF, buf); @@ -2873,24 +3000,24 @@ xml_print_refs(hid_t did, int source) 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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; for (i = 0; i < (hsize_t)ssiz; i++) { const char *path = lookup_ref_path(*refbuf); @@ -2902,7 +3029,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); @@ -2912,7 +3040,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--; @@ -2930,13 +3059,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; } @@ -2954,21 +3085,21 @@ static int xml_print_strs(hid_t did, int source) { herr_t e; - hid_t type = H5I_INVALID_HID; - hid_t space = H5I_INVALID_HID; - 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); @@ -2985,9 +3116,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); @@ -3000,9 +3131,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); @@ -3014,33 +3145,33 @@ 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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { @@ -3059,7 +3190,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); @@ -3070,7 +3202,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); } } @@ -3093,13 +3226,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; } @@ -3124,41 +3259,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 = dump_opts.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; @@ -3174,7 +3310,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) { @@ -3184,7 +3321,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) { @@ -3194,7 +3332,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) { @@ -3241,7 +3380,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 { @@ -3258,37 +3398,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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; ctx.indent_level++; dump_indent += COL; @@ -3298,31 +3438,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(*(H5R_ref_t *) buf); + const char *path = lookup_ref_path(*(H5R_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); @@ -3332,7 +3475,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); } @@ -3341,9 +3485,10 @@ 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); - H5Rdestroy((H5R_ref_t *) buf); + H5Rdestroy((H5R_ref_t *)buf); } else if (H5Tget_class(type) == H5T_STRING) { /* ????? */ @@ -3352,197 +3497,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 + (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); + /* 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); @@ -3554,7 +3723,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; @@ -3572,32 +3742,32 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) void 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); @@ -3607,28 +3777,28 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss 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 = dump_opts.display_escape; - outputformat = &string_dataformat; + outputformat = &string_dataformat; xml_name_to_XID(did, tmp, rstr, 100, 1); xml_name_to_XID(did, prefix, pstr, 100, 1); @@ -3637,10 +3807,11 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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); @@ -3649,8 +3820,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss 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 */ @@ -3658,7 +3829,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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); } @@ -3672,7 +3843,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3683,7 +3855,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss 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; @@ -3694,8 +3867,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3703,7 +3878,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3716,7 +3892,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3726,7 +3903,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3735,7 +3913,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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); @@ -3749,7 +3928,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3757,7 +3937,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3765,7 +3946,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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)) { @@ -3776,7 +3958,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3784,7 +3967,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3792,7 +3976,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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.... ?? */ @@ -3845,7 +4030,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss } /* 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; @@ -3855,10 +4041,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3866,7 +4054,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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 { @@ -3878,7 +4067,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3888,7 +4078,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -3900,17 +4091,19 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss 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; @@ -3918,166 +4111,182 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss if (dump_opts.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 { @@ -4089,7 +4298,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -4097,7 +4307,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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; @@ -4105,7 +4316,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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--; } @@ -4118,7 +4330,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss /* 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); } @@ -4137,62 +4350,64 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss 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 = 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 */ + 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 = dump_opts.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 @@ -4216,7 +4431,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++) { @@ -4241,8 +4456,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); @@ -4250,7 +4466,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--; @@ -4258,15 +4475,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); @@ -4280,22 +4499,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; @@ -4310,4 +4531,3 @@ xml_print_enum(hid_t type) HDfree(value); H5Tclose(super); } - |