summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /tools/src/h5dump
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r--tools/src/h5dump/h5dump.c1416
-rw-r--r--tools/src/h5dump/h5dump.h102
-rw-r--r--tools/src/h5dump/h5dump_ddl.c1500
-rw-r--r--tools/src/h5dump/h5dump_ddl.h29
-rw-r--r--tools/src/h5dump/h5dump_defines.h57
-rw-r--r--tools/src/h5dump/h5dump_extern.h97
-rw-r--r--tools/src/h5dump/h5dump_xml.c3038
-rw-r--r--tools/src/h5dump/h5dump_xml.h18
8 files changed, 3272 insertions, 2985 deletions
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 2b21b1c..9a5e297 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -18,13 +18,13 @@
/* Name of tool */
#define PROGRAMNAME "h5dump"
-static const char *driver_name_g = NULL; /* The driver to open the file with. */
-const char *outfname_g = NULL;
-static hbool_t doxml_g = FALSE;
-static hbool_t useschema_g = TRUE;
-static const char *xml_dtd_uri_g = NULL;
+static const char *driver_name_g = NULL; /* The driver to open the file with. */
+const char * outfname_g = NULL;
+static hbool_t doxml_g = FALSE;
+static hbool_t useschema_g = TRUE;
+static const char *xml_dtd_uri_g = NULL;
-static hbool_t use_custom_vol_g = FALSE;
+static hbool_t use_custom_vol_g = FALSE;
static h5tools_vol_info_t vol_info_g;
#ifdef H5_HAVE_ROS3_VFD
@@ -51,38 +51,25 @@ static H5FD_hdfs_fapl_t hdfs_fa_g = {
#endif /* H5_HAVE_LIBHDFS */
/* module-scoped variables for XML option */
-#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
-#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
+#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
+#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
/* Standard DDL output */
static const dump_functions ddl_function_table = {
- dump_group,
- dump_named_datatype,
- dump_dataset,
- dump_dataspace,
- dump_datatype,
- dump_attr_cb,
- dump_data
-};
+ dump_group, dump_named_datatype, dump_dataset, dump_dataspace, dump_datatype, dump_attr_cb, dump_data};
/* XML output */
static const dump_functions xml_function_table = {
- xml_dump_group,
- xml_dump_named_datatype,
- xml_dump_dataset,
- xml_dump_dataspace,
- xml_dump_datatype,
- xml_dump_attr,
- xml_dump_data
-};
+ xml_dump_group, xml_dump_named_datatype, xml_dump_dataset, xml_dump_dataspace,
+ xml_dump_datatype, xml_dump_attr, xml_dump_data};
/* internal functions */
-static void init_prefix(char **prfx, size_t prfx_len);
+static void init_prefix(char **prfx, size_t prfx_len);
/* a structure for handling the order command-line parameters come in */
struct handler_t {
void (*func)(hid_t, const char *, void *, int, const char *);
- char *obj;
+ char * obj;
struct subset_t *subset_info;
};
@@ -93,135 +80,132 @@ struct handler_t {
*/
/* The following initialization makes use of C language concatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- { "contents", optional_arg, 'n' },
- { "properties", no_arg, 'p' },
- { "superblock", no_arg, 'B' },
- { "boot-block", no_arg, 'B' },
- { "boot-bloc", no_arg, 'B' },
- { "boot-blo", no_arg, 'B' },
- { "boot-bl", no_arg, 'B' },
- { "boot-b", no_arg, 'B' },
- { "boot", no_arg, 'B' },
- { "boo", no_arg, 'B' },
- { "bo", no_arg, 'B' },
- { "header", no_arg, 'H' },
- { "heade", no_arg, 'H' },
- { "head", no_arg, 'H' },
- { "hea", no_arg, 'H' },
- { "object-ids", no_arg, 'i' },
- { "object-id", no_arg, 'i' },
- { "object-i", no_arg, 'i' },
- { "object", no_arg, 'i' },
- { "objec", no_arg, 'i' },
- { "obje", no_arg, 'i' },
- { "obj", no_arg, 'i' },
- { "ob", no_arg, 'i' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { "attribute", require_arg, 'a' },
- { "attribut", require_arg, 'a' },
- { "attribu", require_arg, 'a' },
- { "attrib", require_arg, 'a' },
- { "attri", require_arg, 'a' },
- { "attr", require_arg, 'a' },
- { "att", require_arg, 'a' },
- { "at", require_arg, 'a' },
- { "block", require_arg, 'k' },
- { "bloc", require_arg, 'k' },
- { "blo", require_arg, 'k' },
- { "bl", require_arg, 'k' },
- { "count", require_arg, 'c' },
- { "coun", require_arg, 'c' },
- { "cou", require_arg, 'c' },
- { "co", require_arg, 'c' },
- { "dataset", require_arg, 'd' },
- { "datase", require_arg, 'd' },
- { "datas", require_arg, 'd' },
- { "datatype", require_arg, 't' },
- { "datatyp", require_arg, 't' },
- { "dataty", require_arg, 't' },
- { "datat", require_arg, 't' },
- { "filedriver", require_arg, 'f' },
- { "filedrive", require_arg, 'f' },
- { "filedriv", require_arg, 'f' },
- { "filedri", require_arg, 'f' },
- { "filedr", require_arg, 'f' },
- { "filed", require_arg, 'f' },
- { "file", require_arg, 'f' },
- { "fil", require_arg, 'f' },
- { "fi", require_arg, 'f' },
- { "group", require_arg, 'g' },
- { "grou", require_arg, 'g' },
- { "gro", require_arg, 'g' },
- { "gr", require_arg, 'g' },
- { "output", optional_arg, 'o' },
- { "outpu", optional_arg, 'o' },
- { "outp", optional_arg, 'o' },
- { "out", optional_arg, 'o' },
- { "ou", optional_arg, 'o' },
- { "soft-link", require_arg, 'l' },
- { "soft-lin", require_arg, 'l' },
- { "soft-li", require_arg, 'l' },
- { "soft-l", require_arg, 'l' },
- { "soft", require_arg, 'l' },
- { "sof", require_arg, 'l' },
- { "start", require_arg, 's' },
- { "star", require_arg, 's' },
- { "sta", require_arg, 's' },
- { "stride", require_arg, 'S' },
- { "strid", require_arg, 'S' },
- { "string", no_arg, 'r' },
- { "strin", no_arg, 'r' },
- { "use-dtd", no_arg, 'u' },
- { "use-dt", no_arg, 'u' },
- { "use-d", no_arg, 'u' },
- { "use-", no_arg, 'u' },
- { "use", no_arg, 'u' },
- { "us", no_arg, 'u' },
- { "u", no_arg, 'u' },
- { "width", require_arg, 'w' },
- { "widt", require_arg, 'w' },
- { "wid", require_arg, 'w' },
- { "wi", require_arg, 'w' },
- { "xml-dtd", require_arg, 'D' },
- { "xml-dt", require_arg, 'D' },
- { "xml-d", require_arg, 'D' },
- { "xml-ns", require_arg, 'X' },
- { "xml-n", require_arg, 'X' },
- { "xml", no_arg, 'x' },
- { "xm", no_arg, 'x' },
- { "onlyattr", optional_arg, 'A' },
- { "escape", no_arg, 'e' },
- { "noindex", no_arg, 'y' },
- { "binary", optional_arg, 'b' },
- { "form", require_arg, 'F' },
- { "sort_by", require_arg, 'q' },
- { "sort_order", require_arg, 'z' },
- { "format", require_arg, 'm' },
- { "region", no_arg, 'R' },
- { "enable-error-stack", optional_arg, 'E' },
- { "packed-bits", require_arg, 'M' },
- { "no-compact-subset", no_arg, 'C' },
- { "ddl", optional_arg, 'O' },
- { "any_path", require_arg, 'N' },
- { "vds-view-first-missing", no_arg, 'v' },
- { "vds-gap-size", require_arg, 'G' },
- { "s3-cred", require_arg, '$' },
- { "hdfs-attrs", require_arg, '#' },
- { "vol-value", require_arg, '1' },
- { "vol-name", require_arg, '2' },
- { "vol-info", require_arg, '3' },
- { NULL, 0, '\0' }
-};
-
+static const char * s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"contents", optional_arg, 'n'},
+ {"properties", no_arg, 'p'},
+ {"superblock", no_arg, 'B'},
+ {"boot-block", no_arg, 'B'},
+ {"boot-bloc", no_arg, 'B'},
+ {"boot-blo", no_arg, 'B'},
+ {"boot-bl", no_arg, 'B'},
+ {"boot-b", no_arg, 'B'},
+ {"boot", no_arg, 'B'},
+ {"boo", no_arg, 'B'},
+ {"bo", no_arg, 'B'},
+ {"header", no_arg, 'H'},
+ {"heade", no_arg, 'H'},
+ {"head", no_arg, 'H'},
+ {"hea", no_arg, 'H'},
+ {"object-ids", no_arg, 'i'},
+ {"object-id", no_arg, 'i'},
+ {"object-i", no_arg, 'i'},
+ {"object", no_arg, 'i'},
+ {"objec", no_arg, 'i'},
+ {"obje", no_arg, 'i'},
+ {"obj", no_arg, 'i'},
+ {"ob", no_arg, 'i'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"ver", no_arg, 'V'},
+ {"ve", no_arg, 'V'},
+ {"attribute", require_arg, 'a'},
+ {"attribut", require_arg, 'a'},
+ {"attribu", require_arg, 'a'},
+ {"attrib", require_arg, 'a'},
+ {"attri", require_arg, 'a'},
+ {"attr", require_arg, 'a'},
+ {"att", require_arg, 'a'},
+ {"at", require_arg, 'a'},
+ {"block", require_arg, 'k'},
+ {"bloc", require_arg, 'k'},
+ {"blo", require_arg, 'k'},
+ {"bl", require_arg, 'k'},
+ {"count", require_arg, 'c'},
+ {"coun", require_arg, 'c'},
+ {"cou", require_arg, 'c'},
+ {"co", require_arg, 'c'},
+ {"dataset", require_arg, 'd'},
+ {"datase", require_arg, 'd'},
+ {"datas", require_arg, 'd'},
+ {"datatype", require_arg, 't'},
+ {"datatyp", require_arg, 't'},
+ {"dataty", require_arg, 't'},
+ {"datat", require_arg, 't'},
+ {"filedriver", require_arg, 'f'},
+ {"filedrive", require_arg, 'f'},
+ {"filedriv", require_arg, 'f'},
+ {"filedri", require_arg, 'f'},
+ {"filedr", require_arg, 'f'},
+ {"filed", require_arg, 'f'},
+ {"file", require_arg, 'f'},
+ {"fil", require_arg, 'f'},
+ {"fi", require_arg, 'f'},
+ {"group", require_arg, 'g'},
+ {"grou", require_arg, 'g'},
+ {"gro", require_arg, 'g'},
+ {"gr", require_arg, 'g'},
+ {"output", optional_arg, 'o'},
+ {"outpu", optional_arg, 'o'},
+ {"outp", optional_arg, 'o'},
+ {"out", optional_arg, 'o'},
+ {"ou", optional_arg, 'o'},
+ {"soft-link", require_arg, 'l'},
+ {"soft-lin", require_arg, 'l'},
+ {"soft-li", require_arg, 'l'},
+ {"soft-l", require_arg, 'l'},
+ {"soft", require_arg, 'l'},
+ {"sof", require_arg, 'l'},
+ {"start", require_arg, 's'},
+ {"star", require_arg, 's'},
+ {"sta", require_arg, 's'},
+ {"stride", require_arg, 'S'},
+ {"strid", require_arg, 'S'},
+ {"string", no_arg, 'r'},
+ {"strin", no_arg, 'r'},
+ {"use-dtd", no_arg, 'u'},
+ {"use-dt", no_arg, 'u'},
+ {"use-d", no_arg, 'u'},
+ {"use-", no_arg, 'u'},
+ {"use", no_arg, 'u'},
+ {"us", no_arg, 'u'},
+ {"u", no_arg, 'u'},
+ {"width", require_arg, 'w'},
+ {"widt", require_arg, 'w'},
+ {"wid", require_arg, 'w'},
+ {"wi", require_arg, 'w'},
+ {"xml-dtd", require_arg, 'D'},
+ {"xml-dt", require_arg, 'D'},
+ {"xml-d", require_arg, 'D'},
+ {"xml-ns", require_arg, 'X'},
+ {"xml-n", require_arg, 'X'},
+ {"xml", no_arg, 'x'},
+ {"xm", no_arg, 'x'},
+ {"onlyattr", optional_arg, 'A'},
+ {"escape", no_arg, 'e'},
+ {"noindex", no_arg, 'y'},
+ {"binary", optional_arg, 'b'},
+ {"form", require_arg, 'F'},
+ {"sort_by", require_arg, 'q'},
+ {"sort_order", require_arg, 'z'},
+ {"format", require_arg, 'm'},
+ {"region", no_arg, 'R'},
+ {"enable-error-stack", optional_arg, 'E'},
+ {"packed-bits", require_arg, 'M'},
+ {"no-compact-subset", no_arg, 'C'},
+ {"ddl", optional_arg, 'O'},
+ {"any_path", require_arg, 'N'},
+ {"vds-view-first-missing", no_arg, 'v'},
+ {"vds-gap-size", require_arg, 'G'},
+ {"s3-cred", require_arg, '$'},
+ {"hdfs-attrs", require_arg, '#'},
+ {"vol-value", require_arg, '1'},
+ {"vol-name", require_arg, '2'},
+ {"vol-info", require_arg, '3'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: leave
@@ -239,7 +223,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -265,46 +248,68 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n");
PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n");
PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
- PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n");
- PRINTVALSTREAM(rawoutstream, " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
- PRINTVALSTREAM(rawoutstream, " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
- PRINTVALSTREAM(rawoutstream, " If absent or <cred> -> \"(,,)\", no authentication.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Use blank(empty) filename F to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or <cred> -> \"(,,)\", no authentication.\n");
PRINTVALSTREAM(rawoutstream, " Has no effect is filedriver is not `ros3'.\n");
- PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
PRINTVALSTREAM(rawoutstream, " For use with \"--filedriver=hdfs\"\n");
PRINTVALSTREAM(rawoutstream, " <attrs> :: (<namenode name>,<namenode port>,\n");
PRINTVALSTREAM(rawoutstream, " <kerberos cache path>,<username>,\n");
PRINTVALSTREAM(rawoutstream, " <buffer size>)\n");
- PRINTVALSTREAM(rawoutstream, " Any absent attribute will use a default value.\n");
- PRINTVALSTREAM(rawoutstream, " --vol-value Value (ID) of the VOL connector to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Any absent attribute will use a default value.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vol-value Value (ID) of the VOL connector to use for opening the\n");
PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
- PRINTVALSTREAM(rawoutstream, " --vol-name Name of the VOL connector to use for opening the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vol-name Name of the VOL connector to use for opening the\n");
PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n");
- PRINTVALSTREAM(rawoutstream, " --vol-info VOL-specific info to pass to the VOL connector used for\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vol-info VOL-specific info to pass to the VOL connector used for\n");
PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n");
- PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If an attribute name contains a slash (/), escape the\n");
PRINTVALSTREAM(rawoutstream, " slash with a preceding backslash (\\).\n");
PRINTVALSTREAM(rawoutstream, " (See example section below.)\n");
PRINTVALSTREAM(rawoutstream, " -d P, --dataset=P Print the specified dataset\n");
PRINTVALSTREAM(rawoutstream, " -g P, --group=P Print the specified group and all members\n");
PRINTVALSTREAM(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n");
PRINTVALSTREAM(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n");
- PRINTVALSTREAM(rawoutstream, " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
- PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
+ PRINTVALSTREAM(rawoutstream,
+ " P can be the absolute path or just a relative path.\n");
PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n");
- PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n");
- PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
- PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Optional value 0 suppresses printing attributes.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n");
- PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n");
- PRINTVALSTREAM(rawoutstream, " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
- PRINTVALSTREAM(rawoutstream, " format L for an integer dataset specified with\n");
- PRINTVALSTREAM(rawoutstream, " option -d. L is a list of offset,length values,\n");
- PRINTVALSTREAM(rawoutstream, " separated by commas. Offset is the beginning bit in\n");
- PRINTVALSTREAM(rawoutstream, " the data value and length is the number of bits of\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --properties Print dataset filters, storage layout and fill value\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
+ PRINTVALSTREAM(rawoutstream,
+ " format L for an integer dataset specified with\n");
+ PRINTVALSTREAM(rawoutstream,
+ " option -d. L is a list of offset,length values,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " separated by commas. Offset is the beginning bit in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " the data value and length is the number of bits of\n");
PRINTVALSTREAM(rawoutstream, " the mask.\n");
PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\n");
PRINTVALSTREAM(rawoutstream, "--------------- Formatting Options ---------------\n");
@@ -314,12 +319,17 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n");
PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
- PRINTVALSTREAM(rawoutstream, " Optional value 2 also prints file open errors.\n");
- PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Optional value 2 also prints file open errors.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --no-compact-subset Disable compact form of subsetting and allow the use\n");
PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n");
- PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
- PRINTVALSTREAM(rawoutstream, " sets the number of columns to the maximum (65535).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " sets the number of columns to the maximum (65535).\n");
PRINTVALSTREAM(rawoutstream, " Default width is 80 columns.\n");
PRINTVALSTREAM(rawoutstream, "--------------- XML Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -x, --xml Output in XML using Schema\n");
@@ -327,31 +337,44 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n");
PRINTVALSTREAM(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n");
PRINTVALSTREAM(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n");
- PRINTVALSTREAM(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n");
+ PRINTVALSTREAM(rawoutstream,
+ " E.g., to dump a file called `-f', use h5dump -- -f\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Subsetting Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n");
PRINTVALSTREAM(rawoutstream, " option. Subsetting is done by selecting a hyperslab from the data.\n");
PRINTVALSTREAM(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n");
- PRINTVALSTREAM(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
- PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
- PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " each dimension. START is optional and will default to 0 in each dimension.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -s START, --start=START Offset of start of subsetting selection\n");
PRINTVALSTREAM(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n");
- PRINTVALSTREAM(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
PRINTVALSTREAM(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n");
- PRINTVALSTREAM(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
PRINTVALSTREAM(rawoutstream, " number of dimensions in the dataspace being queried\n");
- PRINTVALSTREAM(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " (Alternate compact form of subsetting is described in the Reference Manual)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Option Argument Conventions ---------------\n");
PRINTVALSTREAM(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n");
- PRINTVALSTREAM(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
PRINTVALSTREAM(rawoutstream, " the file driver flag, the file will be opened with each driver in\n");
PRINTVALSTREAM(rawoutstream, " turn and in the order specified above until one driver succeeds\n");
PRINTVALSTREAM(rawoutstream, " in opening the file.\n");
- PRINTVALSTREAM(rawoutstream, " See examples below for family, split, and multi driver special file name usage.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " See examples below for family, split, and multi driver special file name usage.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " F - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " P - is the full path from the root group to the object.\n");
@@ -359,12 +382,17 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n");
PRINTVALSTREAM(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n");
PRINTVALSTREAM(rawoutstream, " updated by [IETF RFC 2732])\n");
- PRINTVALSTREAM(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
- PRINTVALSTREAM(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " file type, LE or BE for pre-existing little or big endian types.\n");
PRINTVALSTREAM(rawoutstream, " Must be used with -o (output file) and it is recommended that\n");
- PRINTVALSTREAM(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
- PRINTVALSTREAM(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
- PRINTVALSTREAM(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Examples ---------------\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -378,14 +406,16 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
+ PRINTVALSTREAM(rawoutstream,
+ " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n");
PRINTVALSTREAM(rawoutstream, " using a little-endian type\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -397,17 +427,19 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f split splitfile\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f multi mf\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f family fam%%05d.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
}
-
/*-------------------------------------------------------------------------
* Function: table_list_add
*
@@ -419,28 +451,30 @@ usage(const char *prog)
ssize_t
table_list_add(hid_t oid, unsigned long file_no)
{
- size_t idx; /* Index of table to use */
+ size_t idx; /* Index of table to use */
find_objs_t info;
/* Allocate space if necessary */
- if(table_list.nused == table_list.nalloc) {
- h5dump_table_items_t *tmp_ptr;
+ if (table_list.nused == table_list.nalloc) {
+ h5dump_table_items_t *tmp_ptr;
table_list.nalloc = MAX(1, table_list.nalloc * 2);
- if(NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
+ if (NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(
+ table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
return -1;
table_list.tables = tmp_ptr;
} /* end if */
/* Append it */
- idx = table_list.nused++;
+ idx = table_list.nused++;
table_list.tables[idx].fileno = file_no;
- table_list.tables[idx].oid = oid;
- if(H5Iinc_ref(oid) < 0) {
+ table_list.tables[idx].oid = oid;
+ if (H5Iinc_ref(oid) < 0) {
table_list.nused--;
return -1;
}
- if(init_objs(oid, &info, &table_list.tables[idx].group_table, &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) {
+ if (init_objs(oid, &info, &table_list.tables[idx].group_table, &table_list.tables[idx].dset_table,
+ &table_list.tables[idx].type_table) < 0) {
H5Idec_ref(oid);
table_list.nused--;
return -1;
@@ -450,10 +484,9 @@ table_list_add(hid_t oid, unsigned long file_no)
dump_tables(&info);
#endif /* H5DUMP_DEBUG */
- return((ssize_t) idx);
+ return ((ssize_t)idx);
} /* end table_list_add() */
-
/*-------------------------------------------------------------------------
* Function: table_list_visited
*
@@ -465,19 +498,18 @@ table_list_add(hid_t oid, unsigned long file_no)
H5_ATTR_PURE ssize_t
table_list_visited(unsigned long file_no)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Look for table */
- for(u = 0; u < table_list.nused; u++)
+ for (u = 0; u < table_list.nused; u++)
/* Check for fileno value already in array */
- if(table_list.tables[u].fileno == file_no)
- return((ssize_t) u);
+ if (table_list.tables[u].fileno == file_no)
+ return ((ssize_t)u);
/* Didn't find table */
- return(-1);
+ return (-1);
} /* end table_list_visited() */
-
/*-------------------------------------------------------------------------
* Function: table_list_free
*
@@ -489,12 +521,12 @@ table_list_visited(unsigned long file_no)
static void
table_list_free(void)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Iterate over tables */
- for(u = 0; u < table_list.nused; u++) {
+ for (u = 0; u < table_list.nused; u++) {
/* Release object id */
- if(H5Idec_ref(table_list.tables[u].oid) < 0)
+ if (H5Idec_ref(table_list.tables[u].oid) < 0)
h5tools_setstatus(EXIT_FAILURE);
/* Free each table */
@@ -526,15 +558,15 @@ set_binary_form(const char *form)
{
int bform = -1;
- if (HDstrcmp(form,"NATIVE") == 0 || HDstrcmp(form,"MEMORY") == 0) {
+ if (HDstrcmp(form, "NATIVE") == 0 || HDstrcmp(form, "MEMORY") == 0) {
/* native form */
bform = 0;
}
- else if (HDstrcmp(form,"FILE") == 0) /* file type form */
+ else if (HDstrcmp(form, "FILE") == 0) /* file type form */
bform = 1;
- else if (HDstrcmp(form,"LE") == 0) /* convert to little endian */
+ else if (HDstrcmp(form, "LE") == 0) /* convert to little endian */
bform = 2;
- else if (HDstrcmp(form,"BE") == 0) /* convert to big endian */
+ else if (HDstrcmp(form, "BE") == 0) /* convert to big endian */
bform = 3;
return bform;
@@ -555,9 +587,9 @@ set_sort_by(const char *form)
{
H5_index_t idx_type = H5_INDEX_UNKNOWN;
- if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */
+ if (HDstrcmp(form, "name") == 0) /* H5_INDEX_NAME */
idx_type = H5_INDEX_NAME;
- else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */
+ else if (HDstrcmp(form, "creation_order") == 0) /* H5_INDEX_CRT_ORDER */
idx_type = H5_INDEX_CRT_ORDER;
return idx_type;
@@ -578,9 +610,9 @@ set_sort_order(const char *form)
{
H5_iter_order_t iter_order = H5_ITER_UNKNOWN;
- if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */
+ if (HDstrcmp(form, "ascending") == 0) /* H5_ITER_INC */
iter_order = H5_ITER_INC;
- else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */
+ else if (HDstrcmp(form, "descending") == 0) /* H5_ITER_DEC */
iter_order = H5_ITER_DEC;
return iter_order;
@@ -604,11 +636,11 @@ set_sort_order(const char *form)
static void
parse_hsize_list(const char *h_list, subset_d *d)
{
- hsize_t *p_list;
- const char *ptr;
- unsigned int size_count = 0;
- unsigned int i = 0;
- unsigned int last_digit = 0;
+ hsize_t * p_list;
+ const char * ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
return;
@@ -633,7 +665,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t));
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if(HDisdigit(*ptr)) {
+ if (HDisdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
@@ -642,7 +674,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
ptr++;
}
d->data = p_list;
- d->len = size_count;
+ d->len = size_count;
}
/*-------------------------------------------------------------------------
@@ -658,7 +690,7 @@ static struct subset_t *
parse_subset_params(const char *dset)
{
struct subset_t *s = NULL;
- char *brace;
+ char * brace;
if (!dump_opts.disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
*brace++ = '\0';
@@ -713,11 +745,11 @@ parse_mask_list(const char *h_list)
int slength_value;
unsigned length_value;
unsigned long long temp_mask;
- const char *ptr = NULL;
+ const char * ptr = NULL;
/* sanity check */
- if(h_list) {
- HDmemset(packed_mask,0,sizeof(packed_mask));
+ if (h_list) {
+ HDmemset(packed_mask, 0, sizeof(packed_mask));
packed_bits_num = 0;
/* scan in pair of offset,length separated by commas. */
@@ -729,10 +761,10 @@ parse_mask_list(const char *h_list)
return FAIL;
}
soffset_value = HDatoi(ptr);
- offset_value = (unsigned)soffset_value;
+ offset_value = (unsigned)soffset_value;
if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
- error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
- soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
+ error_msg("Packed Bit offset value(%d) must be between 0 and %u\n", soffset_value,
+ (unsigned)(PACKED_BITS_SIZE_MAX - 1));
return FAIL;
}
@@ -758,7 +790,7 @@ parse_mask_list(const char *h_list)
length_value = (unsigned)slength_value;
if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
- offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
+ offset_value + length_value, (unsigned)PACKED_BITS_SIZE_MAX);
return FAIL;
}
@@ -778,8 +810,8 @@ parse_mask_list(const char *h_list)
/* After packed_mask is calculated, packed_length is not needed but */
/* keep it for debug purpose. */
temp_mask = ~0ULL;
- if(length_value < (int)(8 *sizeof(unsigned long long))) {
- temp_mask = temp_mask << length_value;
+ if (length_value < (int)(8 * sizeof(unsigned long long))) {
+ temp_mask = temp_mask << length_value;
packed_mask[packed_bits_num] = ~temp_mask;
}
else
@@ -795,7 +827,7 @@ parse_mask_list(const char *h_list)
}
}
}
- if(packed_bits_num > PACKED_BITS_MAX) {
+ if (packed_bits_num > PACKED_BITS_MAX) {
error_msg("Maximum number of packed bits exceeded\n");
return FAIL;
}
@@ -806,13 +838,12 @@ parse_mask_list(const char *h_list)
}
return SUCCEED;
}
- else {
+ else {
error_msg("Bad mask list argument\n");
return FAIL;
}
}
-
/*-------------------------------------------------------------------------
* Function: free_handler
*
@@ -828,25 +859,25 @@ free_handler(struct handler_t *hand, int len)
{
int i;
- if(hand) {
+ if (hand) {
for (i = 0; i < len; i++) {
- if(hand[i].obj) {
+ if (hand[i].obj) {
HDfree(hand[i].obj);
- hand[i].obj=NULL;
+ hand[i].obj = NULL;
}
if (hand[i].subset_info) {
- if(hand[i].subset_info->start.data)
+ if (hand[i].subset_info->start.data)
HDfree(hand[i].subset_info->start.data);
- if(hand[i].subset_info->stride.data)
+ if (hand[i].subset_info->stride.data)
HDfree(hand[i].subset_info->stride.data);
- if(hand[i].subset_info->count.data)
+ if (hand[i].subset_info->count.data)
HDfree(hand[i].subset_info->count.data);
- if(hand[i].subset_info->block.data)
+ if (hand[i].subset_info->block.data)
HDfree(hand[i].subset_info->block.data);
HDfree(hand[i].subset_info);
- hand[i].subset_info=NULL;
+ hand[i].subset_info = NULL;
}
}
@@ -854,7 +885,6 @@ free_handler(struct handler_t *hand, int len)
}
}
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -869,11 +899,11 @@ free_handler(struct handler_t *hand, int len)
static struct handler_t *
parse_command_line(int argc, const char *argv[])
{
- struct handler_t *hand = NULL;
- struct handler_t *last_dset = NULL;
- int i;
- int opt;
- int last_was_dset = FALSE;
+ struct handler_t *hand = NULL;
+ struct handler_t *last_dset = NULL;
+ int i;
+ int opt;
+ int last_was_dset = FALSE;
/* no arguments */
if (argc == 1) {
@@ -882,7 +912,7 @@ parse_command_line(int argc, const char *argv[])
}
/* this will be plenty big enough to hold the info */
- if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) {
+ if ((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) {
goto error;
}
@@ -890,61 +920,60 @@ parse_command_line(int argc, const char *argv[])
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
parse_start:
switch ((char)opt) {
- case 'R':
- dump_opts.display_region = TRUE;
- region_output = TRUE;
- break;
- case 'B':
- dump_opts.display_bb = TRUE;
- last_was_dset = FALSE;
- break;
- case 'n':
- dump_opts.display_fi = TRUE;
- last_was_dset = FALSE;
- if (opt_arg != NULL)
- h5trav_set_verbose(HDatoi(opt_arg));
- break;
- case 'p':
- dump_opts.display_dcpl = TRUE;
- break;
- case 'y':
- dump_opts.display_ai = FALSE;
- break;
- case 'e':
- dump_opts.display_escape = TRUE;
- break;
- case 'H':
- dump_opts.display_data = FALSE;
- dump_opts.display_attr_data = FALSE;
- last_was_dset = FALSE;
- break;
- case 'A':
- if (opt_arg != NULL) {
- if(0 == HDatoi(opt_arg))
- dump_opts.include_attrs = FALSE;
- }
- else {
- dump_opts.display_data = FALSE;
- dump_opts.display_attr_data = TRUE;
- last_was_dset = FALSE;
- }
- break;
- case 'i':
- dump_opts.display_oid = TRUE;
- last_was_dset = FALSE;
- break;
- case 'r':
- dump_opts.display_char = TRUE;
- break;
- case 'V':
- print_version(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
- break;
- case 'w':
- {
+ case 'R':
+ dump_opts.display_region = TRUE;
+ region_output = TRUE;
+ break;
+ case 'B':
+ dump_opts.display_bb = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'n':
+ dump_opts.display_fi = TRUE;
+ last_was_dset = FALSE;
+ if (opt_arg != NULL)
+ h5trav_set_verbose(HDatoi(opt_arg));
+ break;
+ case 'p':
+ dump_opts.display_dcpl = TRUE;
+ break;
+ case 'y':
+ dump_opts.display_ai = FALSE;
+ break;
+ case 'e':
+ dump_opts.display_escape = TRUE;
+ break;
+ case 'H':
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = FALSE;
+ last_was_dset = FALSE;
+ break;
+ case 'A':
+ if (opt_arg != NULL) {
+ if (0 == HDatoi(opt_arg))
+ dump_opts.include_attrs = FALSE;
+ }
+ else {
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = TRUE;
+ last_was_dset = FALSE;
+ }
+ break;
+ case 'i':
+ dump_opts.display_oid = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'r':
+ dump_opts.display_char = TRUE;
+ break;
+ case 'V':
+ print_version(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ break;
+ case 'w': {
int sh5tools_nCols = HDatoi(opt_arg);
if (sh5tools_nCols <= 0)
@@ -952,372 +981,371 @@ parse_start:
else
h5tools_nCols = (unsigned)sh5tools_nCols;
last_was_dset = FALSE;
- }
- break;
- case 'N':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_paths;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
-
- last_was_dset = FALSE;
- break;
- case 'a':
- dump_opts.display_all = 0;
+ } break;
+ case 'N':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_paths;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_attributes;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 'a':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_attributes;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 'd':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_datasets;
- hand[i].obj = HDstrdup(opt_arg);
- hand[i].subset_info = parse_subset_params(hand[i].obj);
- last_dset = &hand[i];
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 'd':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datasets;
+ hand[i].obj = HDstrdup(opt_arg);
+ hand[i].subset_info = parse_subset_params(hand[i].obj);
+ last_dset = &hand[i];
+ break;
+ }
- last_was_dset = TRUE;
- break;
- case 'f':
- driver_name_g = opt_arg;
- break;
- case 'g':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_groups;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = TRUE;
+ break;
+ case 'f':
+ driver_name_g = opt_arg;
+ break;
+ case 'g':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_groups;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 'l':
- dump_opts.display_all = 0;
+ last_was_dset = FALSE;
+ break;
+ case 'l':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_links;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_links;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 't':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datatypes;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 't':
- dump_opts.display_all = 0;
+ last_was_dset = FALSE;
+ break;
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_datatypes;
- hand[i].obj = HDstrdup(opt_arg);
- break;
+ case 'O':
+ if (h5tools_set_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
}
+ break;
- last_was_dset = FALSE;
- break;
+ case 'o':
+ if (bin_output) {
+ if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ else {
+ if (dump_opts.display_attr_data && !dump_opts.display_data) {
+ if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ if (dump_opts.display_data || dump_opts.display_all) {
+ if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ }
- case 'O':
- if (h5tools_set_output_file(opt_arg, 0) < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ dump_opts.usingdasho = TRUE;
+ last_was_dset = FALSE;
+ outfname_g = opt_arg;
+ break;
- case 'o':
- if (bin_output) {
- if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- }
- else {
- if(dump_opts.display_attr_data && !dump_opts.display_data) {
- if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ case 'b':
+ if (opt_arg != NULL) {
+ if ((bin_form = set_binary_form(opt_arg)) < 0) {
+ /* failed to set binary form */
usage(h5tools_getprogname());
goto error;
}
}
- if(dump_opts.display_data || dump_opts.display_all) {
- if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ bin_output = TRUE;
+ if (outfname_g != NULL) {
+ if (h5tools_set_data_output_file(outfname_g, 1) < 0) {
+ /* failed to set output file */
usage(h5tools_getprogname());
goto error;
}
+
+ last_was_dset = FALSE;
}
- }
+ break;
- dump_opts.usingdasho = TRUE;
- last_was_dset = FALSE;
- outfname_g = opt_arg;
- break;
+ case 'q':
+ if ((sort_by = set_sort_by(opt_arg)) < 0) {
+ /* failed to set "sort by" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
- case 'b':
- if (opt_arg != NULL) {
- if ((bin_form = set_binary_form(opt_arg)) < 0) {
- /* failed to set binary form */
+ case 'z':
+ if ((sort_order = set_sort_order(opt_arg)) < 0) {
+ /* failed to set "sort order" form */
usage(h5tools_getprogname());
goto error;
}
- }
- bin_output = TRUE;
- if (outfname_g != NULL) {
- if (h5tools_set_data_output_file(outfname_g, 1) < 0) {
- /* failed to set output file */
+ break;
+
+ case 'M':
+ if (!last_was_dset) {
+ error_msg("option `-%c' can only be used after --dataset option\n", opt);
+ goto error;
+ }
+ if (parse_mask_list(opt_arg) != SUCCEED) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ dump_opts.display_packed_bits = TRUE;
+ break;
+ case 'v':
+ dump_opts.display_vds_first = TRUE;
+ break;
+ case 'G':
+ dump_opts.vds_gap_size = HDatoi(opt_arg);
+ if (dump_opts.vds_gap_size < 0) {
usage(h5tools_getprogname());
goto error;
}
+ break;
- last_was_dset = FALSE;
- }
- break;
+ /** begin XML parameters **/
+ case 'x':
+ /* select XML output */
+ doxml_g = TRUE;
+ useschema_g = TRUE;
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'u':
+ doxml_g = TRUE;
+ useschema_g = FALSE;
+ xmlnsprefix = "";
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'D':
+ /* specify alternative XML DTD or schema */
+ /* To Do: check format of this value? */
+ xml_dtd_uri_g = opt_arg;
+ h5tools_nCols = 0;
+ break;
- case 'q':
- if ((sort_by = set_sort_by(opt_arg)) < 0) {
- /* failed to set "sort by" form */
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ case 'm':
+ /* specify alternative floating point printing format */
+ fp_format = opt_arg;
+ h5tools_nCols = 0;
+ break;
- case 'z':
- if ((sort_order = set_sort_order(opt_arg)) < 0) {
- /* failed to set "sort order" form */
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ case 'X':
+ /* specify XML namespace (default="hdf5:"), or none */
+ /* To Do: check format of this value? */
+ if (!useschema_g) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ if (HDstrcmp(opt_arg, ":") == 0)
+ xmlnsprefix = "";
+ else
+ xmlnsprefix = opt_arg;
+ h5tools_nCols = 0;
+ break;
+ /** end XML parameters **/
- case 'M':
- if (!last_was_dset) {
- error_msg("option `-%c' can only be used after --dataset option\n", opt);
- goto error;
- }
- if (parse_mask_list(opt_arg) != SUCCEED){
- usage(h5tools_getprogname());
- goto error;
- }
- dump_opts.display_packed_bits = TRUE;
- break;
- case 'v':
- dump_opts.display_vds_first = TRUE;
- break;
- case 'G':
- dump_opts.vds_gap_size = HDatoi(opt_arg);
- if (dump_opts.vds_gap_size < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- break;
-
- /** begin XML parameters **/
- case 'x':
- /* select XML output */
- doxml_g = TRUE;
- useschema_g = TRUE;
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'u':
- doxml_g = TRUE;
- useschema_g = FALSE;
- xmlnsprefix = "";
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'D':
- /* specify alternative XML DTD or schema */
- /* To Do: check format of this value? */
- xml_dtd_uri_g = opt_arg;
- h5tools_nCols = 0;
- break;
-
- case 'm':
- /* specify alternative floating point printing format */
- fp_format = opt_arg;
- h5tools_nCols = 0;
- break;
-
- case 'X':
- /* specify XML namespace (default="hdf5:"), or none */
- /* To Do: check format of this value? */
- if (!useschema_g) {
- usage(h5tools_getprogname());
- goto error;
- }
- if (HDstrcmp(opt_arg,":") == 0)
- xmlnsprefix = "";
- else
- xmlnsprefix = opt_arg;
- h5tools_nCols = 0;
- break;
- /** end XML parameters **/
-
- /** begin subsetting parameters **/
- case 's':
- case 'S':
- case 'c':
- case 'k': {
- struct subset_t *s;
-
- if (!last_was_dset) {
- error_msg("option `-%c' can only be used after --dataset option\n", opt);
- goto error;
- }
+ /** begin subsetting parameters **/
+ case 's':
+ case 'S':
+ case 'c':
+ case 'k': {
+ struct subset_t *s;
+
+ if (!last_was_dset) {
+ error_msg("option `-%c' can only be used after --dataset option\n", opt);
+ goto error;
+ }
+
+ if (last_dset->subset_info) {
+ /*
+ * This overrides the "terse" syntax if they actually mixed
+ * the two.
+ */
+ s = last_dset->subset_info;
+ }
+ else {
+ last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ }
- if (last_dset->subset_info) {
/*
- * This overrides the "terse" syntax if they actually mixed
- * the two.
+ * slightly convoluted, but...we are only interested in options
+ * for subsetting: "--start", "--stride", "--count", and "--block"
+ * which can come in any order. If we run out of parameters (EOF)
+ * or run into one which isn't a subsetting parameter (NOT s, S,
+ * c, or K), then we exit the do-while look, set the subset_info
+ * to the structure we've been filling. If we've reached the end
+ * of the options, we exit the parsing (goto parse_end) otherwise,
+ * since we've "read" the next option, we need to parse it. So we
+ * jump to the beginning of the switch statement (goto parse_start).
*/
- s = last_dset->subset_info;
- }
- else {
- last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
- }
-
- /*
- * slightly convoluted, but...we are only interested in options
- * for subsetting: "--start", "--stride", "--count", and "--block"
- * which can come in any order. If we run out of parameters (EOF)
- * or run into one which isn't a subsetting parameter (NOT s, S,
- * c, or K), then we exit the do-while look, set the subset_info
- * to the structure we've been filling. If we've reached the end
- * of the options, we exit the parsing (goto parse_end) otherwise,
- * since we've "read" the next option, we need to parse it. So we
- * jump to the beginning of the switch statement (goto parse_start).
- */
- do {
- switch ((char)opt) {
- case 's':
- if (s->start.data) {
- HDfree(s->start.data);
- s->start.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->start);
- break;
- case 'S':
- if (s->stride.data) {
- HDfree(s->stride.data);
- s->stride.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->stride);
- break;
- case 'c':
- if (s->count.data) {
- HDfree(s->count.data);
- s->count.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->count);
- break;
- case 'k':
- if (s->block.data) {
- HDfree(s->block.data);
- s->block.data = NULL;
+ do {
+ switch ((char)opt) {
+ case 's':
+ if (s->start.data) {
+ HDfree(s->start.data);
+ s->start.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->start);
+ break;
+ case 'S':
+ if (s->stride.data) {
+ HDfree(s->stride.data);
+ s->stride.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->stride);
+ break;
+ case 'c':
+ if (s->count.data) {
+ HDfree(s->count.data);
+ s->count.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->count);
+ break;
+ case 'k':
+ if (s->block.data) {
+ HDfree(s->block.data);
+ s->block.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->block);
+ break;
+ default:
+ goto end_collect;
}
- parse_hsize_list(opt_arg, &s->block);
- break;
- default:
- goto end_collect;
- }
- } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
+ } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
end_collect:
- last_was_dset = FALSE;
-
- if (opt != EOF)
- goto parse_start;
- else
- goto parse_end;
- }
- /** end subsetting parameters **/
+ last_was_dset = FALSE;
- case 'E':
- if (opt_arg != NULL)
- enable_error_stack = HDatoi(opt_arg);
- else
- enable_error_stack = 1;
- break;
- case 'C':
- dump_opts.disable_compact_subset = TRUE;
- break;
- case 'h':
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
+ if (opt != EOF)
+ goto parse_start;
+ else
+ goto parse_end;
+ }
+ /** end subsetting parameters **/
- case '$':
-#ifdef H5_HAVE_ROS3_VFD
- if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) {
- error_msg("failed to parse S3 VFD credential info\n");
+ case 'E':
+ if (opt_arg != NULL)
+ enable_error_stack = HDatoi(opt_arg);
+ else
+ enable_error_stack = 1;
+ break;
+ case 'C':
+ dump_opts.disable_compact_subset = TRUE;
+ break;
+ case 'h':
usage(h5tools_getprogname());
free_handler(hand, argc);
hand = NULL;
- h5tools_setstatus(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_SUCCESS);
goto done;
- }
+
+ case '$':
+#ifdef H5_HAVE_ROS3_VFD
+ if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) {
+ error_msg("failed to parse S3 VFD credential info\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
#else
- error_msg("Read-Only S3 VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
+ error_msg("Read-Only S3 VFD not enabled.\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
#endif
- break;
+ break;
- case '#':
+ case '#':
#ifdef H5_HAVE_LIBHDFS
- if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) {
- error_msg("failed to parse HDFS VFD configuration info\n");
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
+ if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) {
+ error_msg("failed to parse HDFS VFD configuration info\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+#else
+ error_msg("HDFS VFD not enabled.\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
-#else
- error_msg("HDFS VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
#endif
- break;
-
- case '1':
- vol_info_g.type = VOL_BY_VALUE;
- vol_info_g.u.value = (H5VL_class_value_t)HDatoi(opt_arg);
- use_custom_vol_g = TRUE;
- break;
-
- case '2':
- vol_info_g.type = VOL_BY_NAME;
- vol_info_g.u.name = opt_arg;
- use_custom_vol_g = TRUE;
- break;
-
- case '3':
- vol_info_g.info_string = opt_arg;
- break;
-
- case '?':
- default:
- usage(h5tools_getprogname());
- goto error;
+ break;
+
+ case '1':
+ vol_info_g.type = VOL_BY_VALUE;
+ vol_info_g.u.value = (H5VL_class_value_t)HDatoi(opt_arg);
+ use_custom_vol_g = TRUE;
+ break;
+
+ case '2':
+ vol_info_g.type = VOL_BY_NAME;
+ vol_info_g.u.name = opt_arg;
+ use_custom_vol_g = TRUE;
+ break;
+
+ case '3':
+ vol_info_g.info_string = opt_arg;
+ break;
+
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ goto error;
}
}
@@ -1341,7 +1369,6 @@ error:
return hand;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1354,25 +1381,25 @@ error:
int
main(int argc, const char *argv[])
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
- H5O_info2_t oi;
- struct handler_t *hand = NULL;
- int i;
- unsigned u;
- char *fname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
+ H5O_info2_t oi;
+ struct handler_t *hand = NULL;
+ int i;
+ unsigned u;
+ char * fname = NULL;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
h5tools_dump_header_format = &h5tools_standardformat;
- dump_function_table = &ddl_function_table;
- dump_indent = 0;
+ dump_function_table = &ddl_function_table;
+ dump_indent = 0;
/* Initialize h5tools lib */
h5tools_init();
- if((hand = parse_command_line(argc, argv))==NULL) {
+ if ((hand = parse_command_line(argc, argv)) == NULL) {
goto done;
}
@@ -1432,8 +1459,8 @@ main(int argc, const char *argv[])
if (driver_name_g != NULL) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = driver_name_g;
+ vfd_info.info = NULL;
+ vfd_info.name = driver_name_g;
if (!HDstrcmp(driver_name_g, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -1469,11 +1496,10 @@ main(int argc, const char *argv[])
}
}
- while(opt_ind < argc) {
+ while (opt_ind < argc) {
fname = HDstrdup(argv[opt_ind++]);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
@@ -1487,7 +1513,7 @@ main(int argc, const char *argv[])
/* Prepare to find objects that might be targets of a reference */
fill_ref_path_table(fid);
- if(doxml_g) {
+ if (doxml_g) {
/* initialize XML */
/* reset prefix! */
HDstrcpy(prefix, "");
@@ -1499,12 +1525,13 @@ main(int argc, const char *argv[])
}
else {
xml_dtd_uri_g = DEFAULT_DTD;
- xmlnsprefix = "";
+ xmlnsprefix = "";
}
}
else {
- if (useschema_g && HDstrcmp(xmlnsprefix,"")) {
- error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+ if (useschema_g && HDstrcmp(xmlnsprefix, "")) {
+ error_msg(
+ "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -1512,21 +1539,21 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name3(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name3(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Initialize object tables */
- if(table_list_add(fid, oi.fileno) < 0) {
+ if (table_list_add(fid, oi.fileno) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
group_table = table_list.tables[0].group_table;
- dset_table = table_list.tables[0].dset_table;
- type_table = table_list.tables[0].type_table;
+ dset_table = table_list.tables[0].dset_table;
+ type_table = table_list.tables[0].type_table;
/* does there exist unamed committed datatype */
for (u = 0; u < type_table->nobjs; u++)
@@ -1537,35 +1564,42 @@ main(int argc, const char *argv[])
/* start to dump - display file header information */
if (!doxml_g) {
- begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin);
+ begin_obj(h5tools_dump_header_format->filebegin, fname,
+ h5tools_dump_header_format->fileblockbegin);
}
else {
PRINTVALSTREAM(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
/* alternative first element, depending on schema or DTD. */
if (useschema_g) {
- if (HDstrcmp(xmlnsprefix,"") == 0) {
- PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri_g);
+ if (HDstrcmp(xmlnsprefix, "") == 0) {
+ PRINTSTREAM(rawoutstream,
+ "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:noNamespaceSchemaLocation=\"%s\">\n",
+ xml_dtd_uri_g);
}
else {
/* TO DO: make -url option work in this case (may need new option) */
char *ns;
char *indx;
- ns = HDstrdup(xmlnsprefix);
- indx = HDstrrchr(ns,(int)':');
+ ns = HDstrdup(xmlnsprefix);
+ indx = HDstrrchr(ns, (int)':');
if (indx)
*indx = '\0';
- PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
- "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
- "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
- "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns);
+ PRINTSTREAM(rawoutstream,
+ "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
+ "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",
+ xmlnsprefix, ns);
HDfree(ns);
}
}
else {
- PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri_g);
+ PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
+ xml_dtd_uri_g);
PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n");
}
}
@@ -1574,7 +1608,7 @@ main(int argc, const char *argv[])
if (dump_opts.display_fi) {
PRINTVALSTREAM(rawoutstream, "\n");
dump_fcontents(fid);
- end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend);
+ end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend);
PRINTVALSTREAM(rawoutstream, "\n");
goto done;
}
@@ -1583,36 +1617,35 @@ main(int argc, const char *argv[])
dump_fcpl(fid);
}
- if(dump_opts.display_all) {
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if (dump_opts.display_all) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
if (!doxml_g)
dump_indent += COL;
- dump_function_table->dump_group_function(gid, "/" );
+ dump_function_table->dump_group_function(gid, "/");
if (!doxml_g)
dump_indent -= COL;
PRINTVALSTREAM(rawoutstream, "\n");
}
- if(H5Gclose(gid) < 0) {
+ if (H5Gclose(gid) < 0) {
error_msg("unable to close root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
-
}
else {
/* Note: this option is not supported for XML */
- if(doxml_g) {
+ if (doxml_g) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
} /* end if */
- for(i = 0; i < argc; i++) {
- if(hand[i].func) {
+ for (i = 0; i < argc; i++) {
+ if (hand[i].func) {
hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL);
}
}
@@ -1629,21 +1662,21 @@ main(int argc, const char *argv[])
/* Free tables for objects */
table_list_free();
- if(fid >=0)
+ if (fid >= 0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix) {
+ if (prefix) {
HDfree(prefix);
prefix = NULL;
}
- if(fname) {
+ if (fname) {
HDfree(fname);
fname = NULL;
}
} /* end while */
- if(hand)
+ if (hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1659,20 +1692,20 @@ done:
h5tools_setstatus(EXIT_FAILURE);
}
- if(fid >=0)
+ if (fid >= 0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix) {
+ if (prefix) {
HDfree(prefix);
prefix = NULL;
}
- if(fname) {
+ if (fname) {
HDfree(fname);
fname = NULL;
}
- if(hand)
+ if (hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1680,7 +1713,6 @@ done:
leave(h5tools_getstatus());
} /* main */
-
/*-------------------------------------------------------------------------
* Function: init_prefix
*
@@ -1695,13 +1727,12 @@ done:
static void
init_prefix(char **prfx, size_t prfx_len)
{
- if(prfx_len > 0)
+ if (prfx_len > 0)
*prfx = (char *)HDcalloc(prfx_len, 1);
else
error_msg("unable to allocate prefix buffer\n");
}
-
/*-------------------------------------------------------------------------
* Function: add_prefix
*
@@ -1717,12 +1748,11 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
size_t new_len = HDstrlen(*prfx) + HDstrlen(name) + 2;
/* Check if we need more space */
- if(*prfx_len <= new_len) {
+ if (*prfx_len <= new_len) {
*prfx_len = new_len + 1;
- *prfx = (char *)HDrealloc(*prfx, *prfx_len);
+ *prfx = (char *)HDrealloc(*prfx, *prfx_len);
}
/* Append object name to prefix */
HDstrcat(HDstrcat(*prfx, "/"), name);
} /* end add_prefix */
-
diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h
index 548af09..b4198ad 100644
--- a/tools/src/h5dump/h5dump.h
+++ b/tools/src/h5dump/h5dump.h
@@ -26,66 +26,67 @@
**/
/* the table of dump functions */
typedef struct dump_functions_t {
- void (*dump_group_function) (hid_t, const char *);
- void (*dump_named_datatype_function) (hid_t, const char *);
- void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
- void (*dump_dataspace_function) (hid_t);
- void (*dump_datatype_function) (hid_t);
- herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
- void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+ void (*dump_group_function)(hid_t, const char *);
+ void (*dump_named_datatype_function)(hid_t, const char *);
+ void (*dump_dataset_function)(hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function)(hid_t);
+ void (*dump_datatype_function)(hid_t);
+ herr_t (*dump_attribute_function)(hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function)(hid_t, int, struct subset_t *, int);
} dump_functions;
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_items_t {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t * group_table; /* Table of groups */
+ table_t * dset_table; /* Table of datasets */
+ table_t * type_table; /* Table of datatypes */
} h5dump_table_items_t;
typedef struct h5dump_table_list_t {
- size_t nalloc;
- size_t nused;
- h5dump_table_items_t *tables;
+ size_t nalloc;
+ size_t nused;
+ h5dump_table_items_t *tables;
} h5dump_table_list_t;
-h5dump_table_list_t table_list = {0, 0, NULL};
-table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
+h5dump_table_list_t table_list = {0, 0, NULL};
+table_t * group_table = NULL, *dset_table = NULL, *type_table = NULL;
-unsigned dump_indent = 0; /* how far in to indent the line */
-int unamedtype = 0; /* shared datatype with no name */
-hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
-size_t prefix_len = 1024;
-char *prefix = NULL;
-const char *fp_format = NULL;
+unsigned dump_indent = 0; /* how far in to indent the line */
+int unamedtype = 0; /* shared datatype with no name */
+hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
+size_t prefix_len = 1024;
+char * prefix = NULL;
+const char *fp_format = NULL;
/* things to display or which are set via command line parameters */
typedef struct {
- int display_all;
- int display_oid;
- int display_data;
- int display_attr_data;
- int display_char; /* print 1-byte numbers as ASCII */
- int usingdasho;
- int display_bb; /* superblock */
- int display_dcpl; /* dcpl */
- int display_fi; /* file index */
- int display_ai; /* array index */
- int display_escape; /* escape non printable characters */
- int display_region; /* print region reference data */
- int disable_compact_subset; /* disable compact form of subset notation */
- int display_packed_bits; /* print 1-8 byte numbers as packed bits */
- int include_attrs; /* Display attributes */
- int display_vds_first; /* vds display to all by default */
- int vds_gap_size; /* vds skip missing files default is none */
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
} dump_opt_t;
-dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
+dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
-#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
-#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX (8 * sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
-unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
unsigned packed_offset[PACKED_BITS_MAX];
@@ -98,16 +99,17 @@ unsigned packed_length[PACKED_BITS_MAX];
const dump_functions *dump_function_table;
#ifdef __cplusplus
-"C" {
+"C"
+{
#endif
-void add_prefix(char **prfx, size_t *prfx_len, const char *name);
-hid_t h5_fileaccess(void);
-ssize_t table_list_add(hid_t oid, unsigned long file_no);
-ssize_t table_list_visited(unsigned long file_no);
+ void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+ hid_t h5_fileaccess(void);
+ ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ ssize_t table_list_visited(unsigned long file_no);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_H__ */
+#endif /* !H5DUMP_H__ */
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index ce3643c..8c637b1 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -21,18 +21,18 @@
#include "h5dump_ddl.h"
typedef struct {
- hid_t fid; /* File ID being traversed */
- const char *op_name; /* Object name wanted */
+ hid_t fid; /* File ID being traversed */
+ const char *op_name; /* Object name wanted */
} trav_handle_udata_t;
typedef struct {
- const char *path; /* Path of object being searched */
- const char *op_name; /* Object name wanted */
+ const char *path; /* Path of object being searched */
+ const char *op_name; /* Object name wanted */
} trav_attr_udata_t;
/* callback function used by H5Literate() */
-static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *op_data);
-static int dump_extlink(hid_t group, const char *linkname, const char *objname);
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *op_data);
+static int dump_extlink(hid_t group, const char *linkname, const char *objname);
/*-------------------------------------------------------------------------
* Function: dump_datatype
@@ -46,12 +46,12 @@ static int dump_extlink(hid_t group, const char *linkname, const char *objn
void
dump_datatype(hid_t type)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
@@ -70,17 +70,16 @@ dump_datatype(hid_t type)
void
dump_dataspace(hid_t space)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
}
-
/*-------------------------------------------------------------------------
* Function: dump_attr_cb
*
@@ -91,48 +90,49 @@ dump_dataspace(hid_t space)
*-------------------------------------------------------------------------
*/
herr_t
-dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
+ void H5_ATTR_UNUSED *_op_data)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hid_t attr_id;
- herr_t ret = SUCCEED;
+ hid_t attr_id;
+ herr_t ret = SUCCEED;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = dump_opts.display_oid;
- data_output = dump_opts.display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
attr_data_output = dump_opts.display_attr_data;
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;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
h5dump_type_table = NULL;
- if(attr_id < 0) {
+ if (attr_id < 0) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
@@ -140,7 +140,6 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: dump_all_cb
*
@@ -154,43 +153,43 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
static herr_t
dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
- hid_t obj;
- hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
- 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 = &h5tools_dataformat;
+ hid_t obj;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ 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 = &h5tools_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;
/* 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;
}
@@ -199,355 +198,369 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT
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 */
+ 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 */
- old_prefix = HDstrdup(prefix);
- if (old_prefix) {
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ if (old_prefix) {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
- }
- else
- error_msg("warning: null prefix\n");
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+ }
+ else
+ error_msg("warning: null prefix\n");
- /* Close group */
- H5Gclose(obj);
- }
- break;
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- case H5O_TYPE_DATASET:
- if(dump_opts.display_data) {
- if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
- error_msg("error in creating default access property list ID\n");
+ case H5O_TYPE_DATASET:
+ if (dump_opts.display_data) {
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
+ error_msg("error in creating default access property list ID\n");
+ }
+ if (dump_opts.display_vds_first) {
+ if (H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ error_msg("error in setting access property list ID, virtual_view\n");
+ }
+ if (dump_opts.vds_gap_size > 0) {
+ if (H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
+ error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ }
}
- if (dump_opts.display_vds_first) {
- if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
- error_msg("error in setting access property list ID, virtual_view\n");
+ if ((obj = H5Dopen2(group, name, dapl_id)) >= 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;
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ 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);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->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);
+ 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);
+
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else {
+ found_obj->displayed = TRUE;
+ }
+ } /* end if */
+
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
}
- if (dump_opts.vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
- error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ else {
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
}
- }
- if((obj = H5Dopen2(group, name, dapl_id)) >= 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;
+ break;
- /* 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);
+ 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;
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ 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;
- ctx.need_prefix = TRUE;
+ 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 {
+ 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);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->softlinkbegin,
+ name, h5tools_dump_header_format->softlinkblockbegin);
+ 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++;
+ 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;
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- goto done;
}
- else if(found_obj->displayed) {
- 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);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
+ else {
+ /* print the value of a soft link */
+ /* Standard DDL: no modification */
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);
-
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- goto done;
- }
- else {
- found_obj->displayed = TRUE;
+ h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
- } /* end if */
- dump_function_table->dump_dataset_function(obj, name, NULL);
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- }
- else {
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- error_msg("unable to dump dataset \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- break;
+ ctx.indent_level--;
- 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_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;
-
- 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 {
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->softlinkbegin, name,
- h5tools_dump_header_format->softlinkblockbegin);
- 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);
+ if (HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ HDfree(targbuf);
+ }
+ break;
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ 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 {
- /* print the value of a soft link */
- /* Standard DDL: no modification */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->extlinkbegin,
+ name, h5tools_dump_header_format->extlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ indentation(dump_indent);
+ 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) {
+ indentation(dump_indent);
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
+ 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, "TARGETPATH \"%s\"", targname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* dump the external link */
+ dump_extlink(group, name, targname);
+ ctx.indent_level--;
+ } /* end else */
+ } /* end else */
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
+ 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);
- if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, " ");
+ HDfree(targbuf);
}
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- HDfree(targbuf);
- }
- break;
+ 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 {
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->extlinkbegin, name,
- h5tools_dump_header_format->extlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- indentation(dump_indent);
- error_msg("unable to get external link value\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- } /* end if */
- else {
- const char *filename;
- const char *targname;
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->udlinkbegin, name,
+ h5tools_dump_header_format->udlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- indentation(dump_indent);
- error_msg("unable to unpack external link value\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- } /* end if */
- else {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
- 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, "LINKCLASS %d", linfo->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.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- /* dump the external link */
- dump_extlink(group, name, targname);
- ctx.indent_level--;
- } /* end else */
- } /* end else */
ctx.need_prefix = TRUE;
-
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
+ if (HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->udlinkend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- HDfree(targbuf);
- }
- break;
-
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->udlinkbegin, name,
- h5tools_dump_header_format->udlinkblockbegin);
- 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, "LINKCLASS %d", linfo->type);
- 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);
- if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->udlinkend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->udlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (HDstrlen(h5tools_dump_header_format->udlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -565,19 +578,19 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags)
{
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if(dump_opts.include_attrs) {
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ if (dump_opts.include_attrs) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, 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_attr_cb, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
}
}
@@ -595,7 +608,7 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
- 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, dump_all_cb, NULL);
else
H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
@@ -614,11 +627,11 @@ dump_named_datatype(hid_t tid, const char *name)
{
H5O_info2_t oinfo;
unsigned attr_crt_order_flags;
- hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
- 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 = &h5tools_dataformat;
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
+ 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 = &h5tools_dataformat;
h5tool_format_t string_dataformat;
/* setup */
@@ -626,24 +639,24 @@ dump_named_datatype(hid_t tid, 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 ((tcpl_id = H5Tget_create_plist(tid)) < 0) {
error_msg("error in getting creation property list ID\n");
@@ -656,7 +669,7 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(tcpl_id) < 0) {
+ if (H5Pclose(tcpl_id) < 0) {
error_msg("error in closing creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -665,18 +678,18 @@ dump_named_datatype(hid_t tid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datatypebegin, name,
- h5tools_dump_header_format->datatypeblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datatypebegin, name,
+ h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
*/
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(type_table, &oinfo.token);
@@ -689,7 +702,8 @@ dump_named_datatype(hid_t tid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- 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);
goto done;
}
else
@@ -700,11 +714,12 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_str_reset(&buffer);
h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE);
- if(H5Tget_class(tid) != H5T_COMPOUND) {
+ if (H5Tget_class(tid) != H5T_COMPOUND) {
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);
/* print attributes */
dump_indent += COL;
@@ -716,14 +731,15 @@ dump_named_datatype(hid_t tid, const char *name)
done:
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend);
- if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend);
- 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);
}
@@ -739,18 +755,18 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info2_t oinfo;
- hid_t dset;
- hid_t type;
- hid_t gcpl_id;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- char type_name[1024];
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ H5O_info2_t oinfo;
+ hid_t dset;
+ hid_t type;
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ char type_name[1024];
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_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 ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -764,12 +780,12 @@ 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);
}
@@ -779,43 +795,43 @@ 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;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->groupbegin, name,
- h5tools_dump_header_format->groupblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->groupbegin, name,
+ h5tools_dump_header_format->groupblockbegin);
+ 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;
- if(!HDstrcmp(name, "/") && unamedtype) {
- unsigned u; /* Local index variable */
+ if (!HDstrcmp(name, "/") && unamedtype) {
+ unsigned u; /* Local index variable */
/* 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);
@@ -831,7 +847,7 @@ dump_group(hid_t gid, const char *name)
}
} /* end if */
- if(dump_opts.display_oid)
+ if (dump_opts.display_oid)
h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
@@ -841,8 +857,8 @@ dump_group(hid_t gid, const char *name)
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
*/
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(group_table, &oinfo.token);
@@ -856,7 +872,8 @@ dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- 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 {
found_obj->displayed = TRUE;
@@ -876,14 +893,15 @@ dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->groupblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->groupblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend);
- if(HDstrlen(h5tools_dump_header_format->groupend))
+ if (HDstrlen(h5tools_dump_header_format->groupend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->groupend))
+ if (HDstrlen(h5tools_dump_header_format->groupend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend);
- 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);
}
@@ -899,35 +917,35 @@ dump_group(hid_t gid, const char *name)
void
dump_dataset(hid_t did, const char *name, struct subset_t *sset)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hid_t type, space;
- unsigned attr_crt_order_flags;
- hid_t dcpl_id; /* dataset creation property list ID */
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = 0; /* total data element position */
+ hid_t type, space;
+ unsigned attr_crt_order_flags;
+ hid_t dcpl_id; /* dataset creation property list ID */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
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 ((dcpl_id = H5Dget_create_plist(did)) < 0) {
error_msg("error in getting creation property list ID\n");
@@ -946,19 +964,19 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
+ /* 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);
+ 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);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, did);
dump_indent += COL;
ctx.indent_level++;
- type = H5Dget_type(did);
+ type = H5Dget_type(did);
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
h5dump_type_table = NULL;
@@ -967,74 +985,74 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
H5Sclose(space);
- if(dump_opts.display_oid) {
+ if (dump_opts.display_oid) {
h5tools_dump_oid(rawoutstream, outputformat, &ctx, did);
}
- if(dump_opts.display_dcpl) {
+ if (dump_opts.display_dcpl) {
h5dump_type_table = type_table;
h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did);
h5dump_type_table = NULL;
}
H5Pclose(dcpl_id);
- ctx.sset = sset;
+ ctx.sset = sset;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
- if(dump_opts.display_data) {
- unsigned data_loop = 1;
- unsigned u;
+ ctx.display_char = dump_opts.display_char;
+ if (dump_opts.display_data) {
+ unsigned data_loop = 1;
+ unsigned u;
- if(dump_opts.display_packed_bits)
+ if (dump_opts.display_packed_bits)
data_loop = packed_bits_num;
- for(u = 0; u < data_loop; u++) {
- if(dump_opts.display_packed_bits) {
+ for (u = 0; u < data_loop; u++) {
+ if (dump_opts.display_packed_bits) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- packed_data_mask = packed_mask[u];
+ packed_data_mask = packed_mask[u];
packed_data_offset = packed_offset[u];
packed_data_length = packed_length[u];
h5tools_print_packed_bits(&buffer, 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);
}
- switch(H5Tget_class(type)) {
- case H5T_TIME:
- ctx.indent_level++;
+ switch (H5Tget_class(type)) {
+ case H5T_TIME:
+ ctx.indent_level++;
- 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, "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;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "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.indent_level--;
- break;
+ ctx.indent_level--;
+ break;
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY: {
h5tools_dump_data(rawoutstream, outputformat, &ctx, did, TRUE);
- }
- break;
+ } break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- error_msg("invalid H5TCLASS type\n");
- break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ error_msg("invalid H5TCLASS type\n");
+ break;
} /* end switch */
- } /* for(u=0; u<data_loop; u++) */
+ } /* for(u=0; u<data_loop; u++) */
}
H5Tclose(type);
@@ -1049,14 +1067,15 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->datasetend))
+ 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);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -1072,8 +1091,8 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
void
dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
int print_dataset = FALSE;
@@ -1081,32 +1100,31 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
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;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
- ctx.sset = sset;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+ ctx.sset = sset;
ctx.display_index = display_index;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
- if(obj_data == DATASET_DATA)
+ if (obj_data == DATASET_DATA)
print_dataset = TRUE;
h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset);
}
-
/*-------------------------------------------------------------------------
* Function: dump_fcpl
*
@@ -1118,19 +1136,19 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
void
dump_fcpl(hid_t fid)
{
- hid_t fcpl; /* file creation property list ID */
- hsize_t userblock; /* userblock size retrieved from FCPL */
- size_t off_size; /* size of offsets in the file */
- size_t len_size; /* size of lengths in the file */
- H5F_fspace_strategy_t fs_strategy; /* file space strategy */
- hbool_t fs_persist; /* Persisting free-space or not */
- hsize_t fs_threshold; /* free-space section threshold */
- hsize_t fsp_size; /* file space page size */
- H5F_info2_t finfo; /* file information */
+ hid_t fcpl; /* file creation property list ID */
+ hsize_t userblock; /* userblock size retrieved from FCPL */
+ size_t off_size; /* size of offsets in the file */
+ size_t len_size; /* size of lengths in the file */
+ H5F_fspace_strategy_t fs_strategy; /* file space strategy */
+ hbool_t fs_persist; /* Persisting free-space or not */
+ hsize_t fs_threshold; /* free-space section threshold */
+ hsize_t fsp_size; /* file space page size */
+ H5F_info2_t finfo; /* file information */
#ifdef SHOW_FILE_DRIVER
- hid_t fapl; /* file access property list ID */
- hid_t fdriver; /* file driver */
- char dname[32]; /* buffer to store driver name */
+ hid_t fapl; /* file access property list ID */
+ hid_t fdriver; /* file driver */
+ char dname[32]; /* buffer to store driver name */
#endif
unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
unsigned sym_ik; /* symbol table B-tree internal 'K' value */
@@ -1148,107 +1166,108 @@ dump_fcpl(hid_t fid)
if (!supported)
return;
- fcpl=H5Fget_create_plist(fid);
+ fcpl = H5Fget_create_plist(fid);
H5Fget_info2(fid, &finfo);
- H5Pget_userblock(fcpl,&userblock);
- H5Pget_sizes(fcpl,&off_size,&len_size);
- H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
- H5Pget_istore_k(fcpl,&istore_ik);
+ H5Pget_userblock(fcpl, &userblock);
+ H5Pget_sizes(fcpl, &off_size, &len_size);
+ H5Pget_sym_k(fcpl, &sym_ik, &sym_lk);
+ H5Pget_istore_k(fcpl, &istore_ik);
H5Pget_file_space_strategy(fcpl, &fs_strategy, &fs_persist, &fs_threshold);
H5Pget_file_space_page_size(fcpl, &fsp_size);
H5Pclose(fcpl);
#ifdef SHOW_FILE_DRIVER
- fapl=h5_fileaccess();
- fdriver=H5Pget_driver(fapl);
+ fapl = h5_fileaccess();
+ fdriver = H5Pget_driver(fapl);
H5Pclose(fapl);
#endif
- /*-------------------------------------------------------------------------
- * SUPER_BLOCK
- *-------------------------------------------------------------------------
- */
- PRINTSTREAM(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN);
+ /*-------------------------------------------------------------------------
+ * SUPER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ PRINTSTREAM(rawoutstream, "\n%s %s\n", SUPER_BLOCK, BEGIN);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SUPERBLOCK_VERSION", finfo.super.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "FREELIST_VERSION", finfo.free.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SYMBOLTABLE_VERSION",
+ 0); /* Retain this for backward compatibility, for now (QAK) */
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "OBJECTHEADER_VERSION", finfo.sohm.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream,"%s %zu\n","OFFSET_SIZE", off_size);
+ PRINTSTREAM(rawoutstream, "%s %zu\n", "OFFSET_SIZE", off_size);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream,"%s %zu\n","LENGTH_SIZE", len_size);
+ PRINTSTREAM(rawoutstream, "%s %zu\n", "LENGTH_SIZE", len_size);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "BTREE_RANK", sym_ik);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk);
+ PRINTSTREAM(rawoutstream, "%s %d\n", "BTREE_LEAF", sym_lk);
#ifdef SHOW_FILE_DRIVER
- if(H5FD_CORE==fdriver)
- HDstrcpy(dname,"H5FD_CORE");
+ if (H5FD_CORE == fdriver)
+ HDstrcpy(dname, "H5FD_CORE");
#ifdef H5_HAVE_DIRECT
- else if(H5FD_DIRECT==fdriver)
- HDstrcpy(dname,"H5FD_DIRECT");
+ else if (H5FD_DIRECT == fdriver)
+ HDstrcpy(dname, "H5FD_DIRECT");
#endif
- else if(H5FD_FAMILY==fdriver)
- HDstrcpy(dname,"H5FD_FAMILY");
- else if(H5FD_LOG==fdriver)
- HDstrcpy(dname,"H5FD_LOG");
- else if(H5FD_MPIO==fdriver)
- HDstrcpy(dname,"H5FD_MPIO");
- else if(H5FD_MULTI==fdriver)
- HDstrcpy(dname,"H5FD_MULTI");
- else if(H5FD_SEC2==fdriver)
- HDstrcpy(dname,"H5FD_SEC2");
- else if(H5FD_STDIO==fdriver)
- HDstrcpy(dname,"H5FD_STDIO");
+ else if (H5FD_FAMILY == fdriver)
+ HDstrcpy(dname, "H5FD_FAMILY");
+ else if (H5FD_LOG == fdriver)
+ HDstrcpy(dname, "H5FD_LOG");
+ else if (H5FD_MPIO == fdriver)
+ HDstrcpy(dname, "H5FD_MPIO");
+ else if (H5FD_MULTI == fdriver)
+ HDstrcpy(dname, "H5FD_MULTI");
+ else if (H5FD_SEC2 == fdriver)
+ HDstrcpy(dname, "H5FD_SEC2");
+ else if (H5FD_STDIO == fdriver)
+ HDstrcpy(dname, "H5FD_STDIO");
else
- HDstrcpy(dname,"Unknown driver");
+ HDstrcpy(dname, "Unknown driver");
- /* Take out this because the driver used can be different from the
- * standard output. */
- /*indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
+ /* Take out this because the driver used can be different from the
+ * standard output. */
+ /*indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
#endif
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","ISTORE_K", istore_ik);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "ISTORE_K", istore_ik);
indentation(dump_indent + COL);
- if(fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) {
+ if (fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_FSM_AGGR");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_PAGE");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_AGGR) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_AGGR) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_AGGR");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_NONE) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_NONE) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_NONE");
}
else
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy");
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %s\n","FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE");
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE");
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n","FREE_SPACE_SECTION_THRESHOLD", fs_threshold);
+ PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "FREE_SPACE_SECTION_THRESHOLD", fs_threshold);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n","FILE_SPACE_PAGE_SIZE", fsp_size);
+ PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "FILE_SPACE_PAGE_SIZE", fsp_size);
/*-------------------------------------------------------------------------
- * USER_BLOCK
- *-------------------------------------------------------------------------
- */
+ * USER_BLOCK
+ *-------------------------------------------------------------------------
+ */
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n",BEGIN);
+ PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n", BEGIN);
indentation(dump_indent + COL + COL);
- PRINTSTREAM(rawoutstream,"%s %" PRIuHSIZE "\n","USERBLOCK_SIZE", userblock);
+ PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "USERBLOCK_SIZE", userblock);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s\n",END);
+ PRINTSTREAM(rawoutstream, "%s\n", END);
- PRINTSTREAM(rawoutstream, "%s",END);
+ PRINTSTREAM(rawoutstream, "%s", END);
}
/*-------------------------------------------------------------------------
@@ -1262,7 +1281,7 @@ dump_fcpl(hid_t fid)
void
dump_fcontents(hid_t fid)
{
- PRINTSTREAM(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN);
+ PRINTSTREAM(rawoutstream, "%s %s\n", FILE_CONTENTS, BEGIN);
/* special case of unamed types in root group */
if (unamedtype) {
@@ -1282,52 +1301,52 @@ dump_fcontents(hid_t fid)
/* print objects in the files */
h5trav_print(fid);
- PRINTSTREAM(rawoutstream, " %s\n",END);
+ PRINTSTREAM(rawoutstream, " %s\n", END);
}
static herr_t
attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
- herr_t ret = SUCCEED;
- int j;
- char *obj_op_name;
- char *obj_name;
- trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data;
- const char *buf = attr_data->path;
- const char *op_name = attr_data->op_name;
+ herr_t ret = SUCCEED;
+ int j;
+ char * obj_op_name;
+ char * obj_name;
+ trav_attr_udata_t *attr_data = (trav_attr_udata_t *)_op_data;
+ const char * buf = attr_data->path;
+ const char * op_name = attr_data->op_name;
j = (int)HDstrlen(op_name) - 1;
/* find the last / */
- while(j >= 0) {
- if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
+ while (j >= 0) {
+ if (op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
break;
j--;
}
obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/");
- if(obj_op_name == NULL) {
+ if (obj_op_name == NULL) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- if(HDstrcmp(attr_name, obj_op_name)==0) {
+ if (HDstrcmp(attr_name, obj_op_name) == 0) {
size_t u, v, w;
/* object name */
- u = HDstrlen(buf);
- v = HDstrlen(op_name);
- w = u + 1 + v + 1 + 2;
+ u = HDstrlen(buf);
+ v = HDstrlen(op_name);
+ w = u + 1 + v + 1 + 2;
obj_name = (char *)HDmalloc(w);
- if(obj_name == NULL) {
+ if (obj_name == NULL) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
HDmemset(obj_name, '\0', w);
- if(op_name[0] != '/') {
+ if (op_name[0] != '/') {
HDstrncat(obj_name, buf, u + 1);
- if(buf[u - 1] != '/')
+ if (buf[u - 1] != '/')
HDstrncat(obj_name, "/", (size_t)2);
}
HDstrncat(obj_name, op_name, v + 1);
@@ -1342,18 +1361,20 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
} /* end attr_search() */
static herr_t
-obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
+obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *already_visited,
+ void *_op_data)
{
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- const char *op_name = handle_data->op_name;
- trav_attr_udata_t attr_data;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t *)_op_data;
+ const char * op_name = handle_data->op_name;
+ trav_attr_udata_t attr_data;
- attr_data.path = path;
+ attr_data.path = path;
attr_data.op_name = op_name;
- H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT);
+ H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search,
+ (void *)&attr_data, H5P_DEFAULT);
- if(HDstrcmp(path, op_name) == 0) {
- switch(oi->type) {
+ if (HDstrcmp(path, op_name) == 0) {
+ switch (oi->type) {
case H5O_TYPE_GROUP:
handle_groups(handle_data->fid, path, NULL, 0, NULL);
break;
@@ -1381,19 +1402,19 @@ obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *a
static herr_t
lnk_search(const char *path, const H5L_info2_t *li, void *_op_data)
{
- size_t search_len;
- size_t k;
- char *search_name;
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- const char *op_name = handle_data->op_name;
+ size_t search_len;
+ size_t k;
+ char * search_name;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t *)_op_data;
+ const char * op_name = handle_data->op_name;
search_len = HDstrlen(op_name);
- if(search_len > 0 && op_name[0] != '/')
+ if (search_len > 0 && op_name[0] != '/')
k = 2;
else
k = 1;
search_name = (char *)HDmalloc(search_len + k);
- if(search_name == NULL) {
+ if (search_name == NULL) {
error_msg("creating temporary link\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1406,20 +1427,20 @@ lnk_search(const char *path, const H5L_info2_t *li, void *_op_data)
HDstrncpy(search_name, op_name, search_len + 1);
search_name[search_len + k - 1] = '\0';
- if(HDstrcmp(path, search_name) == 0) {
- switch(li->type) {
- case H5L_TYPE_SOFT:
- case H5L_TYPE_EXTERNAL:
- handle_links(handle_data->fid, op_name, NULL, 0, NULL);
- break;
+ if (HDstrcmp(path, search_name) == 0) {
+ switch (li->type) {
+ case H5L_TYPE_SOFT:
+ case H5L_TYPE_EXTERNAL:
+ handle_links(handle_data->fid, op_name, NULL, 0, NULL);
+ break;
- case H5L_TYPE_HARD:
- case H5L_TYPE_MAX:
- case H5L_TYPE_ERROR:
- default:
- error_msg("unknown link type value\n");
- h5tools_setstatus(EXIT_FAILURE);
- break;
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ default:
+ error_msg("unknown link type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
} /* end switch() */
}
HDfree(search_name);
@@ -1436,19 +1457,20 @@ lnk_search(const char *path, const H5L_info2_t *li, void *_op_data)
*-------------------------------------------------------------------------
*/
void
-handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
- hid_t gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
- hid_t gcpl_id;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- trav_handle_udata_t handle_udata; /* User data for traversal */
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ trav_handle_udata_t handle_udata; /* User data for traversal */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -1462,19 +1484,19 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
}
/* 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);
}
- handle_udata.fid = fid;
+ handle_udata.fid = fid;
handle_udata.op_name = path_name;
- if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) {
error_msg("error traversing information\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1490,33 +1512,34 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
*-------------------------------------------------------------------------
*/
void
-handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
- hid_t oid = H5I_INVALID_HID;
- hid_t attr_id = H5I_INVALID_HID;
- char *obj_name = NULL;
- char *attr_name = NULL;
- int j;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ hid_t oid = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
+ char * obj_name = NULL;
+ char * attr_name = NULL;
+ int j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
- j = (int)HDstrlen(attr) - 1;
+ j = (int)HDstrlen(attr) - 1;
obj_name = (char *)HDmalloc((size_t)j + 2);
- if(obj_name == NULL)
+ if (obj_name == NULL)
goto error;
/* find the last / */
- while(j >= 0) {
- if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\')))
+ while (j >= 0) {
+ if (attr[j] == '/' && (j == 0 || (j > 0 && attr[j - 1] != '\\')))
break;
j--;
}
/* object name */
- if(j == -1)
+ if (j == -1)
HDstrcpy(obj_name, "/");
else {
HDstrncpy(obj_name, attr, (size_t)j + 1);
@@ -1525,32 +1548,32 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
dump_indent += COL;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
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;
attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
/* handle error case: cannot open the object with the attribute */
- if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
+ if ((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1558,45 +1581,46 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->attributebegin, attr,
- h5tools_dump_header_format->attributeblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr,
+ h5tools_dump_header_format->attributeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
error_msg("unable to open object \"%s\"\n", obj_name);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->attributeblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->attributeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend);
- if(HDstrlen(h5tools_dump_header_format->attributeend))
+ if (HDstrlen(h5tools_dump_header_format->attributeend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->attributeend))
+ if (HDstrlen(h5tools_dump_header_format->attributeend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend);
- 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);
goto error;
} /* end if */
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = dump_opts.display_oid;
- data_output = dump_opts.display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
attr_data_output = dump_opts.display_attr_data;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
h5dump_type_table = NULL;
- if(attr_id < 0) {
+ if (attr_id < 0) {
goto error;
}
/* Close object */
- if(H5Oclose(oid) < 0) {
+ if (H5Oclose(oid) < 0) {
goto error;
} /* end if */
@@ -1607,16 +1631,18 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
error:
h5tools_setstatus(EXIT_FAILURE);
- if(obj_name)
+ if (obj_name)
HDfree(obj_name);
if (attr_name)
HDfree(attr_name);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Oclose(oid);
H5Aclose(attr_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
dump_indent -= COL;
}
@@ -1633,69 +1659,69 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
{
H5O_info2_t oinfo;
hid_t dsetid;
- hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
- struct subset_t *sset = (struct subset_t *)data;
- const char *real_name = display_name ? display_name : dset;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ struct subset_t *sset = (struct subset_t *)data;
+ const char * real_name = display_name ? display_name : dset;
- if(dump_opts.display_data) {
+ if (dump_opts.display_data) {
if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
error_msg("error in creating default access property list ID\n");
}
if (dump_opts.display_vds_first) {
- if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
error_msg("error in setting access property list ID, virtual_view\n");
}
if (dump_opts.vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
+ if (H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
error_msg("error in setting access property list ID, virtual_printf_gap\n");
}
}
- if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
+ if ((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
if (pe)
handle_links(fid, dset, data, pe, display_name);
return;
} /* end if */
- if(sset) {
+ if (sset) {
unsigned int i;
unsigned int ndims;
- hid_t sid = H5Dget_space(dsetid);
- int ndims_res = H5Sget_simple_extent_ndims(sid);
+ hid_t sid = H5Dget_space(dsetid);
+ int ndims_res = H5Sget_simple_extent_ndims(sid);
H5Sclose(sid);
- if(ndims_res < 0) {
+ if (ndims_res < 0) {
error_msg("H5Sget_simple_extent_ndims failed\n");
h5tools_setstatus(EXIT_FAILURE);
return;
}
ndims = (unsigned)ndims_res;
- if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
+ if (!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- if(!sset->start.data) {
+ if (!sset->start.data) {
/* default to (0, 0, ...) for the start coord */
sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->start.len = ndims;
+ sset->start.len = ndims;
}
- if(!sset->stride.data) {
+ if (!sset->stride.data) {
sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->stride.len = ndims;
+ sset->stride.len = ndims;
for (i = 0; i < ndims; i++)
sset->stride.data[i] = 1;
}
- if(!sset->count.data) {
+ if (!sset->count.data) {
sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->count.len = ndims;
+ sset->count.len = ndims;
for (i = 0; i < ndims; i++)
sset->count.data[i] = 1;
}
- if(!sset->block.data) {
+ if (!sset->block.data) {
sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->block.len = ndims;
+ sset->block.len = ndims;
for (i = 0; i < ndims; i++)
sset->block.data[i] = 1;
}
@@ -1705,22 +1731,22 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* check for dimension overflow
*-------------------------------------------------------------------------
*/
- if(sset->start.len > ndims) {
+ if (sset->start.len > ndims) {
error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->stride.len > ndims) {
+ if (sset->stride.len > ndims) {
error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->count.len > ndims) {
+ if (sset->count.len > ndims) {
error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->block.len > ndims) {
+ if (sset->block.len > ndims) {
error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
@@ -1730,29 +1756,29 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* check for block overlap
*-------------------------------------------------------------------------
*/
- for(i = 0; i < ndims; i++) {
- if(sset->count.data[i] > 1) {
- if(sset->stride.data[i] < sset->block.data[i]) {
+ for (i = 0; i < ndims; i++) {
+ if (sset->count.data[i] > 1) {
+ if (sset->stride.data[i] < sset->block.data[i]) {
error_msg("wrong subset selection; blocks overlap\n");
h5tools_setstatus(EXIT_FAILURE);
return;
} /* end if */
- } /* end if */
- } /* end for */
- } /* end if */
-
+ } /* end if */
+ } /* end for */
+ } /* end if */
H5Oget_info3(dsetid, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(dset_table, &oinfo.token);
- if(found_obj) {
+ if (found_obj) {
if (found_obj->displayed) {
PRINTVALSTREAM(rawoutstream, "\n");
indentation(dump_indent);
- begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin);
+ begin_obj(h5tools_dump_header_format->datasetbegin, real_name,
+ h5tools_dump_header_format->datasetblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(dump_indent + COL);
PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname);
@@ -1776,7 +1802,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
}
if (dapl_id != H5P_DEFAULT)
H5Pclose(dapl_id);
- if(H5Dclose(dsetid) < 0)
+ if (H5Dclose(dsetid) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1792,12 +1818,13 @@ void
handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
{
hid_t gid;
- const char *real_name = display_name ? display_name : group;
+ const char *real_name = display_name ? display_name : group;
- if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
if (pe) {
PRINTVALSTREAM(rawoutstream, "\n");
- begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin);
+ begin_obj(h5tools_dump_header_format->groupbegin, real_name,
+ h5tools_dump_header_format->groupblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
error_msg("unable to open group \"%s\"\n", real_name);
@@ -1808,9 +1835,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
else {
size_t new_len = HDstrlen(group) + 1;
- if(prefix_len <= new_len) {
+ if (prefix_len <= new_len) {
prefix_len = new_len;
- prefix = (char *)HDrealloc(prefix, prefix_len);
+ prefix = (char *)HDrealloc(prefix, prefix_len);
} /* end if */
HDstrcpy(prefix, group);
@@ -1819,7 +1846,7 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
dump_group(gid, real_name);
dump_indent -= COL;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
h5tools_setstatus(EXIT_FAILURE);
} /* end else */
} /* end handle_groups() */
@@ -1833,15 +1860,16 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
*-------------------------------------------------------------------------
*/
void
-handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
H5L_info2_t linfo;
- if(H5Lget_info2(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if (H5Lget_info2(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- else if(linfo.type == H5L_TYPE_HARD) {
+ else if (linfo.type == H5L_TYPE_HARD) {
error_msg("\"%s\" is a hard link\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1849,56 +1877,60 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
char *buf = (char *)HDmalloc(linfo.u.val_size);
PRINTVALSTREAM(rawoutstream, "\n");
- switch(linfo.type) {
- case H5L_TYPE_SOFT: /* Soft link */
- begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
- if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
- PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
- }
- else {
- error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
- h5tools_setstatus(EXIT_FAILURE);
- }
- end_obj(h5tools_dump_header_format->softlinkend, h5tools_dump_header_format->softlinkblockend);
- break;
+ switch (linfo.type) {
+ case H5L_TYPE_SOFT: /* Soft link */
+ begin_obj(h5tools_dump_header_format->softlinkbegin, links,
+ h5tools_dump_header_format->softlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ if (H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
+ }
+ else {
+ error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ end_obj(h5tools_dump_header_format->softlinkend,
+ h5tools_dump_header_format->softlinkblockend);
+ break;
- case H5L_TYPE_EXTERNAL:
- begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
- const char *elink_file;
- const char *elink_path;
-
- if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) {
- indentation(COL);
- PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
- indentation(COL);
- PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ case H5L_TYPE_EXTERNAL:
+ begin_obj(h5tools_dump_header_format->extlinkbegin, links,
+ h5tools_dump_header_format->extlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ if (H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ const char *elink_file;
+ const char *elink_path;
+
+ if (H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path) >= 0) {
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ }
+ else {
+ error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
}
else {
- error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- }
- else {
- error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
- h5tools_setstatus(EXIT_FAILURE);
- }
- end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
- break;
+ end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
+ break;
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
- PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
- end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
- break;
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ begin_obj(h5tools_dump_header_format->udlinkbegin, links,
+ h5tools_dump_header_format->udlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
+ end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
+ break;
} /* end switch */
HDfree(buf);
} /* end else */
@@ -1913,19 +1945,19 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
*-------------------------------------------------------------------------
*/
void
-handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name)
+handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
{
hid_t type_id;
- const char *real_name = display_name ? display_name : type;
+ const char *real_name = display_name ? display_name : type;
- if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
+ if ((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
/* check if type is unamed datatype */
unsigned idx = 0;
- while(idx < type_table->nobjs ) {
+ while (idx < type_table->nobjs) {
char name[128];
- if(!type_table->objs[idx].recorded) {
+ if (!type_table->objs[idx].recorded) {
char *obj_tok_str = NULL;
/* unamed datatype */
@@ -1933,28 +1965,30 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
HDsprintf(name, "/#%s", obj_tok_str);
H5free_memory(obj_tok_str);
- if(!HDstrcmp(name, real_name))
+ if (!HDstrcmp(name, real_name))
break;
} /* end if */
idx++;
} /* end while */
- if(idx == type_table->nobjs) {
+ if (idx == type_table->nobjs) {
if (pe) {
/* unknown type */
PRINTVALSTREAM(rawoutstream, "\n");
- begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin);
+ begin_obj(h5tools_dump_header_format->datatypebegin, real_name,
+ h5tools_dump_header_format->datatypeblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
error_msg("unable to open datatype \"%s\"\n", real_name);
- end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend);
+ end_obj(h5tools_dump_header_format->datatypeend,
+ h5tools_dump_header_format->datatypeblockend);
h5tools_setstatus(EXIT_FAILURE);
}
}
else {
hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT);
- type_id = H5Dget_type(dsetid);
+ type_id = H5Dget_type(dsetid);
dump_indent += COL;
dump_named_datatype(type_id, real_name);
@@ -1969,12 +2003,11 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
dump_named_datatype(type_id, real_name);
dump_indent -= COL;
- if(H5Tclose(type_id) < 0)
+ if (H5Tclose(type_id) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
}
-
/*-------------------------------------------------------------------------
* Function: dump_extlink
*
@@ -1990,9 +2023,9 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
{
hid_t oid;
H5O_info2_t oi;
- table_t *old_group_table = group_table;
- table_t *old_dset_table = dset_table;
- table_t *old_type_table = type_table;
+ table_t * old_group_table = group_table;
+ table_t * old_dset_table = dset_table;
+ table_t * old_type_table = type_table;
hbool_t old_hit_elink;
ssize_t idx;
@@ -2019,12 +2052,12 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
if (idx) {
/* Update table pointers */
group_table = table_list.tables[idx].group_table;
- dset_table = table_list.tables[idx].dset_table;
- type_table = table_list.tables[idx].type_table;
+ dset_table = table_list.tables[idx].dset_table;
+ type_table = table_list.tables[idx].type_table;
/* We will now traverse the external link, set this global to indicate this */
old_hit_elink = hit_elink;
- hit_elink = TRUE;
+ hit_elink = TRUE;
/* add some indentation to distinguish that these objects are external */
dump_indent += COL;
@@ -2054,8 +2087,8 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
/* Reset table pointers */
group_table = old_group_table;
- dset_table = old_dset_table;
- type_table = old_type_table;
+ dset_table = old_dset_table;
+ type_table = old_type_table;
/* Reset hit_elink */
hit_elink = old_hit_elink;
@@ -2069,4 +2102,3 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
fail:
return FAIL;
}
-
diff --git a/tools/src/h5dump/h5dump_ddl.h b/tools/src/h5dump/h5dump_ddl.h
index ae01086..00b7c46 100644
--- a/tools/src/h5dump/h5dump_ddl.h
+++ b/tools/src/h5dump/h5dump_ddl.h
@@ -20,17 +20,17 @@ extern "C" {
/* The dump functions of the dump_function_table */
/* standard format: no change */
-void dump_group(hid_t, const char *);
-void dump_named_datatype(hid_t, const char *);
-void dump_dataset(hid_t, const char *, struct subset_t *);
-void dump_dataspace(hid_t space);
-void dump_datatype(hid_t type);
-void dump_data(hid_t, int, struct subset_t *, int);
-void dump_fcpl(hid_t fid);
-void dump_fcontents(hid_t fid);
+void dump_group(hid_t, const char *);
+void dump_named_datatype(hid_t, const char *);
+void dump_dataset(hid_t, const char *, struct subset_t *);
+void dump_dataspace(hid_t space);
+void dump_datatype(hid_t type);
+void dump_data(hid_t, int, struct subset_t *, int);
+void dump_fcpl(hid_t fid);
+void dump_fcontents(hid_t fid);
/* callback function used by H5Aiterate2() */
-herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
+herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
/* other iteration functions */
void link_iteration(hid_t gid, unsigned crt_order_flags);
@@ -38,13 +38,16 @@ void attr_iteration(hid_t gid, unsigned attr_crt_order_flags);
void handle_paths(hid_t fid, const char *path_name, void *data, int pe, const char *display_name);
void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name);
-void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
+void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name);
void handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name);
-void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
-void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name);
+void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name);
+void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe,
+ const char *display_name);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_DDL_H__ */
+#endif /* !H5DUMP_DDL_H__ */
diff --git a/tools/src/h5dump/h5dump_defines.h b/tools/src/h5dump/h5dump_defines.h
index 7a9d4c0..669fae6 100644
--- a/tools/src/h5dump/h5dump_defines.h
+++ b/tools/src/h5dump/h5dump_defines.h
@@ -13,42 +13,41 @@
#ifndef H5DUMP_DEFINES_H__
#define H5DUMP_DEFINES_H__
-#define H5DUMP_MAX_RANK H5S_MAX_RANK
+#define H5DUMP_MAX_RANK H5S_MAX_RANK
-#define ATTRIBUTE_DATA 0
-#define DATASET_DATA 1
-#define ENUM_DATA 2
-#define COL 3
+#define ATTRIBUTE_DATA 0
+#define DATASET_DATA 1
+#define ENUM_DATA 2
+#define COL 3
/* Macros for displaying objects */
-#define begin_obj(obj,name,begin) \
- do { \
- if ((name)) { \
- PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
- } \
- else { \
- PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
- } \
- } while(0);
-
-#define end_obj(obj,end) \
- do { \
- if(HDstrlen(end)) { \
- PRINTSTREAM(rawoutstream, "%s", end); \
- if(HDstrlen(obj)) \
- PRINTVALSTREAM(rawoutstream, " "); \
- } \
- if(HDstrlen(obj)) \
- PRINTSTREAM(rawoutstream, "%s", obj); \
- } while(0);
+#define begin_obj(obj, name, begin) \
+ do { \
+ if ((name)) { \
+ PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
+ } \
+ else { \
+ PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
+ } \
+ } while (0);
+#define end_obj(obj, end) \
+ do { \
+ if (HDstrlen(end)) { \
+ PRINTSTREAM(rawoutstream, "%s", end); \
+ if (HDstrlen(obj)) \
+ PRINTVALSTREAM(rawoutstream, " "); \
+ } \
+ if (HDstrlen(obj)) \
+ PRINTSTREAM(rawoutstream, "%s", obj); \
+ } while (0);
/* 3 private values: can't be set, but can be read.
Note: these are defined in H5Zprivate, they are
duplicated here.
*/
-#define H5_SZIP_LSB_OPTION_MASK 8
-#define H5_SZIP_MSB_OPTION_MASK 16
-#define H5_SZIP_RAW_OPTION_MASK 128
+#define H5_SZIP_LSB_OPTION_MASK 8
+#define H5_SZIP_MSB_OPTION_MASK 16
+#define H5_SZIP_RAW_OPTION_MASK 128
-#endif /* !H5DUMP_DEFINES_H__ */
+#endif /* !H5DUMP_DEFINES_H__ */
diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h
index c615621..6ccd159 100644
--- a/tools/src/h5dump/h5dump_extern.h
+++ b/tools/src/h5dump/h5dump_extern.h
@@ -26,64 +26,65 @@
**/
/* the table of dump functions */
typedef struct dump_functions_t {
- void (*dump_group_function) (hid_t, const char *);
- void (*dump_named_datatype_function) (hid_t, const char *);
- void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
- void (*dump_dataspace_function) (hid_t);
- void (*dump_datatype_function) (hid_t);
- herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
- void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+ void (*dump_group_function)(hid_t, const char *);
+ void (*dump_named_datatype_function)(hid_t, const char *);
+ void (*dump_dataset_function)(hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function)(hid_t);
+ void (*dump_datatype_function)(hid_t);
+ herr_t (*dump_attribute_function)(hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function)(hid_t, int, struct subset_t *, int);
} dump_functions;
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_list_t {
- size_t nalloc;
- size_t nused;
+ size_t nalloc;
+ size_t nused;
struct {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
- } *tables;
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t * group_table; /* Table of groups */
+ table_t * dset_table; /* Table of datasets */
+ table_t * type_table; /* Table of datatypes */
+ } * tables;
} h5dump_table_list_t;
-extern h5dump_table_list_t table_list;
-extern table_t *group_table, *dset_table, *type_table;
+extern h5dump_table_list_t table_list;
+extern table_t * group_table, *dset_table, *type_table;
-extern unsigned dump_indent; /* how far in to indent the line */
-extern int unamedtype; /* shared datatype with no name */
-extern hbool_t hit_elink; /* whether we have traversed an external link */
-extern size_t prefix_len;
-extern char *prefix;
-extern const char *fp_format;
+extern unsigned dump_indent; /* how far in to indent the line */
+extern int unamedtype; /* shared datatype with no name */
+extern hbool_t hit_elink; /* whether we have traversed an external link */
+extern size_t prefix_len;
+extern char * prefix;
+extern const char *fp_format;
/* things to display or which are set via command line parameters */
typedef struct {
- int display_all;
- int display_oid;
- int display_data;
- int display_attr_data;
- int display_char; /* print 1-byte numbers as ASCII */
- int usingdasho;
- int display_bb; /* superblock */
- int display_dcpl; /* dcpl */
- int display_fi; /* file index */
- int display_ai; /* array index */
- int display_escape; /* escape non printable characters */
- int display_region; /* print region reference data */
- int disable_compact_subset; /* disable compact form of subset notation */
- int display_packed_bits; /* print 1-8 byte numbers as packed bits */
- int include_attrs; /* Display attributes */
- int display_vds_first; /* vds display to all by default */
- int vds_gap_size; /* vds skip missing files default is none */
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
} dump_opt_t;
extern dump_opt_t dump_opts;
-#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
-#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX 8 * sizeof(long long) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
-extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+extern unsigned long long
+ packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
extern unsigned packed_offset[PACKED_BITS_MAX];
@@ -99,13 +100,13 @@ extern const dump_functions *dump_function_table;
extern "C" {
#endif
-void add_prefix(char **prfx, size_t *prfx_len, const char *name);
-hid_t h5_fileaccess(void);
-ssize_t table_list_add(hid_t oid, unsigned long file_no);
-ssize_t table_list_visited(unsigned long file_no);
+void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+hid_t h5_fileaccess(void);
+ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ssize_t table_list_visited(unsigned long file_no);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_EXTERN_H__ */
+#endif /* !H5DUMP_EXTERN_H__ */
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 696841d..0457d32 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 */
" %" PRIuHADDR, /*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 = "&quot;";
-static const char *amp = "&amp;";
-static const char *lt = "&lt;";
-static const char *gt = "&gt;";
-static const char *apos = "&apos;";
+static const char *quote = "&quot;";
+static const char *amp = "&amp;";
+static const char *lt = "&lt;";
+static const char *gt = "&gt;";
+static const char *apos = "&apos;";
/*-------------------------------------------------------------------------
* Function: xml_escape_the_name
@@ -642,22 +650,22 @@ static const char *apos = "&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);
}
-
diff --git a/tools/src/h5dump/h5dump_xml.h b/tools/src/h5dump/h5dump_xml.h
index 3c59917..4798ea8 100644
--- a/tools/src/h5dump/h5dump_xml.h
+++ b/tools/src/h5dump/h5dump_xml.h
@@ -13,7 +13,7 @@
#ifndef H5DUMP_XML_H__
#define H5DUMP_XML_H__
-extern const char *xmlnsprefix;
+extern const char *xmlnsprefix;
#ifdef __cplusplus
extern "C" {
@@ -22,16 +22,16 @@ extern "C" {
/* The dump functions of the dump_function_table */
/* XML format: same interface, alternative output */
-void xml_dump_group(hid_t, const char *);
-void xml_dump_named_datatype(hid_t, const char *);
-void xml_dump_dataset(hid_t, const char *, struct subset_t *);
-void xml_dump_dataspace(hid_t space);
-void xml_dump_datatype(hid_t type);
-herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
-void xml_dump_data(hid_t, int, struct subset_t *, int);
+void xml_dump_group(hid_t, const char *);
+void xml_dump_named_datatype(hid_t, const char *);
+void xml_dump_dataset(hid_t, const char *, struct subset_t *);
+void xml_dump_dataspace(hid_t space);
+void xml_dump_datatype(hid_t type);
+herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
+void xml_dump_data(hid_t, int, struct subset_t *, int);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_XML_H__ */
+#endif /* !H5DUMP_XML_H__ */