summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
commit1ba1f2f3222cbe8df0bf601929a4bffd478d7e02 (patch)
treeae51dfc33cf40432dad25a5088767115a98f195e /tools/h5dump
parent8eef7d295cc3dd134aef0a826f1de4287629996d (diff)
downloadhdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.zip
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.gz
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.bz2
Source formatted
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/binread.c21
-rw-r--r--tools/h5dump/dynlib_dump.c54
-rw-r--r--tools/h5dump/h5dump.c1386
-rw-r--r--tools/h5dump/h5dump.h95
-rw-r--r--tools/h5dump/h5dump_ddl.c1449
-rw-r--r--tools/h5dump/h5dump_ddl.h29
-rw-r--r--tools/h5dump/h5dump_defines.h57
-rw-r--r--tools/h5dump/h5dump_extern.h93
-rw-r--r--tools/h5dump/h5dump_xml.c3052
-rw-r--r--tools/h5dump/h5dump_xml.h18
-rw-r--r--tools/h5dump/h5dumpgentest.c6048
11 files changed, 6324 insertions, 5978 deletions
diff --git a/tools/h5dump/binread.c b/tools/h5dump/binread.c
index 6165cd8..171a5fd 100644
--- a/tools/h5dump/binread.c
+++ b/tools/h5dump/binread.c
@@ -27,9 +27,9 @@
*/
-#define NELMTS 6
-#define TYPE int
-#define FORMAT "%d "
+#define NELMTS 6
+#define TYPE int
+#define FORMAT "%d "
/*-------------------------------------------------------------------------
* Function: usage
@@ -45,7 +45,7 @@
*-------------------------------------------------------------------------
*/
static void
-usage (void)
+usage(void)
{
fprintf(stderr, "usage: binread FILE_NAME\n");
}
@@ -59,13 +59,13 @@ usage (void)
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- FILE *stream;
+ FILE * stream;
size_t numread;
TYPE buf[NELMTS];
size_t i, nelmts = NELMTS;
- char *fname=NULL;
+ char * fname = NULL;
if (argc != 2) {
usage();
@@ -74,12 +74,12 @@ main (int argc, const char *argv[])
fname = strdup(argv[1]);
- if((stream = fopen(fname, "rb")) != NULL) {
- numread = fread(buf, sizeof( TYPE ), nelmts, stream);
+ if ((stream = fopen(fname, "rb")) != NULL) {
+ numread = fread(buf, sizeof(TYPE), nelmts, stream);
printf("Number of items read = %llu\n", (unsigned long long)numread);
for (i = 0; i < nelmts; i++) {
- printf(FORMAT,buf[i]);
+ printf(FORMAT, buf[i]);
}
printf("\n");
@@ -92,4 +92,3 @@ main (int argc, const char *argv[])
return 0;
}
-
diff --git a/tools/h5dump/dynlib_dump.c b/tools/h5dump/dynlib_dump.c
index 661a6dc..32d2daf 100644
--- a/tools/h5dump/dynlib_dump.c
+++ b/tools/h5dump/dynlib_dump.c
@@ -17,25 +17,33 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
+ "dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIBUD;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlibud
@@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
-
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 601e320..d80b33f 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -18,11 +18,11 @@
/* Name of tool */
#define PROGRAMNAME "h5dump"
-static const char *driver = NULL; /* The driver to open the file with. */
-const char *outfname=NULL;
-static int doxml = 0;
-static int useschema = 1;
-static const char *xml_dtd_uri = NULL;
+static const char *driver = NULL; /* The driver to open the file with. */
+const char * outfname = NULL;
+static int doxml = 0;
+static int useschema = 1;
+static const char *xml_dtd_uri = NULL;
#ifdef H5_HAVE_ROS3_VFD
static H5FD_ros3_fapl_t ros3_fa = {
@@ -46,38 +46,25 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
#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;
};
@@ -88,130 +75,127 @@ 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:";
-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' },
- { "s3-cred", require_arg, '$' },
- { "hdfs-attrs", require_arg, '#' },
- { 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:";
+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'},
+ {"s3-cred", require_arg, '$'},
+ {"hdfs-attrs", require_arg, '#'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: leave
@@ -229,7 +213,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -255,38 +238,55 @@ 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,
+ " Any absent attribute will use a default value.\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,
+ " Optional value 0 suppresses printing attributes.\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");
@@ -296,12 +296,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");
@@ -309,31 +314,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");
@@ -341,12 +359,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");
@@ -360,14 +383,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");
@@ -379,17 +404,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
*
@@ -401,28 +428,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;
@@ -432,10 +461,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
*
@@ -447,19 +475,18 @@ table_list_add(hid_t oid, unsigned long file_no)
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
*
@@ -471,12 +498,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 */
@@ -508,15 +535,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;
@@ -537,9 +564,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;
@@ -560,9 +587,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;
@@ -586,11 +613,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;
@@ -615,7 +642,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);
@@ -624,7 +651,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
ptr++;
}
d->data = p_list;
- d->len = size_count;
+ d->len = size_count;
}
/*-------------------------------------------------------------------------
@@ -640,7 +667,7 @@ static struct subset_t *
parse_subset_params(char *dset)
{
struct subset_t *s = NULL;
- char *brace;
+ char * brace;
if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
*brace++ = '\0';
@@ -695,11 +722,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. */
@@ -711,10 +738,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;
}
@@ -740,7 +767,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;
}
@@ -760,8 +787,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
@@ -777,7 +804,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;
}
@@ -788,13 +815,12 @@ parse_mask_list(const char *h_list)
}
return SUCCEED;
}
- else {
+ else {
error_msg("Bad mask list argument\n");
return FAIL;
}
}
-
/*-------------------------------------------------------------------------
* Function: free_handler
*
@@ -810,25 +836,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;
}
}
@@ -836,7 +862,6 @@ free_handler(struct handler_t *hand, int len)
}
}
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -851,20 +876,20 @@ 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 */
+ /* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
goto error;
}
/* 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;
}
@@ -872,61 +897,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':
- display_region = TRUE;
- region_output = TRUE;
- break;
- case 'B':
- display_bb = TRUE;
- last_was_dset = FALSE;
- break;
- case 'n':
- display_fi = TRUE;
- last_was_dset = FALSE;
- if (opt_arg != NULL)
- h5trav_set_verbose(HDatoi(opt_arg));
- break;
- case 'p':
- display_dcpl = TRUE;
- break;
- case 'y':
- display_ai = FALSE;
- break;
- case 'e':
- display_escape = TRUE;
- break;
- case 'H':
- display_data = FALSE;
- display_attr_data = FALSE;
- last_was_dset = FALSE;
- break;
- case 'A':
- if (opt_arg != NULL) {
- if(0 == HDatoi(opt_arg))
- include_attrs = FALSE;
- }
- else {
- display_data = FALSE;
- display_attr_data = TRUE;
+ case 'R':
+ display_region = TRUE;
+ region_output = TRUE;
+ break;
+ case 'B':
+ display_bb = TRUE;
last_was_dset = FALSE;
- }
- break;
- case 'i':
- display_oid = TRUE;
- last_was_dset = FALSE;
- break;
- case 'r':
- 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':
- {
+ break;
+ case 'n':
+ display_fi = TRUE;
+ last_was_dset = FALSE;
+ if (opt_arg != NULL)
+ h5trav_set_verbose(HDatoi(opt_arg));
+ break;
+ case 'p':
+ display_dcpl = TRUE;
+ break;
+ case 'y':
+ display_ai = FALSE;
+ break;
+ case 'e':
+ display_escape = TRUE;
+ break;
+ case 'H':
+ display_data = FALSE;
+ display_attr_data = FALSE;
+ last_was_dset = FALSE;
+ break;
+ case 'A':
+ if (opt_arg != NULL) {
+ if (0 == HDatoi(opt_arg))
+ include_attrs = FALSE;
+ }
+ else {
+ display_data = FALSE;
+ display_attr_data = TRUE;
+ last_was_dset = FALSE;
+ }
+ break;
+ case 'i':
+ display_oid = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'r':
+ 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)
@@ -934,364 +958,363 @@ parse_start:
else
h5tools_nCols = (unsigned)sh5tools_nCols;
last_was_dset = FALSE;
- }
- break;
- case 'N':
- 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':
- display_all = 0;
+ } break;
+ case 'N':
+ 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':
+ 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':
- 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':
+ 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 = opt_arg;
- break;
- case 'g':
- 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 = opt_arg;
+ break;
+ case 'g':
+ 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':
- display_all = 0;
+ last_was_dset = FALSE;
+ break;
+ case 'l':
+ 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':
+ 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':
- 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 (display_attr_data && !display_data) {
+ if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ if (display_data || 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;
+ usingdasho = TRUE;
+ last_was_dset = FALSE;
+ outfname = 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(display_attr_data && !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(display_data || display_all) {
- if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ bin_output = TRUE;
+ if (outfname != NULL) {
+ if (h5tools_set_data_output_file(outfname, 1) < 0) {
+ /* failed to set output file */
usage(h5tools_getprogname());
goto error;
}
+
+ last_was_dset = FALSE;
}
- }
+ break;
- usingdasho = TRUE;
- last_was_dset = FALSE;
- outfname = 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!=NULL) {
- if (h5tools_set_data_output_file(outfname, 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;
}
+ display_packed_bits = TRUE;
+ break;
- last_was_dset = FALSE;
- }
- break;
+ /** begin XML parameters **/
+ case 'x':
+ /* select XML output */
+ doxml = TRUE;
+ useschema = TRUE;
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'u':
+ doxml = TRUE;
+ useschema = 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 = 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) {
+ 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;
- }
- display_packed_bits = TRUE;
- break;
-
- /** begin XML parameters **/
- case 'x':
- /* select XML output */
- doxml = TRUE;
- useschema = TRUE;
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'u':
- doxml = TRUE;
- useschema = 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 = 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) {
- 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;
+ 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->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;
- }
- } 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;
+ last_was_dset = FALSE;
- if (opt != EOF)
- goto parse_start;
- else
- goto parse_end;
- }
- /** end subsetting parameters **/
+ if (opt != EOF)
+ goto parse_start;
+ else
+ goto parse_end;
+ }
+ /** end subsetting parameters **/
- case 'E':
- if (opt_arg != NULL)
- enable_error_stack = HDatoi(opt_arg);
- else
- enable_error_stack = 1;
- break;
- case 'C':
- disable_compact_subset = TRUE;
- break;
- case 'h':
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
+ case 'E':
+ if (opt_arg != NULL)
+ enable_error_stack = HDatoi(opt_arg);
+ else
+ enable_error_stack = 1;
+ break;
+ case 'C':
+ disable_compact_subset = TRUE;
+ break;
+ case 'h':
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
- case '$':
+ case '$':
#ifndef H5_HAVE_ROS3_VFD
- 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;
#else
- /* s3 credential */
- {
- char **s3_cred = NULL;
- char *s3_cred_string = NULL;
- const char *ccred[3];
- unsigned nelems = 0;
- if (FAIL == parse_tuple(opt_arg, ',', &s3_cred_string, &nelems, &s3_cred)) {
- error_msg("unable to parse malformed s3 credentials\n");
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
- }
- if (nelems != 3) {
- error_msg("s3 credentials expects 3 elements\n");
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
- }
- ccred[0] = (const char *)s3_cred[0];
- ccred[1] = (const char *)s3_cred[1];
- ccred[2] = (const char *)s3_cred[2];
- if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) {
- error_msg("Invalid S3 credentials\n");
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
- }
- HDfree(s3_cred);
- HDfree(s3_cred_string);
- } /* s3 credential block */
- break;
+ /* s3 credential */
+ {
+ char ** s3_cred = NULL;
+ char * s3_cred_string = NULL;
+ const char *ccred[3];
+ unsigned nelems = 0;
+ if (FAIL == parse_tuple(opt_arg, ',', &s3_cred_string, &nelems, &s3_cred)) {
+ error_msg("unable to parse malformed s3 credentials\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ if (nelems != 3) {
+ error_msg("s3 credentials expects 3 elements\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ ccred[0] = (const char *)s3_cred[0];
+ ccred[1] = (const char *)s3_cred[1];
+ ccred[2] = (const char *)s3_cred[2];
+ if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) {
+ error_msg("Invalid S3 credentials\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ HDfree(s3_cred);
+ HDfree(s3_cred_string);
+ } /* s3 credential block */
+ break;
#endif /* H5_HAVE_ROS3_VFD */
- case '#':
+ case '#':
#ifndef H5_HAVE_LIBHDFS
- error_msg("HDFS VFD is not enabled.\n");
- goto error;
+ error_msg("HDFS VFD is not enabled.\n");
+ goto error;
#else
{
/* read hdfs properties tuple and store values in `hdfs_fa` */
- unsigned nelems = 0;
- char *props_src = NULL;
- char **props = NULL;
- unsigned long k = 0;
+ unsigned nelems = 0;
+ char *props_src = NULL;
+ char **props = NULL;
+ unsigned long k = 0;
if (FAIL == parse_tuple((const char *)opt_arg, ',', &props_src, &nelems, &props)) {
error_msg("unable to parse hdfs properties tuple\n");
goto error;
@@ -1337,12 +1360,12 @@ end_collect:
HDfree(props_src);
}
#endif /* H5_HAVE_LIBHDFS */
- break;
+ break;
- case '?':
- default:
- usage(h5tools_getprogname());
- goto error;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ goto error;
}
}
@@ -1366,7 +1389,6 @@ error:
return hand;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1379,24 +1401,24 @@ 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;
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- H5O_info_t oi;
- struct handler_t *hand = NULL;
- int i;
- unsigned u;
- void *edata;
- void *tools_edata;
- char *fname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
+ H5E_auto2_t func;
+ H5E_auto2_t tools_func;
+ H5O_info_t oi;
+ struct handler_t *hand = NULL;
+ int i;
+ unsigned u;
+ void * edata;
+ void * tools_edata;
+ 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;
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
@@ -1409,7 +1431,7 @@ main(int argc, const char *argv[])
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
- if((hand = parse_command_line(argc, argv))==NULL) {
+ if ((hand = parse_command_line(argc, argv)) == NULL) {
goto done;
}
@@ -1506,7 +1528,7 @@ main(int argc, const char *argv[])
}
} /* driver defined */
- while(opt_ind < argc) {
+ while (opt_ind < argc) {
fname = HDstrdup(argv[opt_ind++]);
if (fapl_id != H5P_DEFAULT) {
@@ -1528,7 +1550,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) {
+ if (doxml) {
/* initialize XML */
/* reset prefix! */
HDstrcpy(prefix, "");
@@ -1544,8 +1566,9 @@ main(int argc, const char *argv[])
}
}
else {
- if (useschema && HDstrcmp(xmlnsprefix,"")) {
- error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+ if (useschema && 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;
}
@@ -1553,21 +1576,21 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name(fid, "/", &oi, 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++)
@@ -1578,35 +1601,42 @@ main(int argc, const char *argv[])
/* start to dump - display file header information */
if (!doxml) {
- 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) {
- if (HDstrcmp(xmlnsprefix,"") == 0) {
- PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri);
+ if (HDstrcmp(xmlnsprefix, "") == 0) {
+ PRINTSTREAM(rawoutstream,
+ "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:noNamespaceSchemaLocation=\"%s\">\n",
+ xml_dtd_uri);
}
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);
+ PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
+ xml_dtd_uri);
PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n");
}
}
@@ -1615,7 +1645,7 @@ main(int argc, const char *argv[])
if (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;
}
@@ -1624,36 +1654,35 @@ main(int argc, const char *argv[])
dump_fcpl(fid);
}
- if(display_all) {
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if (display_all) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
if (!doxml)
dump_indent += COL;
- dump_function_table->dump_group_function(gid, "/" );
+ dump_function_table->dump_group_function(gid, "/");
if (!doxml)
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) {
+ if (doxml) {
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);
}
}
@@ -1670,21 +1699,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 */
@@ -1702,20 +1731,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 */
@@ -1725,7 +1754,6 @@ done:
leave(h5tools_getstatus());
} /* main */
-
/*-------------------------------------------------------------------------
* Function: init_prefix
*
@@ -1740,13 +1768,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
*
@@ -1762,12 +1789,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/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index cf4c8c1..da156d6 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -26,60 +26,60 @@
**/
/* 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;
-unsigned dump_indent = 0; /*how far in to indent the line */
+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;
+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 */
-int display_all = TRUE;
-int display_oid = FALSE;
-int display_data = TRUE;
-int display_attr_data = TRUE;
-int display_char = FALSE; /*print 1-byte numbers as ASCII */
-int usingdasho = FALSE;
-int display_bb = FALSE; /*superblock */
-int display_dcpl = FALSE; /*dcpl */
-int display_fi = FALSE; /*file index */
-int display_ai = TRUE; /*array index */
-int display_escape = FALSE; /*escape non printable characters */
-int display_region = FALSE; /*print region reference data */
-int disable_compact_subset= FALSE; /* disable compact form of subset notation */
-int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
-int include_attrs = TRUE; /* Display attributes */
+int display_all = TRUE;
+int display_oid = FALSE;
+int display_data = TRUE;
+int display_attr_data = TRUE;
+int display_char = FALSE; /*print 1-byte numbers as ASCII */
+int usingdasho = FALSE;
+int display_bb = FALSE; /*superblock */
+int display_dcpl = FALSE; /*dcpl */
+int display_fi = FALSE; /*file index */
+int display_ai = TRUE; /*array index */
+int display_escape = FALSE; /*escape non printable characters */
+int display_region = FALSE; /*print region reference data */
+int disable_compact_subset = FALSE; /* disable compact form of subset notation */
+int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
+int include_attrs = TRUE; /* Display attributes */
-#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];
@@ -92,16 +92,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/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c
index be0f723..089f909 100644
--- a/tools/h5dump/h5dump_ddl.c
+++ b/tools/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_info_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_info_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 = display_ai;
- ctx.display_char = display_char;
+ ctx.display_char = display_char;
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = display_oid;
- data_output = display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = display_oid;
+ data_output = display_data;
attr_data_output = 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 = 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_info_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 = 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,341 +198,355 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ if (linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
- switch(oinfo.type) {
- case H5O_TYPE_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump group \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- char *old_prefix; /* Pointer to previous prefix */
-
- /* Keep copy of prefix before iterating into group */
- 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);
-
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_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
- error_msg("warning: null prefix\n");
+ else {
+ char *old_prefix; /* Pointer to previous prefix */
- /* Close group */
- H5Gclose(obj);
- }
- break;
+ /* 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);
- case H5O_TYPE_DATASET:
- if((obj = H5Dopen2(group, name, dapl_id)) >= 0) {
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- found_obj = search_obj(dset_table, oinfo.addr);
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+ }
+ else
+ error_msg("warning: null prefix\n");
- if(found_obj == NULL) {
- ctx.indent_level++;
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- ctx.need_prefix = TRUE;
+ case H5O_TYPE_DATASET:
+ 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.addr);
+
+ if (found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ 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 */
- /* 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);
+ 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;
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ 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;
- ctx.need_prefix = TRUE;
+ 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;
- /* 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);
+ 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.indent_level--;
+ /* 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++;
+ 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;
+ 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);
}
- 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);
- }
- 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;
- 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;
+ ctx.indent_level--;
- 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;
-
- 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++;
+ 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.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++;
+ 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);
- 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);
-
- break;
+ break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -551,19 +564,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(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 (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 */
}
}
@@ -581,7 +594,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))
H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
@@ -600,11 +613,11 @@ dump_named_datatype(hid_t tid, const char *name)
{
H5O_info_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 */
@@ -612,24 +625,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 = 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");
@@ -642,7 +655,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);
}
@@ -651,18 +664,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_info(tid, &oinfo);
/* 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.addr);
@@ -675,7 +688,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
@@ -686,11 +700,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;
@@ -702,14 +717,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);
}
@@ -725,18 +741,18 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info_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_info_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");
@@ -750,12 +766,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);
}
@@ -765,53 +781,53 @@ dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
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) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
}
} /* end if */
- if(display_oid)
+ if (display_oid)
h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
@@ -821,8 +837,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.addr);
@@ -836,7 +852,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;
@@ -856,14 +873,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);
}
@@ -879,35 +897,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 = 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");
@@ -926,19 +944,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;
@@ -947,74 +965,74 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
H5Sclose(space);
- if(display_oid) {
+ if (display_oid) {
h5tools_dump_oid(rawoutstream, outputformat, &ctx, did);
}
- if(display_dcpl) {
+ if (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 = display_ai;
- ctx.display_char = display_char;
- if(display_data) {
- unsigned data_loop = 1;
- unsigned u;
+ ctx.display_char = display_char;
+ if (display_data) {
+ unsigned data_loop = 1;
+ unsigned u;
- if(display_packed_bits)
+ if (display_packed_bits)
data_loop = packed_bits_num;
- for(u = 0; u < data_loop; u++) {
- if(display_packed_bits) {
+ for (u = 0; u < data_loop; u++) {
+ if (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);
@@ -1029,14 +1047,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);
}
@@ -1052,8 +1071,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;
@@ -1061,32 +1080,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 = 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 = display_char;
+ ctx.display_char = 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
*
@@ -1107,91 +1125,91 @@ dump_fcpl(hid_t fid)
unsigned stab; /* symbol table entry version # */
unsigned shhdr; /* shared object header version # */
#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 */
unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
- fcpl=H5Fget_create_plist(fid);
+ fcpl = H5Fget_create_plist(fid);
H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
- 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);
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", super);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SUPERBLOCK_VERSION", super);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", freelist);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "FREELIST_VERSION", freelist);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", stab);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SYMBOLTABLE_VERSION", stab);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", shhdr);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "OBJECTHEADER_VERSION", shhdr);
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);
/*-------------------------------------------------------------------------
- * 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 %Hu\n","USERBLOCK_SIZE", userblock);
+ PRINTSTREAM(rawoutstream, "%s %Hu\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);
}
/*-------------------------------------------------------------------------
@@ -1205,7 +1223,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) {
@@ -1213,59 +1231,60 @@ dump_fcontents(hid_t fid)
for (u = 0; u < type_table->nobjs; u++) {
if (!type_table->objs[u].recorded)
- PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ PRINTSTREAM(rawoutstream, " %-10s /#" H5_PRINTF_HADDR_FMT "\n", "datatype",
+ type_table->objs[u].objno);
}
}
/* 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);
@@ -1282,16 +1301,17 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
static herr_t
obj_search(const char *path, const H5O_info_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;
@@ -1318,19 +1338,19 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
static herr_t
lnk_search(const char *path, const H5L_info_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);
}
@@ -1343,20 +1363,20 @@ lnk_search(const char *path, const H5L_info_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);
@@ -1373,19 +1393,20 @@ lnk_search(const char *path, const H5L_info_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");
@@ -1399,19 +1420,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) < 0) {
+ if (h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) {
error_msg("error traversing information\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1427,33 +1448,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);
@@ -1462,32 +1484,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 = display_ai;
- ctx.display_char = display_char;
+ ctx.display_char = 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 = 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));
@@ -1495,45 +1517,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 = display_oid;
- data_output = display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = display_oid;
+ data_output = display_data;
attr_data_output = 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 */
@@ -1544,16 +1567,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;
}
@@ -1570,56 +1595,56 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
{
H5O_info_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((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;
}
@@ -1629,22 +1654,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;
@@ -1654,29 +1679,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_info(dsetid, &oinfo);
- 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.addr);
- 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);
@@ -1700,7 +1725,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);
}
@@ -1716,12 +1741,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);
@@ -1732,9 +1758,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);
@@ -1743,7 +1769,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() */
@@ -1757,15 +1783,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_info_t linfo;
- if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if (H5Lget_info(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);
}
@@ -1773,56 +1800,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 */
@@ -1837,44 +1868,46 @@ 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) {
/* unamed datatype */
- HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ HDsprintf(name, "/#" H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
- 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);
@@ -1889,12 +1922,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
*
@@ -1908,13 +1940,13 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
static int
dump_extlink(hid_t group, const char *linkname, const char *objname)
{
- hid_t oid;
- H5O_info_t oi;
- 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;
+ hid_t oid;
+ H5O_info_t oi;
+ 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;
/* Open target object */
if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0)
@@ -1939,12 +1971,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;
@@ -1973,8 +2005,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;
@@ -1988,4 +2020,3 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
fail:
return FAIL;
}
-
diff --git a/tools/h5dump/h5dump_ddl.h b/tools/h5dump/h5dump_ddl.h
index ae01086..00b7c46 100644
--- a/tools/h5dump/h5dump_ddl.h
+++ b/tools/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/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h
index 7a9d4c0..669fae6 100644
--- a/tools/h5dump/h5dump_defines.h
+++ b/tools/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/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h
index ae65174..b45fed1 100644
--- a/tools/h5dump/h5dump_extern.h
+++ b/tools/h5dump/h5dump_extern.h
@@ -26,59 +26,60 @@
**/
/* 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 unsigned dump_indent; /*how far in to indent the line */
+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 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 */
-extern int display_all;
-extern int display_oid;
-extern int display_data;
-extern int display_attr_data;
-extern int display_char; /*print 1-byte numbers as ASCII */
-extern int usingdasho;
-extern int display_bb; /*superblock */
-extern int display_dcpl; /*dcpl */
-extern int display_fi; /*file index */
-extern int display_ai; /*array index */
-extern int display_escape; /*escape non printable characters */
-extern int display_region; /*print region reference data */
-extern int disable_compact_subset; /* disable compact form of subset notation */
-extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/
-extern int include_attrs; /* Display attributes */
+extern int display_all;
+extern int display_oid;
+extern int display_data;
+extern int display_attr_data;
+extern int display_char; /*print 1-byte numbers as ASCII */
+extern int usingdasho;
+extern int display_bb; /*superblock */
+extern int display_dcpl; /*dcpl */
+extern int display_fi; /*file index */
+extern int display_ai; /*array index */
+extern int display_escape; /*escape non printable characters */
+extern int display_region; /*print region reference data */
+extern int disable_compact_subset; /* disable compact form of subset notation */
+extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/
+extern int include_attrs; /* Display attributes */
-#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];
@@ -94,13 +95,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/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index a484ff4..bfbaa48 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/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,52 +34,53 @@ const char *xmlnsprefix="hdf5:";
*
* This table only affects XML output.
*/
-static h5tool_format_t xml_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%hhd", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "", /*arr_pre */
- "", /*arr_sep */
- "", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- "", /*cmpd_sep */
- "", /*cmpd_pre */
- "", /*cmpd_suf */
- "", /*cmpd_end */
-
- " ", /*vlen_sep */
- " ", /*vlen_pre */
- "", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- "", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- "", /*idx_n_fmt */
- "", /*idx_sep */
- "", /*idx_fmt */
-
- 80, /*line_ncols *//*standard default columns */
+static h5tool_format_t xml_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "", /*arr_pre */
+ "", /*arr_sep */
+ "", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ "", /*cmpd_sep */
+ "", /*cmpd_pre */
+ "", /*cmpd_suf */
+ "", /*cmpd_end */
+
+ " ", /*vlen_sep */
+ " ", /*vlen_pre */
+ "", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ "", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80,
+ /*line_ncols */ /*standard default columns */
0, /*line_per_line */
"", /*line_pre */
"%s", /*line_1st */
@@ -89,31 +90,30 @@ static h5tool_format_t xml_dataformat = {
1, /*line_multi_new */
" ", /*line_indent */
- 1, /*skip_first */
+ 1, /*skip_first */
- 1, /*obj_hidefileno */
- " "H5_PRINTF_HADDR_FMT, /*obj_format */
+ 1, /*obj_hidefileno */
+ " " H5_PRINTF_HADDR_FMT, /*obj_format */
- 1, /*dset_hidefileno */
- "DATASET %s ", /*dset_format */
- "%s", /*dset_blockformat_pre */
- "%s", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
- 0, /*array indices */
- 0 /*escape non printable characters */
+ 1, /*dset_hidefileno */
+ "DATASET %s ", /*dset_format */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 0, /*array indices */
+ 0 /*escape non printable characters */
};
-
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(const char *, char *, int, int);
/* internal functions used by XML option */
-static void xml_print_datatype(hid_t, unsigned);
-static void xml_print_enum(hid_t);
-static int xml_print_refs(hid_t, int);
-static int xml_print_strs(hid_t, int);
-static char *xml_escape_the_string(const char *, int);
-static char *xml_escape_the_name(const char *);
+static void xml_print_datatype(hid_t, unsigned);
+static void xml_print_enum(hid_t);
+static int xml_print_refs(hid_t, int);
+static int xml_print_strs(hid_t, int);
+static char *xml_escape_the_string(const char *, int);
+static char *xml_escape_the_name(const char *);
/*-------------------------------------------------------------------------
* Function: xml_dump_all_cb
@@ -132,41 +132,41 @@ static herr_t
xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
- herr_t ret = SUCCEED;
- char *obj_path = NULL; /* Full path of object */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ herr_t ret = SUCCEED;
+ char * obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
- string_dataformat.line_ncols = 65535;
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
/* Build the object's path name */
obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
- if(!obj_path) {
+ if (!obj_path) {
ret = FAIL;
goto done;
}
@@ -175,354 +175,361 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ if (linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
- switch(oinfo.type) {
- case H5O_TYPE_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump group \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- char *old_prefix; /* Pointer to previous prefix */
-
- /* Keep copy of prefix before iterating into group */
- if((old_prefix = HDstrdup(prefix)) == NULL) {
- error_msg("unable to allocate buffer\n");
+ switch (oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if ((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
-
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
-
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
- }
-
- /* Close group */
- H5Gclose(obj);
- }
- break;
-
- case H5O_TYPE_DATASET:
- if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
-
- found_obj = search_obj(dset_table, oinfo.addr);
-
- if(found_obj == NULL) {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
+ char *old_prefix; /* Pointer to previous prefix */
+ /* Keep copy of prefix before iterating into group */
+ if ((old_prefix = HDstrdup(prefix)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- H5Dclose(obj);
- goto done;
}
- else if(found_obj->displayed) {
- /* the XML version */
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_objname = xml_escape_the_name(found_obj->objname);
- char dsetxid[100];
- char parentxid[100];
- char pointerxid[100];
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
- "H5Path=\"%s\" Parents=\"%s\" "
- "H5ParentPaths=\"%s\">",
- xmlnsprefix,
- t_name, /* Dataset Name */
- dsetxid, get_next_xid(), /* OBJ-XID */
- t_obj_path, /* H5Path */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
- xmlnsprefix,
- pointerxid,t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
-
- /* 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.addr);
+
+ if (found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ H5Dclose(obj);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ /* the XML version */
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+ char dsetxid[100];
+ char parentxid[100];
+ char pointerxid[100];
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
+ "H5Path=\"%s\" Parents=\"%s\" "
+ "H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, /* Dataset Name */
+ dsetxid, get_next_xid(), /* OBJ-XID */
+ t_obj_path, /* H5Path */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
+ xmlnsprefix, pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ HDfree(t_prefix);
+ HDfree(t_objname);
+
+ H5Dclose(obj);
+ goto done;
+ }
+ else
+ found_obj->displayed = TRUE;
+ } /* end if */
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- error_msg("unknown object \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- } /* end if */
- else {
- char *targbuf;
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ H5Dclose(obj);
+ }
+ else {
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ break;
- switch(linfo->type) {
- case H5L_TYPE_SOFT:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ case H5O_TYPE_NAMED_DATATYPE:
+ if ((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* XML */
- char linkxid[100];
- char parentxid[100];
- char targetxid[100];
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_targbuf = xml_escape_the_name(targbuf);
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_link_path;
- int res;
-
- t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
- if(targbuf[0] == '/')
- HDstrcpy(t_link_path, targbuf);
- else {
- HDstrcpy(t_link_path, prefix);
- HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
- } /* end else */
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
-
- /* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
- if (res == 0) {
- /* target obj found */
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" TargetObj=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- targetxid, /* TargetObj */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- /* dangling link -- omit from xml attributes */
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_targbuf);
- HDfree(t_obj_path);
- HDfree(t_link_path);
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
}
+ break;
- HDfree(targbuf);
- }
- break;
-
- case H5L_TYPE_EXTERNAL:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- }
- else {
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get external link value\n");
+ }
+ } /* end if */
+ else {
+ char *targbuf;
+
+ switch (linfo->type) {
+ case H5L_TYPE_SOFT:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- const char *filename;
- const char *targname;
-
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- error_msg("unable to unpack external link value\n");
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ /* print the value of a soft link */
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_filename = xml_escape_the_name(filename);
- char *t_targname = xml_escape_the_name(targname);
+ char *t_link_path;
+ int res;
+
+ t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ if (targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
/* Create OBJ-XIDs for the parent and object */
xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetFilename=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- filename, /* TargetFilename */
- targname, /* TargetPath*/
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" TargetObj=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* dangling link -- omit from xml attributes */
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
HDfree(t_prefix);
HDfree(t_name);
- HDfree(t_filename);
- HDfree(t_targname);
+ HDfree(t_targbuf);
HDfree(t_obj_path);
- } /* end else */
- } /* end else */
- HDfree(targbuf);
- }
- break;
+ HDfree(t_link_path);
+ }
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ HDfree(targbuf);
+ }
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
+ HDfree(t_obj_path);
+ } /* end else */
+ } /* end else */
+ HDfree(targbuf);
+ }
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default: {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
char *t_obj_path = xml_escape_the_name(obj_path);
/* Create OBJ-XIDs for the parent and object */
@@ -533,34 +540,34 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "LinkClass=\"%d\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- linfo->type, /* LinkClass */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sUserDefined LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "LinkClass=\"%d\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ linfo->type, /* LinkClass */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_prefix);
HDfree(t_name);
HDfree(t_obj_path);
- }
- break;
+ } break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -573,11 +580,12 @@ done:
* 1 - generate a fake entry and return fake id.
*/
int
-xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+xml_name_to_XID(const char *str, char *outstr, int outlen, int gen)
{
- haddr_t objno; /* Object ID for object at path */
+ haddr_t objno; /* Object ID for object at path */
- if (outlen < 22) return 1;
+ if (outlen < 22)
+ return 1;
objno = ref_path_table_lookup(str);
if (objno == HADDR_UNDEF) {
@@ -586,7 +594,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
if (objno == HADDR_UNDEF) {
if (gen) {
objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -597,7 +605,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
else {
if (gen) {
objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -606,16 +614,16 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
- return(0);
+ 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
@@ -628,22 +636,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++) {
@@ -664,12 +672,12 @@ xml_escape_the_name(const char *str)
if (extra == 0)
return HDstrdup(str);
- cp = str;
+ cp = str;
ncp_len = len + extra + 1;
rcp = ncp = (char *)HDmalloc(ncp_len);
if (!ncp)
- return NULL; /* ?? */
+ return NULL; /* ?? */
for (i = 0; i < len; i++) {
size_t esc_len;
@@ -695,7 +703,7 @@ xml_escape_the_name(const char *str)
esc_len = HDstrlen(amp);
}
else {
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
ncp += esc_len;
@@ -718,15 +726,15 @@ xml_escape_the_name(const char *str)
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
-static char *
+static char *
xml_escape_the_string(const char *str, int slen)
{
size_t extra;
size_t len;
size_t i;
const char *cp;
- char *ncp;
- char *rcp;
+ char * ncp;
+ char * rcp;
size_t ncp_len;
if (!str)
@@ -757,9 +765,9 @@ xml_escape_the_string(const char *str, int slen)
cp++;
}
- cp = str;
+ cp = str;
ncp_len = len + extra + 1;
- rcp = ncp = (char *) HDcalloc(ncp_len, sizeof(char));
+ rcp = ncp = (char *)HDcalloc(ncp_len, sizeof(char));
if (ncp == NULL)
return NULL; /* ?? */
@@ -768,13 +776,13 @@ xml_escape_the_string(const char *str, int slen)
size_t esc_len;
if (*cp == '\\') {
- *ncp++ = '\\';
- *ncp = *cp;
+ *ncp++ = '\\';
+ *ncp = *cp;
esc_len = 1;
}
else if (*cp == '\"') {
- *ncp++ = '\\';
- *ncp = *cp;
+ *ncp++ = '\\';
+ *ncp = *cp;
esc_len = 1;
}
else if (*cp == '\'') {
@@ -794,7 +802,7 @@ xml_escape_the_string(const char *str, int slen)
HDstrncpy(ncp, amp, esc_len);
}
else {
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
ncp += esc_len;
@@ -825,69 +833,69 @@ xml_escape_the_string(const char *str, int slen)
static void
xml_print_datatype(hid_t type, unsigned in_group)
{
- char *mname;
- hid_t mtype;
- unsigned nmembers;
- unsigned ndims;
- unsigned i;
- size_t size;
- hsize_t dims[H5DUMP_MAX_RANK];
- H5T_str_t str_pad;
- H5T_cset_t cset;
- hid_t super;
- H5T_order_t ord;
- H5T_sign_t sgn;
- size_t sz;
- size_t spos;
- size_t epos;
- size_t esize;
- size_t mpos;
- size_t msize;
- int nmembs;
- htri_t is_vlstr = FALSE;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ char * mname;
+ hid_t mtype;
+ unsigned nmembers;
+ unsigned ndims;
+ unsigned i;
+ size_t size;
+ hsize_t dims[H5DUMP_MAX_RANK];
+ H5T_str_t str_pad;
+ H5T_cset_t cset;
+ hid_t super;
+ H5T_order_t ord;
+ H5T_sign_t sgn;
+ size_t sz;
+ size_t spos;
+ size_t epos;
+ size_t esize;
+ size_t mpos;
+ size_t msize;
+ int nmembs;
+ htri_t is_vlstr = FALSE;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
- string_dataformat.line_ncols = 65535;
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- if(!in_group && H5Tcommitted(type) > 0) {
+ if (!in_group && H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
- obj_t *found_obj; /* Found object */
+ obj_t * found_obj; /* Found object */
/* detect a shared datatype, output only once */
H5Oget_info(type, &oinfo);
found_obj = search_obj(type_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
/* This should be defined somewhere else */
/* These 2 cases are handled the same right now, but
probably will have something different eventually */
- char * dtxid = (char *)HDmalloc((size_t)100);
+ char *dtxid = (char *)HDmalloc((size_t)100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -898,9 +906,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>",
- xmlnsprefix, dtxid);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* point to the NDT by name */
@@ -910,9 +918,10 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
- xmlnsprefix, dtxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix,
+ dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
}
HDfree(dtxid);
@@ -923,7 +932,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
}
}
@@ -934,8 +944,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
/* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
@@ -946,7 +957,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
h5tools_str_append(&buffer, "LE");
@@ -983,15 +994,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
sz = H5Tget_size(type);
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
h5tools_str_append(&buffer, "\" />");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_FLOAT:
@@ -1005,15 +1018,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
@@ -1037,17 +1051,21 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
- h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
- h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ",
+ (unsigned long)esize, (unsigned long)epos);
+ h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />",
+ (unsigned long)msize, (unsigned long)mpos);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_TIME:
@@ -1055,16 +1073,18 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sTimeType />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->");
ctx.indent_level--;
@@ -1072,23 +1092,25 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_STRING:
/* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
- size = H5Tget_size(type);
- str_pad = H5Tget_strpad(type);
- cset = H5Tget_cset(type);
+ size = H5Tget_size(type);
+ str_pad = H5Tget_strpad(type);
+ cset = H5Tget_cset(type);
is_vlstr = H5Tis_variable_str(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -1096,17 +1118,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sStringType Cset=\"", xmlnsprefix);
if (cset == H5T_CSET_ASCII)
h5tools_str_append(&buffer, "H5T_CSET_ASCII\" ");
else
h5tools_str_append(&buffer, "unknown_cset\" ");
- if(is_vlstr)
+ if (is_vlstr)
h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\"");
else
- h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size);
+ h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int)size);
if (str_pad == H5T_STR_NULLTERM)
h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>");
@@ -1116,15 +1138,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>");
else
h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_BITFIELD:
@@ -1135,15 +1159,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
@@ -1162,15 +1187,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
size = H5Tget_size(type);
h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_OPAQUE:
@@ -1180,8 +1207,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
mname = H5Tget_tag(type);
@@ -1189,19 +1217,21 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname);
+ h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ", xmlnsprefix, mname);
H5free_memory(mname);
size = H5Tget_size(type);
h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_COMPOUND:
@@ -1214,8 +1244,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sCompoundType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* List each member Field of the type */
/* <hdf5:Field FieldName="name" > */
@@ -1225,16 +1256,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
for (i = 0; i < nmembers; i++) {
char *t_fname;
- mname = H5Tget_member_name(type, i);
- mtype = H5Tget_member_type(type, i);
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
t_fname = xml_escape_the_name(mname);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">", xmlnsprefix, t_fname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5free_memory(mname);
HDfree(t_fname);
@@ -1245,11 +1277,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(mtype,0);
+ xml_print_datatype(mtype, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1257,8 +1290,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1266,8 +1300,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sField>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sField>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
dump_indent -= COL;
ctx.indent_level--;
@@ -1276,8 +1311,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sCompoundType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_REFERENCE:
@@ -1285,8 +1321,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
/* Only Object references supported at this time */
@@ -1294,32 +1331,36 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sReferenceType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sObjectReferenceType />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sReferenceType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_ENUM:
@@ -1330,8 +1371,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
@@ -1339,16 +1381,18 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">", xmlnsprefix, nmembs);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
xml_print_enum(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1356,8 +1400,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_VLEN:
@@ -1365,8 +1410,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sVLType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
super = H5Tget_super(type);
dump_indent += COL;
ctx.indent_level++;
@@ -1375,11 +1421,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1387,8 +1434,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1396,8 +1444,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sVLType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Tclose(super);
break;
@@ -1411,10 +1460,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);
@@ -1426,8 +1476,10 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix,
+ (int)dims[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
@@ -1438,11 +1490,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1450,8 +1503,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1459,8 +1513,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sArrayType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Close array base type */
H5Tclose(super);
break;
@@ -1473,7 +1528,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- unknown datatype -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
break;
}
@@ -1495,48 +1551,48 @@ xml_print_datatype(hid_t type, unsigned in_group)
void
xml_dump_datatype(hid_t type)
{
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
dump_indent += COL;
- if(H5Tcommitted(type) > 0) {
+ if (H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
- obj_t *found_obj; /* Found object */
+ obj_t * found_obj; /* Found object */
/* Datatype is a shared or named datatype */
H5Oget_info(type, &oinfo);
found_obj = search_obj(type_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
char *dtxid = (char *)HDmalloc((size_t)100);
@@ -1553,9 +1609,9 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>",
- xmlnsprefix, dtxid);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* pointer to a named datatype already in XML */
@@ -1566,8 +1622,9 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />",
- xmlnsprefix, dtxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ xmlnsprefix, dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
}
HDfree(dtxid);
@@ -1578,7 +1635,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
}
else {
@@ -1587,7 +1645,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
xml_print_datatype(type, 0);
@@ -1599,7 +1658,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -1623,38 +1683,38 @@ xml_dump_dataspace(hid_t space)
hsize_t size[H5DUMP_MAX_RANK];
hsize_t maxsize[H5DUMP_MAX_RANK];
int i;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
- int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
- H5S_class_t space_type = H5Sget_simple_extent_type(space);
+ int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
@@ -1663,96 +1723,111 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
switch (space_type) {
- case H5S_SCALAR:
- /* scalar dataspace (just a tag, no XML attrs. defined */
+ case H5S_SCALAR:
+ /* scalar dataspace (just a tag, no XML attrs. defined */
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sScalarDataspace />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- case H5S_SIMPLE:
- /* simple dataspace */
- /* <hdf5:SimpleDataspace Ndims="nd"> */
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ /* <hdf5:SimpleDataspace Ndims="nd"> */
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">", xmlnsprefix, ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* print the <hdf5:Dimension> elements */
- ctx.indent_level++;
- for (i = 0; i < ndims; i++) {
- if (maxsize[i] == H5S_UNLIMITED) {
- ctx.need_prefix = TRUE;
+ /* print the <hdf5:Dimension> elements */
+ ctx.indent_level++;
+ for (i = 0; i < ndims; i++) {
+ if (maxsize[i] == H5S_UNLIMITED) {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>",
- xmlnsprefix,size[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else if (maxsize[i] == (hsize_t) 0) {
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"UNLIMITED\"/>",
+ xmlnsprefix, size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else if (maxsize[i] == (hsize_t)0) {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix,size[i], size[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], maxsize[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], maxsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
}
- }
- ctx.indent_level--;
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix );
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
#ifdef TMP
- /* Commented out: wait until the schema is updated first */
- case H5S_NULL:
- /* null dataspace (just a tag, no XML attrs. defined */
+ /* Commented out: wait until the schema is updated first */
+ case H5S_NULL:
+ /* null dataspace (just a tag, no XML attrs. defined */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNullDataspace />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
#endif /* TMP */
- case H5S_NULL:
- case H5S_NO_CLASS:
- default:
- ctx.need_prefix = TRUE;
+ case H5S_NULL:
+ case H5S_NO_CLASS:
+ default:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
@@ -1762,7 +1837,8 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataspace>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
h5tools_str_close(&buffer);
@@ -1781,19 +1857,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 */
@@ -1803,29 +1879,30 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.cmpd_sep = " ";
- string_dataformat.cmpd_pre = "";
- string_dataformat.cmpd_suf = "";
- string_dataformat.cmpd_end = "";
+ string_dataformat.cmpd_sep = " ";
+ string_dataformat.cmpd_pre = "";
+ string_dataformat.cmpd_suf = "";
+ string_dataformat.cmpd_end = "";
string_dataformat.arr_linebreak = 0;
- string_dataformat.arr_pre = "";
- outputformat = &string_dataformat;
+ string_dataformat.arr_pre = "";
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -1834,7 +1911,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1850,10 +1928,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
else {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
+ datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id);
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id);
}
}
else {
@@ -1872,18 +1950,18 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
else if (H5Tget_class(type) == H5T_STRING) {
status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
}
- else { /* all other data */
+ 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);
@@ -1899,7 +1977,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "Unable to print data.");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1914,8 +1993,9 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1924,7 +2004,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -1941,16 +2022,16 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
*/
herr_t
xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
- void H5_ATTR_UNUSED * op_data)
+ void H5_ATTR_UNUSED *op_data)
{
hid_t attr_id = 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);
@@ -1960,36 +2041,37 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_aname);
if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) {
- type = H5Aget_type(attr_id);
- space = H5Aget_space(attr_id);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
space_type = H5Sget_simple_extent_type(space);
dump_function_table->dump_dataspace_function(space);
@@ -2000,158 +2082,175 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
if (display_attr_data && space_type != H5S_NULL) {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_TIME:
+ ctx.indent_level++;
+ dump_indent += COL;
- case H5T_TIME:
- ctx.indent_level++;
- dump_indent += COL;
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<hdf5:Data>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<hdf5:Data>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- ctx.indent_level--;
- dump_indent -= COL;
- break;
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
+ case H5T_REFERENCE:
+ ctx.need_prefix = TRUE;
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(attr_id, ATTRIBUTE_DATA);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_VLEN:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_print_refs(attr_id, ATTRIBUTE_DATA);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
-
- case H5T_VLEN:
- ctx.need_prefix = TRUE;
+ 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, "<!-- 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);
-
- 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 {
@@ -2162,7 +2261,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -2171,7 +2271,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2180,7 +2281,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -2194,7 +2296,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
return SUCCEED;
@@ -2208,7 +2311,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2217,7 +2321,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
@@ -2239,17 +2344,17 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
void
xml_dump_named_datatype(hid_t type, const char *name)
{
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- char *tmp;
- char *dtxid;
- char *parentxid;
- char *t_tmp;
- char *t_prefix;
- char *t_name;
+ char * tmp;
+ char * dtxid;
+ char * parentxid;
+ char * t_tmp;
+ char * t_prefix;
+ char * t_name;
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
@@ -2261,34 +2366,34 @@ xml_dump_named_datatype(hid_t type, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- dtxid = (char *)HDmalloc((size_t)100);
+ dtxid = (char *)HDmalloc((size_t)100);
parentxid = (char *)HDmalloc((size_t)100);
- t_tmp = xml_escape_the_name(tmp);
- t_prefix = xml_escape_the_name(prefix);
- t_name = xml_escape_the_name(name);
+ t_tmp = xml_escape_the_name(tmp);
+ t_prefix = xml_escape_the_name(prefix);
+ t_name = xml_escape_the_name(name);
xml_name_to_XID(tmp, dtxid, 100, 1);
xml_name_to_XID(prefix, parentxid, 100, 1);
- if(HDstrncmp(name, "#", (size_t)1) == 0) {
+ if (HDstrncmp(name, "#", (size_t)1) == 0) {
/* Special: this is an 'anonymous' NDT, deleted but
still in use.
We follow the dumper's undocumented practice, and
@@ -2302,31 +2407,32 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,
- name, dtxid,
- parentxid, HDstrcmp(prefix,"") ? t_prefix : "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix, "") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,
- t_name, dtxid,
- t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, dtxid, t_tmp, parentxid,
+ (HDstrcmp(prefix, "") ? t_prefix : "/"));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check uniqueness of named datatype */
H5Oget_info(type, &oinfo);
- if(oinfo.rc > 1) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
found_obj = search_obj(type_table, oinfo.addr);
@@ -2337,11 +2443,11 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if(found_obj->displayed) {
+ else if (found_obj->displayed) {
/* We have already printed this named datatype, print it as a
* NamedDatatypePtr
*/
- char pointerxid[100];
+ char pointerxid[100];
char *t_objname = xml_escape_the_name(found_obj->objname);
ctx.indent_level++;
@@ -2352,8 +2458,10 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix,
+ pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2362,7 +2470,8 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
goto done;
}
@@ -2378,12 +2487,13 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(type,1);
+ xml_print_datatype(type, 1);
ctx.indent_level--;
dump_indent -= COL;
@@ -2391,8 +2501,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -2401,8 +2512,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
done:
@@ -2429,23 +2541,23 @@ done:
void
xml_dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
- hid_t gcpl_id;
- hid_t dset, type;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- int isRoot = 0;
- char type_name[1024];
- char *t_objname = NULL;
- char *par_name = NULL;
- char *cp = NULL;
- char *tmp = NULL;
- char *par = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ H5O_info_t oinfo;
+ hid_t gcpl_id;
+ hid_t dset, type;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ int isRoot = 0;
+ char type_name[1024];
+ char * t_objname = NULL;
+ char * par_name = NULL;
+ char * cp = NULL;
+ char * tmp = NULL;
+ char * par = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -2459,12 +2571,12 @@ xml_dump_group(hid_t gid, const char *name)
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -2474,36 +2586,36 @@ xml_dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- if(HDstrcmp(name, "/") == 0) {
+ if (HDstrcmp(name, "/") == 0) {
isRoot = 1;
- tmp = HDstrdup("/");
+ tmp = HDstrdup("/");
}
else {
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
- cp = HDstrrchr(par, '/');
- if(cp) {
- if((cp == par) && HDstrlen(par) > 1)
+ cp = HDstrrchr(par, '/');
+ if (cp) {
+ if ((cp == par) && HDstrlen(par) > 1)
*(cp + 1) = '\0';
else
*cp = '\0';
@@ -2512,8 +2624,8 @@ xml_dump_group(hid_t gid, const char *name)
H5Oget_info(gid, &oinfo);
- if(oinfo.rc > 1) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
found_obj = search_obj(group_table, oinfo.addr);
@@ -2524,15 +2636,15 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
}
else {
- char *t_name = xml_escape_the_name(name);
- char *grpxid = (char *)HDmalloc((size_t)100);
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
char *parentxid = (char *)HDmalloc((size_t)100);
- if(found_obj->displayed) {
+ if (found_obj->displayed) {
char *ptrstr = (char *)HDmalloc((size_t)100);
/* already seen: enter a groupptr */
- if(isRoot) {
+ if (isRoot) {
/* probably can't happen! */
xml_name_to_XID("/", grpxid, 100, 1);
@@ -2540,13 +2652,14 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
- xmlnsprefix, grpxid, "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix,
+ grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
t_objname = xml_escape_the_name(found_obj->objname);
- par_name = xml_escape_the_name(par);
+ par_name = xml_escape_the_name(par);
xml_name_to_XID(tmp, grpxid, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
@@ -2554,18 +2667,20 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,t_name, grpxid, get_next_xid(),
- t_objname, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, grpxid, get_next_xid(), t_objname, parentxid,
+ par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
HDfree(par_name);
ctx.indent_level++;
- t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
- par_name = xml_escape_the_name(par);
+ t_objname = xml_escape_the_name(found_obj->objname); /* point to the NDT by name */
+ par_name = xml_escape_the_name(par);
xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
@@ -2573,11 +2688,12 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- ptrstr, t_objname, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, ptrstr, t_objname, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2589,16 +2705,17 @@ xml_dump_group(hid_t gid, const char *name)
else {
/* first time this group has been seen -- describe it */
- if(isRoot) {
+ if (isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
- xmlnsprefix, grpxid, "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix,
+ grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_tmp = xml_escape_the_name(tmp);
@@ -2611,10 +2728,12 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >",
- xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_tmp);
HDfree(par_name);
@@ -2626,28 +2745,30 @@ xml_dump_group(hid_t gid, const char *name)
ctx.indent_level++;
dump_indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
- if(isRoot && unamedtype) {
+ if (isRoot && unamedtype) {
unsigned u;
/* Very special case: dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++) {
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2657,7 +2778,7 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
@@ -2672,8 +2793,8 @@ xml_dump_group(hid_t gid, const char *name)
}
else {
/* only link -- must be first time! */
- char *t_name = xml_escape_the_name(name);
- char *grpxid = (char *)HDmalloc((size_t)100);
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
char *parentxid = (char *)HDmalloc((size_t)100);
ctx.need_prefix = TRUE;
@@ -2681,9 +2802,10 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(isRoot) {
+ if (isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid,
+ "/");
}
else {
char *t_tmp = xml_escape_the_name(tmp);
@@ -2691,13 +2813,15 @@ xml_dump_group(hid_t gid, const char *name)
par_name = xml_escape_the_name(par);
xml_name_to_XID(tmp, grpxid, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >",
- xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
HDfree(t_tmp);
HDfree(par_name);
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
HDfree(grpxid);
@@ -2708,28 +2832,30 @@ xml_dump_group(hid_t gid, const char *name)
ctx.indent_level++;
dump_indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function,
+ NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
- if(isRoot && unamedtype) {
+ if (isRoot && unamedtype) {
unsigned u;
/* Very special case: dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++) {
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2739,7 +2865,7 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
@@ -2752,17 +2878,18 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(isRoot)
+ if (isRoot)
h5tools_str_append(&buffer, "</%sRootGroup>", xmlnsprefix);
else
h5tools_str_append(&buffer, "</%sGroup>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
- if(par)
+ if (par)
HDfree(par);
- if(tmp)
+ if (tmp)
HDfree(tmp);
}
@@ -2780,18 +2907,18 @@ 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;
size_t tsiz;
- hobj_ref_t *refbuf = NULL;
- char *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ hobj_ref_t * refbuf = NULL;
+ char * buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA) {
type = H5Dget_type(did);
@@ -2819,7 +2946,7 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *)HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -2834,7 +2961,7 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *)HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Aread(did, H5T_STD_REF_OBJ, buf);
@@ -2850,24 +2977,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 = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
const char *path = lookup_ref_path(*refbuf);
@@ -2879,7 +3006,8 @@ xml_print_refs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_path = xml_escape_the_string(path, -1);
@@ -2889,7 +3017,8 @@ xml_print_refs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_path);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_path);
}
ctx.indent_level--;
@@ -2905,13 +3034,15 @@ xml_print_refs(hid_t did, int source)
return SUCCEED;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -2929,21 +3060,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);
@@ -2960,9 +3091,9 @@ xml_print_strs(hid_t did, int source)
if (source == DATASET_DATA) {
space = H5Dget_space(did);
- if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if((tsiz = H5Tget_size(type)) == 0)
+ if ((tsiz = H5Tget_size(type)) == 0)
goto error;
buf = HDmalloc((size_t)ssiz * tsiz);
@@ -2975,9 +3106,9 @@ xml_print_strs(hid_t did, int source)
}
else if (source == ATTRIBUTE_DATA) {
space = H5Aget_space(did);
- if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if((tsiz = H5Tget_size(type)) == 0)
+ if ((tsiz = H5Tget_size(type)) == 0)
goto error;
buf = HDmalloc((size_t)ssiz * tsiz);
@@ -2989,33 +3120,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 = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
if (is_vlstr) {
@@ -3034,7 +3165,8 @@ xml_print_strs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_onestring = xml_escape_the_string(onestring, (int)str_size);
@@ -3045,7 +3177,8 @@ xml_print_strs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_onestring);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_onestring);
}
}
@@ -3068,13 +3201,15 @@ xml_print_strs(hid_t did, int source)
return SUCCEED;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -3099,41 +3234,42 @@ check_filters(hid_t dcpl)
size_t cd_nelmts = 20;
unsigned int cd_values[20];
unsigned int flags;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
nfilt = H5Pget_nfilters(dcpl);
if (nfilt <= 0)
return;
for (i = 0; i < nfilt; i++) {
- filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, (size_t)120, namebuf, NULL);
+ filter = H5Pget_filter2(dcpl, (unsigned)i, &flags, (size_t *)&cd_nelmts, cd_values, (size_t)120,
+ namebuf, NULL);
if (filter == H5Z_FILTER_DEFLATE) {
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3149,7 +3285,8 @@ check_filters(hid_t dcpl)
h5tools_str_append(&buffer, "%d", cd_values[0]);
}
h5tools_str_append(&buffer, "\"/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_FLETCHER32) {
@@ -3159,7 +3296,8 @@ check_filters(hid_t dcpl)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_SHUFFLE) {
@@ -3169,7 +3307,8 @@ check_filters(hid_t dcpl)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_SZIP) {
@@ -3216,7 +3355,8 @@ check_filters(hid_t dcpl)
h5tools_str_append(&buffer, "Header=\"Raw\"");
}
h5tools_str_append(&buffer, "/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else {
@@ -3233,37 +3373,37 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
size_t sz;
size_t i;
hsize_t space;
- void *buf;
- char *name;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ void * buf;
+ char * name;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
dump_indent += COL;
@@ -3273,31 +3413,34 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
space = H5Tget_size(type);
- buf = HDmalloc((size_t) space);
+ buf = HDmalloc((size_t)space);
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+ const char *path = lookup_ref_path(*(hobj_ref_t *)buf);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
if (!path) {
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_path = xml_escape_the_string(path, -1);
@@ -3307,7 +3450,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_path);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_path);
}
@@ -3316,7 +3460,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else if (H5Tget_class(type) == H5T_STRING) {
/* ????? */
@@ -3325,197 +3470,221 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- String fill values not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* all other data */
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- ctx.need_prefix = TRUE;
+ case H5T_INTEGER:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%d\"", *(int *) buf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%d\"", *(int *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_FLOAT:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_FLOAT:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- sz = H5Tget_size(type);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ sz = H5Tget_size(type);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"");
- for (i = 0; i < sz; i++) {
- h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (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);
@@ -3527,7 +3696,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3545,32 +3715,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);
@@ -3580,28 +3750,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 = display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
xml_name_to_XID(tmp, rstr, 100, 1);
xml_name_to_XID(prefix, pstr, 100, 1);
@@ -3610,10 +3780,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);
@@ -3622,8 +3793,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 */
@@ -3631,7 +3802,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);
}
@@ -3645,7 +3816,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;
@@ -3656,7 +3828,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;
@@ -3667,8 +3840,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;
@@ -3676,7 +3851,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;
@@ -3689,7 +3865,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;
@@ -3699,7 +3876,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;
@@ -3708,7 +3886,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);
@@ -3722,7 +3901,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;
@@ -3730,7 +3910,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;
@@ -3738,7 +3919,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)) {
@@ -3749,7 +3931,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 +3940,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;
@@ -3765,7 +3949,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.... ?? */
@@ -3818,7 +4003,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;
@@ -3828,10 +4014,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;
@@ -3839,7 +4027,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 {
@@ -3851,7 +4040,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;
@@ -3861,7 +4051,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;
@@ -3873,17 +4064,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;
@@ -3891,166 +4084,182 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
if (display_data && (tempi > 0)) {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
-
- case H5T_TIME:
- ctx.indent_level++;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- ctx.need_prefix = TRUE;
+ case H5T_TIME:
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.indent_level--;
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ ctx.indent_level--;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ case H5T_REFERENCE:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(did, DATASET_DATA);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_VLEN:
+ ctx.indent_level--;
+ dump_indent -= COL;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_print_refs(did, DATASET_DATA);
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
-
- case H5T_VLEN:
- ctx.indent_level--;
- dump_indent -= COL;
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- dump_indent += COL;
-
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
else {
@@ -4062,7 +4271,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;
@@ -4070,7 +4280,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;
@@ -4078,7 +4289,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--;
}
@@ -4091,7 +4303,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);
}
@@ -4110,62 +4323,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 = 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
@@ -4189,7 +4404,7 @@ xml_print_enum(hid_t type)
}
/* Get the names and raw values of all members */
- name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
@@ -4214,8 +4429,9 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumElement>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4223,7 +4439,8 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", t_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
ctx.indent_level--;
@@ -4231,15 +4448,17 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumElement>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumElement>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4253,22 +4472,24 @@ xml_print_enum(hid_t type)
h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *)
- ((void *) (value + i * dst_size))));
+ h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "u",
+ *((unsigned long long *)((void *)(value + i * dst_size))));
}
else {
- h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d",
- *((long long *) ((void *) (value + i * dst_size))));
+ h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "d",
+ *((long long *)((void *)(value + i * dst_size))));
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumValue>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -4283,4 +4504,3 @@ xml_print_enum(hid_t type)
HDfree(value);
H5Tclose(super);
}
-
diff --git a/tools/h5dump/h5dump_xml.h b/tools/h5dump/h5dump_xml.h
index 3c59917..4798ea8 100644
--- a/tools/h5dump/h5dump_xml.h
+++ b/tools/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__ */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index e0a9404..b2defbd 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -25,94 +25,94 @@
#include "H5private.h"
#include "h5tools.h"
-#define FILE1 "tgroup.h5"
-#define FILE2 "tdset.h5"
-#define FILE3 "tattr.h5"
-#define FILE4 "tslink.h5"
-#define FILE4_1 "tsoftlinks.h5"
-#define FILE5 "thlink.h5"
-#define FILE6 "tcompound.h5"
-#define FILE7 "tall.h5"
-#define FILE8 "tdset2.h5"
-#define FILE9 "tcompound2.h5"
-#define FILE10 "tloop.h5"
-#define FILE11 "tloop2.h5"
-#define FILE12 "tmany.h5"
-#define FILE13 "tstr.h5"
-#define FILE14 "tstr2.h5"
-#define FILE15 "tenum.h5"
-#define FILE16 "tobjref.h5"
-#define FILE17 "tdatareg.h5"
-#define FILE18 "tnestedcomp.h5"
-#define FILE19 "topaque.h5"
-#define FILE20 "tbitfields.h5"
-#define FILE21 "tvldtypes1.h5"
-#define FILE22 "tvldtypes2.h5"
-#define FILE23 "tvldtypes3.h5"
-#define FILE24 "tvldtypes4.h5"
-#define FILE25 "tarray1.h5"
+#define FILE1 "tgroup.h5"
+#define FILE2 "tdset.h5"
+#define FILE3 "tattr.h5"
+#define FILE4 "tslink.h5"
+#define FILE4_1 "tsoftlinks.h5"
+#define FILE5 "thlink.h5"
+#define FILE6 "tcompound.h5"
+#define FILE7 "tall.h5"
+#define FILE8 "tdset2.h5"
+#define FILE9 "tcompound2.h5"
+#define FILE10 "tloop.h5"
+#define FILE11 "tloop2.h5"
+#define FILE12 "tmany.h5"
+#define FILE13 "tstr.h5"
+#define FILE14 "tstr2.h5"
+#define FILE15 "tenum.h5"
+#define FILE16 "tobjref.h5"
+#define FILE17 "tdatareg.h5"
+#define FILE18 "tnestedcomp.h5"
+#define FILE19 "topaque.h5"
+#define FILE20 "tbitfields.h5"
+#define FILE21 "tvldtypes1.h5"
+#define FILE22 "tvldtypes2.h5"
+#define FILE23 "tvldtypes3.h5"
+#define FILE24 "tvldtypes4.h5"
+#define FILE25 "tarray1.h5"
#define FILE25_BIG "tarray1_big.h5"
-#define FILE26 "tarray2.h5"
-#define FILE27 "tarray3.h5"
-#define FILE28 "tarray4.h5"
-#define FILE29 "tarray5.h5"
-#define FILE30 "tarray6.h5"
-#define FILE31 "tarray7.h5"
-#define FILE32 "tempty.h5"
-#define FILE33 "tgrp_comments.h5"
-#define FILE34 "tsplit_file"
-#define FILE35 "tfamily%05d.h5"
-#define FILE36 "tmulti"
-#define FILE37 "tlarge_objname.h5"
-#define FILE38 "tvlstr.h5"
-#define FILE39 "tchar.h5"
-#define FILE40 "tattr2.h5"
-#define FILE41 "tcompound_complex.h5"
-#define FILE42 "tnamed_dtype_attr.h5"
-#define FILE43 "tvldtypes5.h5"
-#define FILE44 "tfilters.h5"
-#define FILE45 "tnullspace.h5"
-#define FILE46 "tfcontents1.h5"
-#define FILE47 "tfcontents2.h5"
-#define FILE48 "tfvalues.h5"
-#define FILE49 "tstr3.h5"
-#define FILE50 "taindices.h5"
-#define FILE51 "tlonglinks.h5"
-#define FILE52 "tldouble.h5"
-#define FILE53 "textlink.h5"
-#define FILE54 "tudlink.h5"
-#define FILE55 "tbinary.h5"
-#define FILE56 "tbigdims.h5"
-#define FILE57 "thyperslab.h5"
-#define FILE58 "tordergr.h5"
-#define FILE59 "torderattr.h5"
-#define FILE60 "tfpformat.h5"
-#define FILE61 "textlinksrc.h5"
-#define FILE62 "textlinktar.h5"
-#define FILE63 "textlinkfar.h5"
-#define FILE64 "tarray8.h5"
-#define FILE65 "tattrreg.h5"
-#define FILE66 "packedbits.h5"
-#define FILE67 "zerodim.h5"
-#define FILE68 "charsets.h5"
-#define FILE69 "tattrintsize.h5"
-#define FILE70 "tcmpdintsize.h5"
-#define FILE71 "tcmpdattrintsize.h5"
-#define FILE72 "tnestedcmpddt.h5"
-#define FILE73 "tscalarintsize.h5"
-#define FILE74 "tscalarattrintsize.h5"
-#define FILE75 "tscalarstring.h5"
-#define FILE76 "tcmpdintarray.h5"
-#define FILE77 "tcmpdints.h5"
-#define FILE78 "tscalarintattrsize.h5"
-#define FILE79 "tintsattrs.h5"
-#define FILE80 "tbitnopaque.h5"
-#define FILE81 "tints4dims.h5"
-#define FILE82 "tcompound_complex2.h5"
-#define FILE83 "tvlenstr_array.h5"
-#define FILE84 "tudfilter.h5"
-#define FILE85 "tgrpnullspace.h5"
-#define FILE87 "tintsnodata.h5"
+#define FILE26 "tarray2.h5"
+#define FILE27 "tarray3.h5"
+#define FILE28 "tarray4.h5"
+#define FILE29 "tarray5.h5"
+#define FILE30 "tarray6.h5"
+#define FILE31 "tarray7.h5"
+#define FILE32 "tempty.h5"
+#define FILE33 "tgrp_comments.h5"
+#define FILE34 "tsplit_file"
+#define FILE35 "tfamily%05d.h5"
+#define FILE36 "tmulti"
+#define FILE37 "tlarge_objname.h5"
+#define FILE38 "tvlstr.h5"
+#define FILE39 "tchar.h5"
+#define FILE40 "tattr2.h5"
+#define FILE41 "tcompound_complex.h5"
+#define FILE42 "tnamed_dtype_attr.h5"
+#define FILE43 "tvldtypes5.h5"
+#define FILE44 "tfilters.h5"
+#define FILE45 "tnullspace.h5"
+#define FILE46 "tfcontents1.h5"
+#define FILE47 "tfcontents2.h5"
+#define FILE48 "tfvalues.h5"
+#define FILE49 "tstr3.h5"
+#define FILE50 "taindices.h5"
+#define FILE51 "tlonglinks.h5"
+#define FILE52 "tldouble.h5"
+#define FILE53 "textlink.h5"
+#define FILE54 "tudlink.h5"
+#define FILE55 "tbinary.h5"
+#define FILE56 "tbigdims.h5"
+#define FILE57 "thyperslab.h5"
+#define FILE58 "tordergr.h5"
+#define FILE59 "torderattr.h5"
+#define FILE60 "tfpformat.h5"
+#define FILE61 "textlinksrc.h5"
+#define FILE62 "textlinktar.h5"
+#define FILE63 "textlinkfar.h5"
+#define FILE64 "tarray8.h5"
+#define FILE65 "tattrreg.h5"
+#define FILE66 "packedbits.h5"
+#define FILE67 "zerodim.h5"
+#define FILE68 "charsets.h5"
+#define FILE69 "tattrintsize.h5"
+#define FILE70 "tcmpdintsize.h5"
+#define FILE71 "tcmpdattrintsize.h5"
+#define FILE72 "tnestedcmpddt.h5"
+#define FILE73 "tscalarintsize.h5"
+#define FILE74 "tscalarattrintsize.h5"
+#define FILE75 "tscalarstring.h5"
+#define FILE76 "tcmpdintarray.h5"
+#define FILE77 "tcmpdints.h5"
+#define FILE78 "tscalarintattrsize.h5"
+#define FILE79 "tintsattrs.h5"
+#define FILE80 "tbitnopaque.h5"
+#define FILE81 "tints4dims.h5"
+#define FILE82 "tcompound_complex2.h5"
+#define FILE83 "tvlenstr_array.h5"
+#define FILE84 "tudfilter.h5"
+#define FILE85 "tgrpnullspace.h5"
+#define FILE87 "tintsnodata.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -120,59 +120,50 @@
*/
/* utility functions */
-static int
-make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf);
-static int
-write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
- hid_t tid, void *buf);
-static int
-write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t tid, void *buf );
+static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf);
+static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf);
+static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf);
/* a filter operation callback function */
-static size_t
-myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf);
+static size_t myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf);
/* a "set local" callback */
-static herr_t
-set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t H5_ATTR_UNUSED sid);
+static herr_t set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t H5_ATTR_UNUSED sid);
#define MYFILTER_ID 405
/* This message derives from H5Z */
const H5Z_class2_t H5Z_MYFILTER[1] = {{
- H5Z_CLASS_T_VERS,
- MYFILTER_ID, /* Filter id number */
- 1, 1,
- "myfilter", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- set_local_myfilter, /* The "set local" callback */
- myfilter, /* The actual filter function */
+ H5Z_CLASS_T_VERS, MYFILTER_ID, /* Filter id number */
+ 1, 1, "myfilter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ set_local_myfilter, /* The "set local" callback */
+ myfilter, /* The actual filter function */
}};
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
+ "dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
-
/* A UD link traversal function. Shouldn't actually be called. */
-static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group,
- H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id)
+static hid_t
+UD_traverse(H5_ATTR_UNUSED const char *link_name, H5_ATTR_UNUSED hid_t cur_group,
+ H5_ATTR_UNUSED const void *udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id)
{
return -1;
}
@@ -180,20 +171,19 @@ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED h
#define MY_LINKCLASS 187
const H5L_class_t UD_link_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)MY_LINKCLASS, /* Link type id number */
- "UD link class", /* name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-
#define LENSTR 50
-#define LENSTR2 11
+#define LENSTR2 11
#define SPACE2_RANK 2
#define SPACE2_DIM1 10
@@ -204,8 +194,8 @@ const H5L_class_t UD_link_class[1] = {{
#define DIM1 20
#define DIM2 10
-#define CDIM1 DIM1/2
-#define CDIM2 DIM2/2
+#define CDIM1 DIM1 / 2
+#define CDIM2 DIM2 / 2
#define RANK 2
/* Dataspace of 0 dimension size */
@@ -216,22 +206,15 @@ const H5L_class_t UD_link_class[1] = {{
/* Element selection information */
#define POINT1_NPOINTS 10
-typedef enum{
- RED,
- GREEN,
- BLUE,
- WHITE,
- BLACK
-} enumtype;
+typedef enum { RED, GREEN, BLUE, WHITE, BLACK } enumtype;
/* Compound datatype */
typedef struct s1_t {
- unsigned int a;
- unsigned int b;
- float c;
+ unsigned int a;
+ unsigned int b;
+ float c;
} s1_t;
-
/* 1-D array datatype */
#define ARRAY1_RANK 1
#define ARRAY1_DIM1 4
@@ -249,17 +232,17 @@ typedef struct s1_t {
/* "File 41" macros */
/* Name of dataset to create in datafile */
-#define F41_DATASETNAME "CompoundComplex"
+#define F41_DATASETNAME "CompoundComplex"
/* Dataset dimensions */
-#define F41_LENGTH 6
-#define F41_RANK 1
-#define F41_ARRAY_RANK 1
-#define F41_ARRAY_RANKd 2
-#define F41_DIMb 4
-#define F41_ARRAY_DIMc 6
-#define F41_ARRAY_DIMd1 5
-#define F41_ARRAY_DIMd2 6
-#define F41_ARRAY_DIMf 10
+#define F41_LENGTH 6
+#define F41_RANK 1
+#define F41_ARRAY_RANK 1
+#define F41_ARRAY_RANKd 2
+#define F41_DIMb 4
+#define F41_ARRAY_DIMc 6
+#define F41_ARRAY_DIMd1 5
+#define F41_ARRAY_DIMd2 6
+#define F41_ARRAY_DIMf 10
/* "File 42" macros */
/* Name of dataset to create in datafile */
@@ -273,97 +256,97 @@ typedef struct s1_t {
#define F43_DSETNAME "Dataset"
/* "File 51" macros */
-#define F51_MAX_NAME_LEN ((64*1024)+1024)
+#define F51_MAX_NAME_LEN ((64 * 1024) + 1024)
/* "File 64" macros */
-#define F64_DATASET "DS1"
-#define F64_DIM0 1
-#define F64_ARRAY_BUF_LEN (4*1024)
-#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
+#define F64_DATASET "DS1"
+#define F64_DIM0 1
+#define F64_ARRAY_BUF_LEN (4 * 1024)
+#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
/* "FILE66" macros and for FILE69 */
-#define F66_XDIM 8
-#define F66_DATASETU08 "DU08BITS"
-#define F66_DATASETS08 "DS08BITS"
-#define F66_YDIM8 8
-#define F66_DATASETU16 "DU16BITS"
-#define F66_DATASETS16 "DS16BITS"
-#define F66_YDIM16 16
-#define F66_DATASETU32 "DU32BITS"
-#define F66_DATASETS32 "DS32BITS"
-#define F66_YDIM32 32
-#define F66_DATASETU64 "DU64BITS"
-#define F66_DATASETS64 "DS64BITS"
-#define F66_YDIM64 64
-#define F66_DUMMYDBL "DummyDBL"
+#define F66_XDIM 8
+#define F66_DATASETU08 "DU08BITS"
+#define F66_DATASETS08 "DS08BITS"
+#define F66_YDIM8 8
+#define F66_DATASETU16 "DU16BITS"
+#define F66_DATASETS16 "DS16BITS"
+#define F66_YDIM16 16
+#define F66_DATASETU32 "DU32BITS"
+#define F66_DATASETS32 "DS32BITS"
+#define F66_YDIM32 32
+#define F66_DATASETU64 "DU64BITS"
+#define F66_DATASETS64 "DS64BITS"
+#define F66_YDIM64 64
+#define F66_DUMMYDBL "DummyDBL"
/* "FILE70" macros and for FILE71 */
/* Name of dataset to create in datafile */
-#define F70_DATASETNAME "CompoundIntSize"
+#define F70_DATASETNAME "CompoundIntSize"
#define F70_LENGTH 4
#define F70_RANK 1
#define F70_ARRAY_RANK 2
#define F70_XDIM 8
-#define F70_DATASETU08 "DU08BITS"
-#define F70_DATASETS08 "DS08BITS"
+#define F70_DATASETU08 "DU08BITS"
+#define F70_DATASETS08 "DS08BITS"
#define F70_YDIM8 8
-#define F70_DATASETU16 "DU16BITS"
-#define F70_DATASETS16 "DS16BITS"
+#define F70_DATASETU16 "DU16BITS"
+#define F70_DATASETS16 "DS16BITS"
#define F70_YDIM16 16
-#define F70_DATASETU32 "DU32BITS"
-#define F70_DATASETS32 "DS32BITS"
+#define F70_DATASETU32 "DU32BITS"
+#define F70_DATASETS32 "DS32BITS"
#define F70_YDIM32 32
-#define F70_DATASETU64 "DU64BITS"
-#define F70_DATASETS64 "DS64BITS"
+#define F70_DATASETU64 "DU64BITS"
+#define F70_DATASETS64 "DS64BITS"
#define F70_YDIM64 64
-#define F70_DUMMYDBL "DummyDBL"
+#define F70_DUMMYDBL "DummyDBL"
/* Name of dataset to create in datafile */
-#define F71_DATASETNAME "CompoundAttrIntSize"
+#define F71_DATASETNAME "CompoundAttrIntSize"
/* "FILE73" macros and for FILE69 and FILE78 */
-#define F73_ARRAY_RANK 2
-#define F73_XDIM 8
-#define F73_DATASETU08 "DU08BITS"
-#define F73_DATASETS08 "DS08BITS"
-#define F73_YDIM8 8
-#define F73_DATASETU16 "DU16BITS"
-#define F73_DATASETS16 "DS16BITS"
-#define F73_YDIM16 16
-#define F73_DATASETU32 "DU32BITS"
-#define F73_DATASETS32 "DS32BITS"
-#define F73_YDIM32 32
-#define F73_DATASETU64 "DU64BITS"
-#define F73_DATASETS64 "DS64BITS"
-#define F73_YDIM64 64
-#define F73_DUMMYDBL "DummyDBL"
+#define F73_ARRAY_RANK 2
+#define F73_XDIM 8
+#define F73_DATASETU08 "DU08BITS"
+#define F73_DATASETS08 "DS08BITS"
+#define F73_YDIM8 8
+#define F73_DATASETU16 "DU16BITS"
+#define F73_DATASETS16 "DS16BITS"
+#define F73_YDIM16 16
+#define F73_DATASETU32 "DU32BITS"
+#define F73_DATASETS32 "DS32BITS"
+#define F73_YDIM32 32
+#define F73_DATASETU64 "DU64BITS"
+#define F73_DATASETS64 "DS64BITS"
+#define F73_YDIM64 64
+#define F73_DUMMYDBL "DummyDBL"
/* "FILE76 and FILE77 */
/* Name of dataset to create in datafile */
-#define F76_DATASETNAME "CompoundIntArray"
+#define F76_DATASETNAME "CompoundIntArray"
#define F76_LENGTH 4
#define F76_RANK 1
#define F76_ARRAY_RANK 1
-#define F76_DATASETU08 "DU08BITS"
-#define F76_DATASETS08 "DS08BITS"
-#define F76_DIM8 8
-#define F76_DATASETU16 "DU16BITS"
-#define F76_DATASETS16 "DS16BITS"
-#define F76_DIM16 16
-#define F76_DATASETU32 "DU32BITS"
-#define F76_DATASETS32 "DS32BITS"
-#define F76_DIM32 32
-#define F76_DATASETU64 "DU64BITS"
-#define F76_DATASETS64 "DS64BITS"
-#define F76_DIM64 64
-#define F76_DUMMYDBL "DummyDBL"
+#define F76_DATASETU08 "DU08BITS"
+#define F76_DATASETS08 "DS08BITS"
+#define F76_DIM8 8
+#define F76_DATASETU16 "DU16BITS"
+#define F76_DATASETS16 "DS16BITS"
+#define F76_DIM16 16
+#define F76_DATASETU32 "DU32BITS"
+#define F76_DATASETS32 "DS32BITS"
+#define F76_DIM32 32
+#define F76_DATASETU64 "DU64BITS"
+#define F76_DATASETS64 "DS64BITS"
+#define F76_DIM64 64
+#define F76_DUMMYDBL "DummyDBL"
/* Name of dataset to create in datafile */
-#define F77_DATASETNAME1 "CompoundInts"
-#define F77_DATASETNAME2 "CompoundRInts"
-#define F77_LENGTH 64
+#define F77_DATASETNAME1 "CompoundInts"
+#define F77_DATASETNAME2 "CompoundRInts"
+#define F77_LENGTH 64
-#define F80_DIM32 32
+#define F80_DIM32 32
-#define F81_DATASETNAME "FourDimInts"
+#define F81_DATASETNAME "FourDimInts"
#define F81_RANK 4
#define F81_WDIM 10
#define F81_XDIM 8
@@ -372,25 +355,25 @@ typedef struct s1_t {
/* "File 82" macros */
/* Name of dataset to create in datafile */
-#define F82_DATASETNAME "CompoundComplex1D"
-#define F82_DATASETNAME2 "CompoundComplex2D"
-#define F82_DATASETNAME3 "CompoundComplex3D"
-#define F82_DATASETNAME4 "CompoundComplex4D"
+#define F82_DATASETNAME "CompoundComplex1D"
+#define F82_DATASETNAME2 "CompoundComplex2D"
+#define F82_DATASETNAME3 "CompoundComplex3D"
+#define F82_DATASETNAME4 "CompoundComplex4D"
/* Dataset dimensions */
-#define F82_DIM32 32
-#define F82_RANK 1
-#define F82_RANK2 2
-#define F82_RANK3 3
-#define F82_RANK4 4
+#define F82_DIM32 32
+#define F82_RANK 1
+#define F82_RANK2 2
+#define F82_RANK3 3
+#define F82_RANK4 4
/* "File 83" macros */
/* Name of dataset to create in datafile */
-#define F83_DATASETNAME "ScalarArrayOfVlenStr"
-#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
+#define F83_DATASETNAME "ScalarArrayOfVlenStr"
+#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
/* Dataset dimensions */
-#define F83_DIM 5
-#define F83_RANK 1
-#define F83_ARRAYDIM 3
+#define F83_DIM 5
+#define F83_RANK 1
+#define F83_ARRAYDIM 3
static void
gent_group(void)
@@ -441,21 +424,22 @@ gent_group(void)
static void
gent_dataset(void)
{
- hid_t fid, dataset, space;
+ hid_t fid, dataset, space;
hsize_t dims[2];
- int dset1[10][20];
- double dset2[30][20];
- int i, j;
+ int dset1[10][20];
+ double dset2[30][20];
+ int i, j;
fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* dset1 */
- dims[0] = 10; dims[1] = 20;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 20;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 20; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 20; j++)
dset1[i][j] = j + i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
@@ -463,12 +447,13 @@ gent_dataset(void)
H5Dclose(dataset);
/* dset2 */
- dims[0] = 30; dims[1] = 20;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 30;
+ dims[1] = 20;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 30; i++)
- for(j = 0; j < 20; j++)
+ for (i = 0; i < 30; i++)
+ for (j = 0; j < 20; j++)
dset2[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -481,26 +466,29 @@ gent_dataset(void)
static void
gent_dataset2(void)
{
- hid_t fid, dataset, space, create_plist;
+ hid_t fid, dataset, space, create_plist;
hsize_t dims[2];
hsize_t maxdims[2];
- int dset1[10][20];
- double dset2[30][10];
- int i, j;
+ int dset1[10][20];
+ double dset2[30][10];
+ int i, j;
- fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
create_plist = H5Pcreate(H5P_DATASET_CREATE);
- dims[0] = 5; dims[1] = 5;
+ dims[0] = 5;
+ dims[1] = 5;
H5Pset_chunk(create_plist, 2, dims);
/* dset1 */
- dims[0] = 10; dims[1] = 20;
- maxdims[0] = H5S_UNLIMITED; maxdims[1] = 20;
- space = H5Screate_simple(2, dims, maxdims);
- dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
-
- for(i = 0; i < 10; i++)
- for(j = 0; j < 20; j++)
+ dims[0] = 10;
+ dims[1] = 20;
+ maxdims[0] = H5S_UNLIMITED;
+ maxdims[1] = 20;
+ space = H5Screate_simple(2, dims, maxdims);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 20; j++)
dset1[i][j] = j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
@@ -508,13 +496,15 @@ gent_dataset2(void)
H5Dclose(dataset);
/* dset2 */
- dims[0] = 30; dims[1] = 10;
- maxdims[0] = 30; maxdims[1] = H5S_UNLIMITED;
- space = H5Screate_simple(2, dims, maxdims);
- dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
-
- for(i = 0; i < 30; i++)
- for(j = 0; j < 10; j++)
+ dims[0] = 30;
+ dims[1] = 10;
+ maxdims[0] = 30;
+ maxdims[1] = H5S_UNLIMITED;
+ space = H5Screate_simple(2, dims, maxdims);
+ dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ for (i = 0; i < 30; i++)
+ for (j = 0; j < 10; j++)
dset2[i][j] = j;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -528,21 +518,21 @@ gent_dataset2(void)
static void
gent_attribute(void)
{
- hid_t fid, root, space, attr, type;
+ hid_t fid, root, space, attr, type;
hsize_t dims[2];
- char buf[60];
- int i, data[10];
- double d[10];
- char string[]= "string attribute";
- int point = 100;
+ char buf[60];
+ int i, data[10];
+ double d[10];
+ char string[] = "string attribute";
+ int point = 100;
- fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* attribute 1 */
dims[0] = 24;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "attribute of root group");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -550,10 +540,11 @@ gent_attribute(void)
/* attribute 2 */
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) data[i] = i+1;
+ for (i = 0; i < 10; i++)
+ data[i] = i + 1;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
@@ -561,10 +552,11 @@ gent_attribute(void)
/* attribute 3 */
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) d[i] = 0.1F * (float)i;
+ for (i = 0; i < 10; i++)
+ d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space);
@@ -572,14 +564,14 @@ gent_attribute(void)
/* attribute 4 */
space = H5Screate(H5S_SCALAR);
- attr = H5Acreate2(root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Acreate2(root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point);
H5Sclose(space);
H5Aclose(attr);
/* attribute 5 */
space = H5Screate(H5S_SCALAR);
- type = H5Tcopy(H5T_C_S1);
+ type = H5Tcopy(H5T_C_S1);
H5Tset_size(type, 17);
attr = H5Acreate2(root, "attr5", type, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, type, string);
@@ -591,11 +583,12 @@ gent_attribute(void)
H5Fclose(fid);
}
-static void gent_softlink(void)
+static void
+gent_softlink(void)
{
hid_t fid, root;
- fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
H5Lcreate_soft("somevalue", root, "slink1", H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_soft("linkvalue", root, "slink2", H5P_DEFAULT, H5P_DEFAULT);
@@ -616,25 +609,25 @@ static void gent_softlink(void)
*-------------------------------------------------------------------------*/
#define NX 4
#define NY 2
-static int gent_softlink2(void)
+static int
+gent_softlink2(void)
{
- hid_t fileid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID;
- hid_t dataspace = H5I_INVALID_HID;
- hsize_t dimsf[2]; /* dataset dimensions */
- int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
- int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
- herr_t status = SUCCEED;
+ hid_t fileid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
+ hsize_t dimsf[2]; /* dataset dimensions */
+ int data1[NX][NY] = {{0, 0}, {1, 1}, {2, 2}, {3, 3}};
+ int data2[NX][NY] = {{0, 0}, {0, 1}, {0, 2}, {3, 3}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
* FILE
*------------------------------------------------------------------------*/
/* Create a new file */
fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if (fileid1 < 0)
- {
+ if (fileid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -644,16 +637,14 @@ static int gent_softlink2(void)
* Groups
*------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid1 < 0)
- {
+ if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
gid2 = H5Gcreate2(fileid1, "group_empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid2 < 0)
- {
+ if (gid2 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -663,9 +654,8 @@ static int gent_softlink2(void)
* Named datatype
*------------------------------------------------------------------------*/
datatype = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -678,8 +668,8 @@ static int gent_softlink2(void)
* Describe the size of the array and create the data space for fixed
* size dataset.
*/
- dimsf[0] = NX;
- dimsf[1] = NY;
+ dimsf[0] = NX;
+ dimsf[1] = NY;
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
@@ -690,18 +680,15 @@ static int gent_softlink2(void)
* dset1
*/
/* Create a new dataset as sample object */
- dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (dset1 < 0)
- {
+ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset1 < 0) {
HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -711,18 +698,15 @@ static int gent_softlink2(void)
* dset2
*/
/* Create a new dataset as sample object */
- dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (dset2 < 0)
- {
+ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset2 < 0) {
HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -736,8 +720,7 @@ static int gent_softlink2(void)
*/
/* link to dset1 */
status = H5Lcreate_soft("/dset1", fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -745,8 +728,7 @@ static int gent_softlink2(void)
/* link to data type */
status = H5Lcreate_soft("/dtype", fileid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -754,8 +736,7 @@ static int gent_softlink2(void)
/* link to group1 */
status = H5Lcreate_soft("/group1", fileid1, "soft_group1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -763,8 +744,7 @@ static int gent_softlink2(void)
/* link to empty group */
status = H5Lcreate_soft("/group_empty", fileid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -772,8 +752,7 @@ static int gent_softlink2(void)
/* dangling link */
status = H5Lcreate_soft("not_yet", fileid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -784,8 +763,7 @@ static int gent_softlink2(void)
*/
/* link to dset1 */
status = H5Lcreate_soft("/dset1", gid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -793,8 +771,7 @@ static int gent_softlink2(void)
/* link to dset2 */
status = H5Lcreate_soft("/dset2", gid1, "soft_dset2", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -802,8 +779,7 @@ static int gent_softlink2(void)
/* link to data type */
status = H5Lcreate_soft("/dtype", gid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -811,8 +787,7 @@ static int gent_softlink2(void)
/* link to empty group */
status = H5Lcreate_soft("/group_empty", gid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -820,42 +795,41 @@ static int gent_softlink2(void)
/* dangling link */
status = H5Lcreate_soft("not_yet", gid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
}
- out:
+out:
/*
* Close/release resources.
*/
- if(dataspace >= 0 && H5Sclose(dataspace) < 0) {
+ if (dataspace >= 0 && H5Sclose(dataspace) < 0) {
HDfprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1);
status = FAIL;
}
- if(gid1 >= 0 && H5Gclose(gid1) < 0) {
+ if (gid1 >= 0 && H5Gclose(gid1) < 0) {
HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
status = FAIL;
}
- if(gid2 >= 0 && H5Gclose(gid2) < 0) {
+ if (gid2 >= 0 && H5Gclose(gid2) < 0) {
HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
status = FAIL;
}
- if(datatype >= 0 && H5Tclose(datatype) < 0) {
+ if (datatype >= 0 && H5Tclose(datatype) < 0) {
HDfprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1);
status = FAIL;
}
- if(dset1 >= 0 && H5Dclose(dset1) < 0) {
+ if (dset1 >= 0 && H5Dclose(dset1) < 0) {
HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
status = FAIL;
}
- if(dset2 >= 0 && H5Dclose(dset2) < 0) {
+ if (dset2 >= 0 && H5Dclose(dset2) < 0) {
HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
status = FAIL;
}
- if(fileid1 >= 0 && H5Fclose(fileid1) < 0) {
+ if (fileid1 >= 0 && H5Fclose(fileid1) < 0) {
HDfprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1);
status = FAIL;
}
@@ -876,18 +850,20 @@ static int gent_softlink2(void)
dset3
*/
-static void gent_hardlink(void)
+static void
+gent_hardlink(void)
{
- hid_t fid, group, dataset, space;
+ hid_t fid, group, dataset, space;
hsize_t dim = 5;
- int i, dset[5];
+ int i, dset[5];
fid = H5Fcreate(FILE5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- space = H5Screate_simple(1, &dim, NULL);
+ space = H5Screate_simple(1, &dim, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 5; i++) dset[i] = i;
+ for (i = 0; i < 5; i++)
+ dset[i] = i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
H5Sclose(space);
@@ -910,7 +886,8 @@ static void gent_hardlink(void)
H5Fclose(fid);
}
-static void gent_extlink(void)
+static void
+gent_extlink(void)
{
hid_t fid;
@@ -922,10 +899,11 @@ static void gent_extlink(void)
H5Fclose(fid);
}
-static void gent_udlink(void)
+static void
+gent_udlink(void)
{
hid_t fid;
- char buf[4];
+ char buf[4];
H5Lregister(UD_link_class);
@@ -938,7 +916,6 @@ static void gent_udlink(void)
H5Fclose(fid);
}
-
/*
/
/ | \ \
@@ -947,69 +924,69 @@ static void gent_udlink(void)
dset2
*/
-static void gent_compound_dt(void) { /* test compound data type */
+static void
+gent_compound_dt(void)
+{ /* test compound data type */
hid_t fid, group, dataset, space, space3, type, type2;
hid_t array_dt;
typedef struct {
- int a;
- float b;
- double c;
+ int a;
+ float b;
+ double c;
} dset1_t;
dset1_t dset1[5];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset2_t;
dset2_t dset2[5];
typedef struct {
- int a[4];
- float b[5][6];
+ int a[4];
+ float b[5][6];
} dset3_t;
dset3_t dset3[3][6];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset4_t;
dset4_t dset4[5];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset5_t;
dset5_t dset5[5];
- int i, j, k, l;
+ int i, j, k, l;
unsigned ndims;
- hsize_t dim[2];
+ hsize_t dim[2];
hsize_t sdim = 5;
hsize_t dset3_dim[2];
-
- for(i = 0; i < (int)sdim; i++) {
+ for (i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
- dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F/(float)(i+1));
+ dset1[i].b = (float)(i * i);
+ dset1[i].c = (float)(1.0F / (float)(i + 1));
dset2[i].a = i;
- dset2[i].b = (float)((float)i+ (float)i*0.1F);
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset4[i].a = i;
- dset4[i].b = (float)(i+3);
+ dset4[i].b = (float)(i + 3);
dset5[i].a = i;
- dset5[i].b = (float)((float)i*0.1F);
+ dset5[i].b = (float)((float)i * 0.1F);
}
-
fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space = H5Screate_simple(1, &sdim, NULL);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE);
H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE);
@@ -1024,11 +1001,11 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Dclose(dataset);
/* shared data type 1 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE);
H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE);
H5Tcommit2(fid, "type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1039,12 +1016,12 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Tclose(type);
H5Dclose(dataset);
-
/* shared data type 2 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
- ndims = 1; dim[0] = 4;
+ ndims = 1;
+ dim[0] = 4;
array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim);
H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
@@ -1054,7 +1031,9 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
- ndims = 2; dim[0] = 5; dim[1] = 6;
+ ndims = 2;
+ dim[0] = 5;
+ dim[1] = 6;
array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim);
H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
@@ -1066,16 +1045,16 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Tcommit2(fid, "type2", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- dset3_dim[0] = 3; dset3_dim[1] = 6;
- space3 = H5Screate_simple(2, dset3_dim, NULL);
- dataset = H5Dcreate2(group, "dset3", type, space3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < (int)dset3_dim[0]; i++)
- for(j = 0; j < (int)dset3_dim[1]; j++) {
- for(k = 0; k < 4; k++)
+ dset3_dim[0] = 3;
+ dset3_dim[1] = 6;
+ space3 = H5Screate_simple(2, dset3_dim, NULL);
+ dataset = H5Dcreate2(group, "dset3", type, space3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < (int)dset3_dim[0]; i++)
+ for (j = 0; j < (int)dset3_dim[1]; j++) {
+ for (k = 0; k < 4; k++)
dset3[i][j].a[k] = k + j + i;
- for(k = 0; k < 5; k++)
- for(l = 0; l < 6; l++)
+ for (k = 0; k < 5; k++)
+ for (l = 0; l < 6; l++)
dset3[i][j].b[k][l] = (float)((k + 1) + l + j + i);
}
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
@@ -1085,8 +1064,8 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Dclose(dataset);
/* shared data type 3 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE);
H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE);
H5Tcommit2(group, "type3", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1100,7 +1079,6 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Dclose(dataset);
H5Gclose(group);
-
/* unamed data type */
group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1133,51 +1111,53 @@ static void gent_compound_dt(void) { /* test compound data type */
dset2
*/
-static void gent_compound_dt2(void) { /* test compound data type */
+static void
+gent_compound_dt2(void)
+{ /* test compound data type */
hid_t fid, group, dataset, space, type, create_plist, type2;
hid_t array_dt;
typedef struct {
- int a;
- float b;
- double c;
+ int a;
+ float b;
+ double c;
} dset1_t;
dset1_t dset1[10];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset2_t;
dset2_t dset2[10];
typedef struct {
- int a[4];
- float b[5][6];
+ int a[4];
+ float b[5][6];
} dset3_t;
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset4_t;
dset4_t dset4[10];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset5_t;
dset5_t dset5[10];
- int i;
+ int i;
unsigned ndims;
- hsize_t dim[2];
+ hsize_t dim[2];
hsize_t sdim, maxdim;
sdim = 10;
- for(i = 0; i < (int)sdim; i++) {
+ for (i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
- dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F / (float)(i+ 1));
+ dset1[i].b = (float)(i * i);
+ dset1[i].c = (float)(1.0F / (float)(i + 1));
dset2[i].a = i;
dset2[i].b = (float)((float)i + (float)i * 0.1F);
@@ -1196,12 +1176,12 @@ static void gent_compound_dt2(void) { /* test compound data type */
sdim = 2;
H5Pset_chunk(create_plist, 1, &sdim);
- sdim = 6;
+ sdim = 6;
maxdim = H5S_UNLIMITED;
space = H5Screate_simple(1, &sdim, &maxdim);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE);
H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE);
@@ -1209,7 +1189,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
dataset = H5Dcreate2(fid, "/dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT);
@@ -1222,7 +1202,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Sclose(space);
H5Dclose(dataset);
- sdim = 6;
+ sdim = 6;
maxdim = 10;
space = H5Screate_simple(1, &sdim, &maxdim);
@@ -1237,7 +1217,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
dataset = H5Dcreate2(group, "dset2", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -1246,16 +1226,18 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Tclose(type2);
H5Dclose(dataset);
-
/* shared data type 2 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
- ndims = 1; dim[0] = 4;
+ ndims = 1;
+ dim[0] = 4;
array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim);
H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
- ndims = 2; dim[0] = 5; dim[1] = 6;
+ ndims = 2;
+ dim[0] = 5;
+ dim[1] = 6;
array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim);
H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
H5Tclose(array_dt);
@@ -1271,7 +1253,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
dataset = H5Dcreate2(group, "dset4", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT);
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4);
@@ -1281,7 +1263,6 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Dclose(dataset);
H5Gclose(group);
-
/* unamed data type */
group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1290,7 +1271,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE);
H5Tcommit2(group, "type4", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset5", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT);
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5);
@@ -1305,10 +1286,8 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Pclose(create_plist);
H5Fclose(fid);
-
}
-
/*
/ : g1 g2 attr1 attr2
@@ -1320,14 +1299,15 @@ g2 : dset2.1 dset2.2 udlink
*/
-static void gent_all(void)
+static void
+gent_all(void)
{
- hid_t fid, group, attr, dataset, space;
+ hid_t fid, group, attr, dataset, space;
hsize_t dims[2];
- int data[2][2], dset1[10][10], dset2[20];
- char buf[60];
- int i, j;
- float dset2_1[10], dset2_2[3][5];
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[60];
+ int i, j;
+ float dset2_1[10], dset2_2[3][5];
fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1351,17 +1331,21 @@ static void gent_all(void)
group = H5Gopen2(fid, "/", H5P_DEFAULT);
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ dims[0] = 2;
+ dims[1] = 2;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0;
+ data[0][1] = 1;
+ data[1][0] = 2;
+ data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
H5Aclose(attr);
@@ -1371,27 +1355,28 @@ static void gent_all(void)
group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
/* dset1.1.1 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
dset1[i][j] = j * i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
H5Sclose(space);
/* attributes of dset1.1.1 */
dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "1st attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
H5Aclose(attr);
dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "2nd attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -1401,9 +1386,9 @@ static void gent_all(void)
/* dset1.1.2 */
dims[0] = 20;
- space = H5Screate_simple(1, dims, NULL);
+ space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 20; i++)
+ for (i = 0; i < 20; i++)
dset2[i] = i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
H5Sclose(space);
@@ -1423,20 +1408,21 @@ static void gent_all(void)
/* dset2.1 */
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
+ space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
dset2_1[i] = (float)((float)i * 0.1F + 1);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
H5Sclose(space);
H5Dclose(dataset);
/* dset2.2 */
- dims[0] = 3; dims[1] = 5;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 3;
+ dims[1] = 5;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 3; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 5; j++)
dset2_2[i][j] = (float)((float)(i + 1) * (float)j * 0.1F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
H5Sclose(space);
@@ -1462,7 +1448,9 @@ o - group objects
*/
-static void gent_loop(void) {
+static void
+gent_loop(void)
+{
hid_t fid, group;
fid = H5Fcreate(FILE10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1478,7 +1466,8 @@ static void gent_loop(void) {
H5Fclose(fid);
}
-static void gent_loop2(void)
+static void
+gent_loop2(void)
{
hid_t fid, group;
@@ -1515,26 +1504,26 @@ static void gent_loop2(void)
static void
gent_many(void)
{
- hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
- hid_t array_dt;
+ hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
+ hid_t array_dt;
hsize_t dims[2];
- int data[2][2], dset2[10][10], dset3[10][10];
- double d[10];
+ int data[2][2], dset2[10][10], dset3[10][10];
+ double d[10];
- char buf[60];
- int i, j;
- int i0, i1, i2, i3;
+ char buf[60];
+ int i, j;
+ int i0, i1, i2, i3;
hsize_t sdim, maxdim;
- typedef struct { /* compound type has members with rank > 1 */
- int a[2][2][2][2]; /* arrays are 2x2x2x2 */
- double b[2][2][2][2];
- double c[2][2][2][2];
+ typedef struct { /* compound type has members with rank > 1 */
+ int a[2][2][2][2]; /* arrays are 2x2x2x2 */
+ double b[2][2][2][2];
+ double c[2][2][2][2];
} dset1_t;
dset1_t dset1[6];
hsize_t dim[4];
- herr_t ret;
+ herr_t ret;
fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1548,10 +1537,10 @@ gent_many(void)
group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
dim[0] = dim[1] = dim[2] = dim[3] = 2;
- array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
H5Tclose(array_dt);
@@ -1563,7 +1552,7 @@ gent_many(void)
H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
H5Tclose(array_dt);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
@@ -1577,44 +1566,47 @@ gent_many(void)
H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
H5Tclose(array_dt);
-
/* dset1 */
- sdim = 6;
- maxdim = H5S_UNLIMITED;
- space = H5Screate_simple(1, &sdim, &maxdim);
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+ space = H5Screate_simple(1, &sdim, &maxdim);
dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
/* add attributes to dset1 */
dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_CHAR, buf);
H5Sclose(space2);
H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space2 = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ dims[0] = 2;
+ dims[1] = 2;
+ space2 = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0;
+ data[0][1] = 1;
+ data[1][0] = 2;
+ data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space2);
H5Aclose(attr);
dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 10; i++)
d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space2);
H5Aclose(attr);
- for(j=0; j<(int)sdim; j++) {
- for(i3 = 0; i3 < 2; i3++) {
- for(i2 = 0; i2 < 2; i2++) {
- for(i1 = 0; i1 < 2; i1++) {
- for(i0 = 0; i0 < 2; i0++) {
+ for (j = 0; j < (int)sdim; j++) {
+ for (i3 = 0; i3 < 2; i3++) {
+ for (i2 = 0; i2 < 2; i2++) {
+ for (i1 = 0; i1 < 2; i1++) {
+ for (i0 = 0; i0 < 2; i0++) {
dset1[j].a[i3][i2][i1][i0] = i0 + j;
dset1[j].b[i3][i2][i1][i0] = (double)(i0 + j);
dset1[j].c[i3][i2][i1][i0] = (double)((hsize_t)i0 + (hsize_t)j + sdim);
@@ -1647,12 +1639,13 @@ gent_many(void)
group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* dset2 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
dset2[i][j] = j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -1670,12 +1663,13 @@ gent_many(void)
group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* dset3 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
dset3[i][j] = i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
@@ -1708,60 +1702,60 @@ gent_many(void)
H5Fclose(fid);
}
-static hid_t mkstr(int size, H5T_str_t pad) {
+static hid_t
+mkstr(int size, H5T_str_t pad)
+{
hid_t type;
- if((type=H5Tcopy(H5T_C_S1)) < 0) return -1;
- if(H5Tset_size(type, (size_t)size) < 0) return -1;
- if(H5Tset_strpad(type, pad) < 0) return -1;
+ if ((type = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if (H5Tset_size(type, (size_t)size) < 0)
+ return -1;
+ if (H5Tset_strpad(type, pad) < 0)
+ return -1;
return type;
}
-static void gent_str(void) {
+static void
+gent_str(void)
+{
hid_t fid, dataset, space, f_type, m_type, str_type, f_type2;
hid_t array_dt;
- hsize_t dims1[] = { 3, 4};
- char string1[12][3] = {"s1","s2","s3","s4","s5","s6","s7","s8","s9",
- "s0","s1","s2"};
-
- hsize_t dims2[]={20};
- char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4",
- "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2",
- "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6",
- "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
-
- hsize_t dims3[] = { 27};
- char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3",
- "abcd4", "abcd5", "abcd6", "abcd7",
- "abcd8", "abcd9", "abcd0", "abcd1",
- "abcd2", "abcd3", "abcd4", "abcd5",
- "abcd6", "abcd7", "abcd8", "abcd9",
- "abcd0", "abcd1", "abcd2", "abcd3",
- "abcd4", "abcd5", "abcd6"};
+ hsize_t dims1[] = {3, 4};
+ char string1[12][3] = {"s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s0", "s1", "s2"};
+
+ hsize_t dims2[] = {20};
+ char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0",
+ "ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+
+ hsize_t dims3[] = {27};
+ char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8",
+ "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7",
+ "abcd8", "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6"};
int i, j, k, l;
- hsize_t dims4[] = { 3 };
- char string4[3][21] = { "s1234567890123456789", "s1234567890123456789",
- "s1234567890123456789"};
+ hsize_t dims4[] = {3};
+ char string4[3][21] = {"s1234567890123456789", "s1234567890123456789", "s1234567890123456789"};
- hsize_t dims5[] = { 3, 6};
+ hsize_t dims5[] = {3, 6};
typedef struct {
- int a[8][10];
- char s[12][33];
+ int a[8][10];
+ char s[12][33];
} compound_t;
compound_t comp1[3][6];
- hsize_t mdims[2];
+ hsize_t mdims[2];
fid = H5Fcreate(FILE13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* string 1 : nullterm string */
- space = H5Screate_simple(2, dims1, NULL);
- f_type = mkstr(5, H5T_STR_NULLTERM);
- m_type = mkstr(3, H5T_STR_NULLTERM);
+ space = H5Screate_simple(2, dims1, NULL);
+ f_type = mkstr(5, H5T_STR_NULLTERM);
+ m_type = mkstr(3, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1);
H5Tclose(m_type);
@@ -1770,9 +1764,9 @@ static void gent_str(void) {
H5Dclose(dataset);
/* string 2 : space pad string */
- space = H5Screate_simple(1, dims2, NULL);
- f_type = mkstr(11, H5T_STR_SPACEPAD);
- m_type = mkstr(10, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims2, NULL);
+ f_type = mkstr(11, H5T_STR_SPACEPAD);
+ m_type = mkstr(10, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2);
H5Tclose(m_type);
@@ -1781,9 +1775,9 @@ static void gent_str(void) {
H5Dclose(dataset);
/* string 3 : null pad string */
- space = H5Screate_simple(1, dims3, NULL);
- f_type = mkstr(8, H5T_STR_NULLPAD);
- m_type = mkstr(6, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims3, NULL);
+ f_type = mkstr(8, H5T_STR_NULLPAD);
+ m_type = mkstr(6, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3);
H5Tclose(m_type);
@@ -1792,9 +1786,9 @@ static void gent_str(void) {
H5Dclose(dataset);
/* string 4 : space pad long string */
- space = H5Screate_simple(1, dims4, NULL);
- f_type = mkstr(168, H5T_STR_SPACEPAD);
- m_type = mkstr(21, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_SPACEPAD);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4);
H5Tclose(m_type);
@@ -1803,11 +1797,12 @@ static void gent_str(void) {
H5Dclose(dataset);
/* compound data */
- space = H5Screate_simple(2, dims5, NULL);
- f_type = H5Tcreate (H5T_COMPOUND, sizeof(compound_t));
- f_type2 = H5Tcreate (H5T_COMPOUND, sizeof(compound_t));
+ space = H5Screate_simple(2, dims5, NULL);
+ f_type = H5Tcreate(H5T_COMPOUND, sizeof(compound_t));
+ f_type2 = H5Tcreate(H5T_COMPOUND, sizeof(compound_t));
- mdims[0] = 8; mdims[1] = 10;
+ mdims[0] = 8;
+ mdims[1] = 10;
array_dt = H5Tarray_create2(H5T_STD_I32BE, 2, mdims);
H5Tinsert(f_type, "int_array", HOFFSET(compound_t, a), array_dt);
@@ -1817,7 +1812,8 @@ static void gent_str(void) {
H5Tinsert(f_type2, "int_array", HOFFSET(compound_t, a), array_dt);
H5Tclose(array_dt);
- mdims[0] = 3; mdims[1] = 4;
+ mdims[0] = 3;
+ mdims[1] = 4;
str_type = mkstr(32, H5T_STR_SPACEPAD);
array_dt = H5Tarray_create2(str_type, 2, mdims);
@@ -1831,12 +1827,12 @@ static void gent_str(void) {
H5Tclose(array_dt);
H5Tclose(str_type);
- for(i = 0; i < 3; i++)
- for(j = 0; j < 6; j++) {
- for(k = 0 ; k < 8; k++)
- for(l = 0; l < 10; l++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++) {
+ for (k = 0; k < 8; k++)
+ for (l = 0; l < 10; l++)
comp1[i][j].a[k][l] = (l + j + k) * (l + j + k);
- for(k = 0 ; k < 12; k++)
+ for (k = 0; k < 12; k++)
HDstrcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678");
}
@@ -1860,17 +1856,17 @@ static void gent_str(void) {
string2 string4 string6
*/
-static void gent_str2(void)
+static void
+gent_str2(void)
{
- hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space;
- hid_t fxdlenstr, fxdlenstr2, memtype;
+ hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space;
+ hid_t fxdlenstr, fxdlenstr2, memtype;
hsize_t dims[1], size[1], stride[1], count[1], block[1];
hsize_t start[1];
-
- int i;
- char buf[LENSTR+20];
- char buf2[3*LENSTR2];
+ int i;
+ char buf[LENSTR + 20];
+ char buf2[3 * LENSTR2];
hsize_t sdim;
fid = H5Fcreate(FILE14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1885,16 +1881,16 @@ static void gent_str2(void)
H5Tset_cset(memtype, H5T_CSET_ASCII);
H5Tset_strpad(memtype, H5T_STR_NULLTERM);
- sdim = 10;
- size[0] = sdim;
- space = H5Screate_simple(1, size, NULL);
- size[0] = 1;
- mem_space = H5Screate_simple(1,size,NULL);
+ sdim = 10;
+ size[0] = sdim;
+ space = H5Screate_simple(1, size, NULL);
+ size[0] = 1;
+ mem_space = H5Screate_simple(1, size, NULL);
hyper_space = H5Scopy(space);
/* dset1 */
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset1", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* add attributes to dset1 */
@@ -1905,71 +1901,69 @@ static void gent_str2(void)
H5Tset_strpad(fxdlenstr2, H5T_STR_NULLTERM);
dims[0] = 3;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(&(buf2[0*LENSTR2]), "0123456789");
- HDsprintf(&(buf2[1*LENSTR2]), "abcdefghij");
- HDsprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ");
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT);
+ HDsprintf(&(buf2[0 * LENSTR2]), "0123456789");
+ HDsprintf(&(buf2[1 * LENSTR2]), "abcdefghij");
+ HDsprintf(&(buf2[2 * LENSTR2]), "ABCDEFGHIJ");
H5Awrite(attr, fxdlenstr2, buf2);
H5Sclose(space2);
H5Tclose(fxdlenstr2);
H5Aclose(attr);
- stride[0]=1;
- count[0]=1;
- block[0]=1;
+ stride[0] = 1;
+ count[0] = 1;
+ block[0] = 1;
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
H5Dclose(dataset);
H5Gclose(group);
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
H5Dclose(dataset);
H5Gclose(group);
-
H5Tclose(fxdlenstr);
fxdlenstr = H5Tcopy(H5T_C_S1);
H5Tset_size(fxdlenstr, LENSTR);
H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
H5Tset_strpad(fxdlenstr, H5T_STR_NULLPAD);
- group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0;(hsize_t) i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
H5Dclose(dataset);
H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
@@ -1982,10 +1976,10 @@ static void gent_str2(void)
H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
H5Tset_strpad(fxdlenstr, H5T_STR_SPACEPAD);
- group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
@@ -1995,11 +1989,10 @@ static void gent_str2(void)
H5Dclose(dataset);
H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
@@ -2017,30 +2010,29 @@ static void gent_str2(void)
H5Fclose(fid);
}
-static void gent_enum(void)
+static void
+gent_enum(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t file, type, space, dset;
- int val;
- enumtype data[] = {RED, GREEN, BLUE, GREEN, WHITE,
- WHITE, BLACK, GREEN, BLUE, RED,
- RED, BLUE, GREEN, BLACK, WHITE,
- RED, WHITE, GREEN, GREEN, BLUE};
- hsize_t size[1] = {NELMTS(data)};
+ hid_t file, type, space, dset;
+ int val;
+ enumtype data[] = {RED, GREEN, BLUE, GREEN, WHITE, WHITE, BLACK, GREEN, BLUE, RED,
+ RED, BLUE, GREEN, BLACK, WHITE, RED, WHITE, GREEN, GREEN, BLUE};
+ hsize_t size[1] = {NELMTS(data)};
- file = H5Fcreate(FILE15,H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Try to test names with special characters */
type = H5Tcreate(H5T_ENUM, sizeof(enumtype));
- H5Tenum_insert(type, "RED", (val = 0, &val));
+ H5Tenum_insert(type, "RED", (val = 0, &val));
H5Tenum_insert(type, "GREEN\ngreen", (val = 1, &val));
- H5Tenum_insert(type, "BLUE blue", (val = 2, &val));
+ H5Tenum_insert(type, "BLUE blue", (val = 2, &val));
H5Tenum_insert(type, "WHITE \"white\"", (val = 3, &val));
H5Tenum_insert(type, "BLACK \'black\'", (val = 4, &val));
H5Tcommit2(file, "enum normal", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- space = H5Screate_simple(1,size,NULL);
- dset = H5Dcreate2(file,"table",type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, size, NULL);
+ dset = H5Dcreate2(file, "table", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dset, type, space, space, H5P_DEFAULT, data);
H5Dclose(dset);
@@ -2048,27 +2040,28 @@ static void gent_enum(void)
H5Fclose(file);
}
-static void gent_objref(void)
+static void
+gent_objref(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
-
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- uint32_t *tu32; /* Temporary pointer to uint32 data */
- int i; /* counting variables */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ uint32_t * tu32; /* Temporary pointer to uint32 data */
+ int i; /* counting variables */
const char *write_comment = "Foo!"; /* Comments for group */
/* Allocate write & read buffers */
- wbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- rbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- tbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2085,7 +2078,7 @@ static void gent_objref(void)
/* Create a dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++)
+ for (tu32 = (uint32_t *)((void *)wbuf), i = 0; i < SPACE1_DIM1; i++)
*tu32++ = (uint32_t)(i * 3);
/* Write selection to disk */
@@ -2104,11 +2097,11 @@ static void gent_objref(void)
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
/* Insert fields */
- H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_STD_I32BE);
+ H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_STD_I32BE);
- H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_IEEE_F32BE);
+ H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_IEEE_F32BE);
- H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_IEEE_F32BE);
+ H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_IEEE_F32BE);
/* Save datatype for later */
H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -2152,34 +2145,34 @@ static void gent_objref(void)
HDfree(tbuf);
}
-static void gent_datareg(void)
+static void
+gent_datareg(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- int i; /* counting variables */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ int i; /* counting variables */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2190,7 +2183,7 @@ static void gent_datareg(void)
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
@@ -2208,10 +2201,14 @@ static void gent_datareg(void)
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 6;
- block[0] = 1; block[1] = 1;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
H5Sget_select_npoints(sid2);
@@ -2220,25 +2217,35 @@ static void gent_datareg(void)
H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Select sequence of ten points for second reference */
- coord1[0][0]=6; coord1[0][1]=9;
- coord1[1][0]=2; coord1[1][1]=2;
- coord1[2][0]=8; coord1[2][1]=4;
- coord1[3][0]=1; coord1[3][1]=6;
- coord1[4][0]=2; coord1[4][1]=8;
- coord1[5][0]=3; coord1[5][1]=2;
- coord1[6][0]=0; coord1[6][1]=4;
- coord1[7][0]=9; coord1[7][1]=0;
- coord1[8][0]=7; coord1[8][1]=1;
- coord1[9][0]=3; coord1[9][1]=3;
- H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ H5Sselect_elements(sid2, H5S_SELECT_SET, POINT1_NPOINTS, (hsize_t *)coord1);
H5Sget_select_npoints(sid2);
/* Store second dataset region */
- H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+ H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Write selection to disk */
- H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/* Close disk dataspace */
H5Sclose(sid1);
@@ -2259,36 +2266,37 @@ static void gent_datareg(void)
HDfree(drbuf);
}
-static void gent_attrreg(void)
+static void
+gent_attrreg(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1; /* Dataset ID */
- hid_t dset2; /* Dereferenced dataset ID */
- hid_t sid1; /* Dataspace ID #1 */
- hid_t sid2; /* Dataspace ID #2 */
- hid_t sid3; /* Dataspace ID #3 */
- hid_t attr1; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hdset_reg_ref_t *wbuf; /* buffer to write to disk */
- hdset_reg_ref_t *rbuf; /* buffer read from disk */
- uint8_t *dwbuf; /* Buffer for writing numeric data to disk */
- uint8_t *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- int i; /* counting variables */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1; /* Dataset ID */
+ hid_t dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID #1 */
+ hid_t sid2; /* Dataspace ID #2 */
+ hid_t sid3; /* Dataspace ID #3 */
+ hid_t attr1; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hdset_reg_ref_t *wbuf; /* buffer to write to disk */
+ hdset_reg_ref_t *rbuf; /* buffer read from disk */
+ uint8_t * dwbuf; /* Buffer for writing numeric data to disk */
+ uint8_t * drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8; /* Temporary pointer to uint8 data */
+ int i; /* counting variables */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2299,7 +2307,7 @@ static void gent_attrreg(void)
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
@@ -2312,18 +2320,21 @@ static void gent_attrreg(void)
* Create dataset with a null dataspace to serve as the parent for
* the attribute.
*/
- sid1 = H5Screate (H5S_NULL);
- dset1 = H5Dcreate2 (fid1, "Dataset1", H5T_STD_I32LE, sid1, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- H5Sclose (sid1);
+ sid1 = H5Screate(H5S_NULL);
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_I32LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Sclose(sid1);
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 6;
- block[0] = 1; block[1] = 1;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
H5Sget_select_npoints(sid2);
@@ -2332,36 +2343,45 @@ static void gent_attrreg(void)
H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Select sequence of ten points for second reference */
- coord1[0][0]=6; coord1[0][1]=9;
- coord1[1][0]=2; coord1[1][1]=2;
- coord1[2][0]=8; coord1[2][1]=4;
- coord1[3][0]=1; coord1[3][1]=6;
- coord1[4][0]=2; coord1[4][1]=8;
- coord1[5][0]=3; coord1[5][1]=2;
- coord1[6][0]=0; coord1[6][1]=4;
- coord1[7][0]=9; coord1[7][1]=0;
- coord1[8][0]=7; coord1[8][1]=1;
- coord1[9][0]=3; coord1[9][1]=3;
- H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ H5Sselect_elements(sid2, H5S_SELECT_SET, POINT1_NPOINTS, (hsize_t *)coord1);
H5Sget_select_npoints(sid2);
/* Store second dataset region */
- H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+ H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Create dataspace for the attribute */
sid3 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
/* Create the attribute and write the region references to it. */
- attr1 = H5Acreate2 (dset1, "Attribute1", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT,
- H5P_DEFAULT);
- H5Awrite (attr1, H5T_STD_REF_DSETREG, wbuf);
+ attr1 = H5Acreate2(dset1, "Attribute1", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr1, H5T_STD_REF_DSETREG, wbuf);
/* Close attribute dataspace */
H5Sclose(sid3);
/* Close attribute */
- H5Aclose (attr1);
+ H5Aclose(attr1);
/* Close Dataset */
H5Dclose(dset1);
@@ -2380,48 +2400,48 @@ static void gent_attrreg(void)
}
/*taken from Elena's compound test file*/
-static void gent_nestcomp(void)
+static void
+gent_nestcomp(void)
{
/* Compound memeber of the compound datatype*/
typedef struct cmp_t {
- char a;
- float b[2];
+ char a;
+ float b[2];
} cmp_t;
/* First structure and dataset*/
typedef struct s1_t {
- int a;
- float b;
- double c;
- cmp_t d;
+ int a;
+ float b;
+ double c;
+ cmp_t d;
} s2_t;
- hid_t cmp_tid; /* Handle for the compound datatype */
- hid_t char_id; /* Handle for the string datatype */
- hid_t array_dt;
- hsize_t array_dims[] = {2}; /* Dataspace dimensions */
- unsigned ndims = 1; /* Number of dimensions in the array field */
+ hid_t cmp_tid; /* Handle for the compound datatype */
+ hid_t char_id; /* Handle for the string datatype */
+ hid_t array_dt;
+ hsize_t array_dims[] = {2}; /* Dataspace dimensions */
+ unsigned ndims = 1; /* Number of dimensions in the array field */
- s2_t s1[10];
- hid_t s2_tid; /* File datatype identifier */
+ s2_t s1[10];
+ hid_t s2_tid; /* File datatype identifier */
- int i;
- hid_t file, dataset, space; /* Handles */
- herr_t status;
- hsize_t dim[] = {10}; /* Dataspace dimensions */
+ int i;
+ hid_t file, dataset, space; /* Handles */
+ herr_t status;
+ hsize_t dim[] = {10}; /* Dataspace dimensions */
char datasetname[] = "ArrayOfStructures";
-
/*
* Initialize the data
*/
- for(i = 0; i< 10; i++) {
- s1[i].a = i;
- s1[i].b = (float)(i*i);
- s1[i].c = 1.0F/(float)(i + 1);
- s1[i].d.a = (char)(65 + i);
+ for (i = 0; i < 10; i++) {
+ s1[i].a = i;
+ s1[i].b = (float)(i * i);
+ s1[i].c = 1.0F / (float)(i + 1);
+ s1[i].d.a = (char)(65 + i);
s1[i].d.b[0] = -100.0F;
- s1[i].d.b[1] = 100.0F;
+ s1[i].d.b[1] = 100.0F;
}
/*
@@ -2440,7 +2460,7 @@ static void gent_nestcomp(void)
/*
* Create a datatype for compound field first.
*/
- cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof(cmp_t));
+ cmp_tid = H5Tcreate(H5T_COMPOUND, sizeof(cmp_t));
/* We are using C string of length one to represent "real" character */
char_id = H5Tcopy(H5T_C_S1);
@@ -2451,7 +2471,7 @@ static void gent_nestcomp(void)
H5Tinsert(cmp_tid, "array_name", HOFFSET(cmp_t, b), array_dt);
H5Tclose(array_dt);
- s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t));
+ s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT);
H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
H5Tinsert(s2_tid, "b_name", HOFFSET(s2_t, b), H5T_NATIVE_FLOAT);
@@ -2468,7 +2488,7 @@ static void gent_nestcomp(void)
* Wtite data to the dataset;
*/
status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
- if(status < 0)
+ if (status < 0)
HDfprintf(stderr, "gent_nestcomp H5Dwrite failed\n");
/*
@@ -2482,14 +2502,15 @@ static void gent_nestcomp(void)
H5Fclose(file);
}
-static void gent_opaque(void)
+static void
+gent_opaque(void)
{
- hid_t file, type, dataset, space;
- char test[100][2];
- int x;
+ hid_t file, type, dataset, space;
+ char test[100][2];
+ int x;
hsize_t dim = 2;
- for(x = 0; x < 100; x++){
+ for (x = 0; x < 100; x++) {
test[x][0] = (char)x;
test[x][1] = (char)(99 - x);
}
@@ -2526,83 +2547,94 @@ static void gent_opaque(void)
H5Fclose(file);
}
-static void gent_bitfields(void)
+static void
+gent_bitfields(void)
{
- hid_t file, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
- size_t i;
- hsize_t nelmts;
+ hid_t file, grp = H5I_INVALID_HID, type = H5I_INVALID_HID, space = H5I_INVALID_HID,
+ dset = H5I_INVALID_HID;
+ size_t i;
+ hsize_t nelmts;
unsigned char buf[32];
file = H5Fcreate(FILE20, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* bitfield_1 */
nelmts = sizeof(buf);
- if((type = H5Tcopy(H5T_STD_B8LE)) < 0 ||
- (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((type = H5Tcopy(H5T_STD_B8LE)) < 0 || (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < sizeof buf; i++)
+ for (i = 0; i < sizeof buf; i++)
buf[i] = (uint8_t)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
/* bitfield_2 */
- nelmts = sizeof(buf)/2;
- if((type = H5Tcopy(H5T_STD_B16LE)) < 0 ||
- (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ nelmts = sizeof(buf) / 2;
+ if ((type = H5Tcopy(H5T_STD_B16LE)) < 0 || (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < sizeof buf; i++)
+ for (i = 0; i < sizeof buf; i++)
buf[i] = (uint8_t)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Gclose(grp) < 0)
goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
H5Fclose(file);
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp);
H5Tclose(type);
H5Sclose(space);
H5Dclose(dset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
-static void gent_vldatatypes(void)
+static void
+gent_vldatatypes(void)
{
- hvl_t adata, wdata[SPACE1_DIM1];
- hid_t file, dset, space, type;
- hsize_t dims[] = { SPACE1_DIM1 };
- int i;
- herr_t ret=0;
+ hvl_t adata, wdata[SPACE1_DIM1];
+ hid_t file, dset, space, type;
+ hsize_t dims[] = {SPACE1_DIM1};
+ int i;
+ herr_t ret = 0;
file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Allocate and initialize VL dataset to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
wdata[i].len = (size_t)(i + 1);
- for(j = 0; j < i + 1; j++)
+ for (j = 0; j < i + 1; j++)
((int *)wdata[i].p)[j] = i * 10 + j;
}
/* write out the integers in little-endian format */
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
- type = H5Tvlen_create(H5T_NATIVE_INT);
- dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
@@ -2615,21 +2647,21 @@ static void gent_vldatatypes(void)
HDassert(ret >= 0);
/* Allocate and initialize VL dataset to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
wdata[i].len = (size_t)(i + 1);
- for(j = 0; j < i + 1; j++)
+ for (j = 0; j < i + 1; j++)
((float *)wdata[i].p)[j] = (float)((float)(i * 10) + ((float)j) / 10.0F);
} /* end for */
/* write out the floats in little-endian format */
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
- type = H5Tvlen_create(H5T_NATIVE_FLOAT);
- dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ type = H5Tvlen_create(H5T_NATIVE_FLOAT);
+ dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
@@ -2642,17 +2674,17 @@ static void gent_vldatatypes(void)
HDassert(ret >= 0);
/* Allocate and initialize a scalar VL dataset to write */
- adata.p = HDmalloc(37 * sizeof(int));
+ adata.p = HDmalloc(37 * sizeof(int));
adata.len = 37;
- for(i = 0; i < 37; i++)
+ for (i = 0; i < 37; i++)
((int *)adata.p)[i] = i * 2;
/* write out scalar VL dataset in little-endian format */
space = H5Screate_simple(0, NULL, NULL);
- type = H5Tvlen_create(H5T_NATIVE_INT);
- dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
HDassert(ret >= 0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata);
HDassert(ret >= 0);
@@ -2670,35 +2702,35 @@ static void gent_vldatatypes(void)
static void
gent_vldatatypes2(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t *t1; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t * t1; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ unsigned i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t));
- if(wdata[i].p == NULL) {
+ if (wdata[i].p == NULL) {
HDprintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
wdata[i].len = i + 1;
- for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ for (t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned));
- if(t1->p == NULL) {
- HDprintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ if (t1->p == NULL) {
+ HDprintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*100+j*10+k;
+ t1->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILE22, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2734,32 +2766,32 @@ gent_vldatatypes2(void)
HDassert(ret >= 0);
ret = H5Fclose(fid1);
HDassert(ret >= 0);
-
}
-static void gent_vldatatypes3(void)
+static void
+gent_vldatatypes3(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ unsigned i, j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i = (int)(i * 10);
- wdata[i].f = (float)((float)(i * 20)/3.0F);
- wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)((float)(i * 20) / 3.0F);
+ wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
wdata[i].v.len = (size_t)(i + 1);
- for(j = 0; j < (i + 1); j++)
+ for (j = 0; j < (i + 1); j++)
((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
@@ -2807,30 +2839,31 @@ static void gent_vldatatypes3(void)
HDassert(ret >= 0);
}
-static void gent_vldatatypes4(void)
+static void
+gent_vldatatypes4(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
} s1;
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ unsigned i, j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
wdata[i].len = i + 1;
- for(j = 0; j < (i + 1); j++) {
+ for (j = 0; j < (i + 1); j++) {
((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
((s1 *)wdata[i].p)[j].f = (float)((float)(i * 20 + j) / 3.0F);
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILE24, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2875,46 +2908,47 @@ static void gent_vldatatypes4(void)
}
/* Generate a variable-length dataset with NULL values in it */
-static void gent_vldatatypes5(void)
+static void
+gent_vldatatypes5(void)
{
- hvl_t wdata [SPACE1_DIM1];
- hid_t fid1;
- hid_t dataset;
- hid_t sid1;
- hid_t tid1;
- hsize_t dims1[] = {SPACE1_DIM1};
- int i,j; /* counting variable */
+ hvl_t wdata[SPACE1_DIM1];
+ hid_t fid1;
+ hid_t dataset;
+ hid_t sid1;
+ hid_t tid1;
+ hsize_t dims1[] = {SPACE1_DIM1};
+ int i, j; /* counting variable */
herr_t ret; /* Generic return value */
/* initialize data for dataset */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(i%2) {
- wdata[i].len=0;
- wdata[i].p=NULL;
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (i % 2) {
+ wdata[i].len = 0;
+ wdata[i].p = NULL;
} /* end if */
else {
wdata[i].len = (size_t)(i + 5);
- wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
- for(j = 0; j < i + 5; j++)
+ wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
+ for (j = 0; j < i + 5; j++)
((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2);
} /* end else */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILE43, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid1>0);
+ HDassert(fid1 > 0);
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- HDassert(sid1>0);
+ HDassert(sid1 > 0);
/* Create a datatype to refer to */
tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
- HDassert(tid1>0);
+ HDassert(tid1 > 0);
/* Create a dataset */
dataset = H5Dcreate2(fid1, F43_DSETNAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(dataset>0);
+ HDassert(dataset > 0);
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
@@ -2928,10 +2962,10 @@ static void gent_vldatatypes5(void)
ret = H5Tclose(tid1);
HDassert(ret >= 0);
- ret = H5Sclose (sid1);
+ ret = H5Sclose(sid1);
HDassert(ret >= 0);
- ret = H5Fclose (fid1);
+ ret = H5Fclose(fid1);
HDassert(ret >= 0);
}
@@ -2942,43 +2976,43 @@ static void gent_vldatatypes5(void)
display array indices every 262 x N (N > 0) based on 2000x1000 dims.
*/
#define SPACE_ARRAY1BIG_DIM 2000
-#define ARRAY1BIG_DIM 1000
+#define ARRAY1BIG_DIM 1000
-static void gent_array1_big(void)
+static void
+gent_array1_big(void)
{
- int *wdata; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM};
- hsize_t tdims1[] = {ARRAY1BIG_DIM};
- int i,j; /* counting variables */
+ int * wdata; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM};
+ hsize_t tdims1[] = {ARRAY1BIG_DIM};
+ int i, j; /* counting variables */
herr_t ret; /* Generic return value */
-
/* for region reference dataset */
- hid_t dset2;
- hid_t sid2;
- hsize_t dims2[] = {SPACE1_DIM1};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- hdset_reg_ref_t *wbuf; /* buffer to write to disk */
-
- start[0] = 0;
+ hid_t dset2;
+ hid_t sid2;
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t *wbuf; /* buffer to write to disk */
+
+ start[0] = 0;
stride[0] = 1;
- count[0] = 999;
- block[0] = 1;
+ count[0] = 999;
+ block[0] = 1;
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
wdata = (int *)HDmalloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE_ARRAY1BIG_DIM; i++)
- for(j = 0; j < ARRAY1BIG_DIM; j++)
+ for (i = 0; i < SPACE_ARRAY1BIG_DIM; i++)
+ for (j = 0; j < ARRAY1BIG_DIM; j++)
*(wdata + (i * ARRAY1BIG_DIM) + j) = i * 1;
/* Create file */
@@ -3018,7 +3052,7 @@ static void gent_array1_big(void)
H5Rcreate(&wbuf[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid1);
/* Write selection to disk */
- H5Dwrite(dset2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ H5Dwrite(dset2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -3035,22 +3069,23 @@ static void gent_array1_big(void)
HDfree(wdata);
}
-static void gent_array1(void)
+static void
+gent_array1(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j; /* counting variables */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j; /* counting variables */
herr_t ret; /* Generic return value */
/* Allocate and initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++)
- wdata[i][j]=i*10+j;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ wdata[i][j] = i * 10 + j;
/* Create file */
fid1 = H5Fcreate(FILE25, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3079,24 +3114,25 @@ static void gent_array1(void)
HDassert(ret >= 0);
}
-static void gent_array2(void)
+static void
+gent_array2(void)
{
- int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims2[] = {ARRAY2_DIM1, ARRAY2_DIM2, ARRAY2_DIM3};
+ int i, j, k, l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY2_DIM1; j++)
- for(k=0; k<ARRAY2_DIM2; k++)
- for(l=0; l<ARRAY2_DIM3; l++)
- wdata[i][j][k][l]=i*1000+j*100+k*10+l;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY2_DIM1; j++)
+ for (k = 0; k < ARRAY2_DIM2; k++)
+ for (l = 0; l < ARRAY2_DIM3; l++)
+ wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
fid = H5Fcreate(FILE26, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3125,26 +3161,27 @@ static void gent_array2(void)
HDassert(ret >= 0);
}
-static void gent_array3(void)
+static void
+gent_array3(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid1; /* 1-D array Datatype ID */
- hid_t tid2; /* 2-D array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t tdims2[] = {ARRAY3_DIM1, ARRAY3_DIM2};
+ int i, j, k, l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++)
- for(k=0; k<ARRAY3_DIM1; k++)
- for(l=0; l<ARRAY3_DIM2; l++)
- wdata[i][j][k][l]=i*1000+j*100+k*10+l;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ for (k = 0; k < ARRAY3_DIM1; k++)
+ for (l = 0; l < ARRAY3_DIM2; l++)
+ wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
fid = H5Fcreate(FILE27, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3178,26 +3215,27 @@ static void gent_array3(void)
HDassert(ret >= 0);
}
-static void gent_array4(void)
+static void
+gent_array4(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
- float f;
+ typedef struct { /* Typedef for compound datatype */
+ int i;
+ float f;
} s2_t;
- s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j; /* counting variables */
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j; /* counting variables */
herr_t ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
wdata[i][j].f = (float)((float)i * 2.5F + (float)j);
} /* end for */
@@ -3244,29 +3282,30 @@ static void gent_array4(void)
HDassert(ret >= 0);
}
-static void gent_array5(void)
+static void
+gent_array5(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
- float f[ARRAY1_DIM1];
+ typedef struct { /* Typedef for compound datatype */
+ int i;
+ float f[ARRAY1_DIM1];
} s2_t;
- s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
- for(k=0; k<ARRAY1_DIM1; k++)
+ for (k = 0; k < ARRAY1_DIM1; k++)
wdata[i][j].f[k] = (float)((float)i * 10 + (float)j * 2.5F + (float)k);
} /* end for */
@@ -3280,14 +3319,14 @@ static void gent_array5(void)
tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
/* Insert integer field */
- ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s2_t, i), H5T_NATIVE_INT);
HDassert(ret >= 0);
/* Create an array of floats datatype */
tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1);
/* Insert float array field */
- ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s2_t, f), tid3);
HDassert(ret >= 0);
/* Close array of floats field datatype */
@@ -3319,25 +3358,26 @@ static void gent_array5(void)
HDassert(ret >= 0);
}
-static void gent_array6(void)
+static void
+gent_array6(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
wdata[i][j].len = (size_t)(i + j + 1);
- for(k = 0; k < (i + j + 1); k++)
+ for (k = 0; k < (i + j + 1); k++)
((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k);
} /* end for */
@@ -3379,28 +3419,30 @@ static void gent_array6(void)
HDassert(ret >= 0);
}
-static void gent_array7(void)
+static void
+gent_array7(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j,k,l; /* Index variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j, k, l; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
wdata[i][j].len = (size_t)(i + j + 1);
- for(k = 0; k < (i + j + 1); k++)
- for(l = 0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] = (unsigned)(i * 1000+j * 100+k * 10 + l);
+ for (k = 0; k < (i + j + 1); k++)
+ for (l = 0; l < ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] =
+ (unsigned)(i * 1000 + j * 100 + k * 10 + l);
} /* end for */
/* Create file */
@@ -3449,16 +3491,17 @@ static void gent_array7(void)
}
/* Test the boundary of the display output buffer at the reallocation event */
-static void gent_array8(void)
+static void
+gent_array8(void)
{
- hid_t file = H5I_INVALID_HID; /* Handles */
- hid_t filetype = H5I_INVALID_HID; /* Handles */
- hid_t space = H5I_INVALID_HID; /* Handles */
- hid_t dset = H5I_INVALID_HID; /* Handles */
- herr_t status = -1;
- hsize_t sdims[] = {F64_DIM0};
- hsize_t tdims[] = {F64_DIM1};
- int wdata[F64_DIM1]; /* Write buffer */
+ hid_t file = H5I_INVALID_HID; /* Handles */
+ hid_t filetype = H5I_INVALID_HID; /* Handles */
+ hid_t space = H5I_INVALID_HID; /* Handles */
+ hid_t dset = H5I_INVALID_HID; /* Handles */
+ herr_t status = -1;
+ hsize_t sdims[] = {F64_DIM0};
+ hsize_t tdims[] = {F64_DIM1};
+ int wdata[F64_DIM1]; /* Write buffer */
unsigned int i;
/*
@@ -3471,53 +3514,53 @@ static void gent_array8(void)
/*
* Create a new file using the default properties.
*/
- file = H5Fcreate (FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*
* Create array datatypes for file and memory.
*/
- filetype = H5Tarray_create2 (H5T_NATIVE_INT, 1, tdims);
+ filetype = H5Tarray_create2(H5T_NATIVE_INT, 1, tdims);
/*
* Create dataspace. Setting maximum size to NULL sets the maximum
* size to be the current size.
*/
- space = H5Screate_simple (1, sdims, NULL);
+ space = H5Screate_simple(1, sdims, NULL);
/*
* Create the dataset and write the array data to it.
*/
- if(file>=0 && filetype>=0 && space>=0) {
- dset = H5Dcreate2 (file, F64_DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
- if(dset>=0)
- status = H5Dwrite (dset, filetype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
- HDassert(status >= 0);
+ if (file >= 0 && filetype >= 0 && space >= 0) {
+ dset = H5Dcreate2(file, F64_DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset >= 0)
+ status = H5Dwrite(dset, filetype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(status >= 0);
}
/*
* Close and release resources.
*/
- status = H5Dclose (dset);
+ status = H5Dclose(dset);
HDassert(status >= 0);
- status = H5Sclose (space);
+ status = H5Sclose(space);
HDassert(status >= 0);
- status = H5Tclose (filetype);
+ status = H5Tclose(filetype);
HDassert(status >= 0);
- status = H5Fclose (file);
+ status = H5Fclose(file);
HDassert(status >= 0);
}
-static void gent_empty(void)
+static void
+gent_empty(void)
{
typedef struct {
- int a;
- float b;
- char c;
+ int a;
+ float b;
+ char c;
} empty_struct;
- hid_t file, dset, space, type;
- hsize_t dims[] = { SPACE1_DIM1 };
- herr_t ret=0;
+ hid_t file, dset, space, type;
+ hsize_t dims[] = {SPACE1_DIM1};
+ herr_t ret = 0;
file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3554,10 +3597,10 @@ static void gent_empty(void)
HDassert(ret >= 0);
/* write out an empty compound dataset */
- type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct));
- H5Tinsert(type, "a", HOFFSET(empty_struct, a),H5T_NATIVE_INT);
- H5Tinsert(type, "b", HOFFSET(empty_struct, b),H5T_NATIVE_FLOAT);
- H5Tinsert(type, "c", HOFFSET(empty_struct, c),H5T_NATIVE_CHAR);
+ type = H5Tcreate(H5T_COMPOUND, sizeof(empty_struct));
+ H5Tinsert(type, "a", HOFFSET(empty_struct, a), H5T_NATIVE_INT);
+ H5Tinsert(type, "b", HOFFSET(empty_struct, b), H5T_NATIVE_FLOAT);
+ H5Tinsert(type, "c", HOFFSET(empty_struct, c), H5T_NATIVE_CHAR);
dset = H5Dcreate2(file, "Dataset5.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
@@ -3630,23 +3673,26 @@ gent_group_comments(void)
/* /glongcomment */
group = H5Gcreate2(fid, "/glongcomment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Oset_comment_by_name(group, "/glongcomment", "Comment for group /glongcomment with a really, really, really long, long, long comment", H5P_DEFAULT);
+ H5Oset_comment_by_name(
+ group, "/glongcomment",
+ "Comment for group /glongcomment with a really, really, really long, long, long comment",
+ H5P_DEFAULT);
H5Gclose(group);
H5Fclose(fid);
}
-static
-void gent_split_file(void)
+static void
+gent_split_file(void)
{
- hid_t fapl, fid, root, attr, space, dataset, atype;
- char meta[] = "this is some metadata on this file";
+ hid_t fapl, fid, root, attr, space, dataset, atype;
+ char meta[] = "this is some metadata on this file";
hsize_t dims[2];
- int i, j, dset[10][15];
+ int i, j, dset[10][15];
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
- fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
atype = H5Tcopy(H5T_C_S1);
@@ -3654,8 +3700,8 @@ void gent_split_file(void)
H5Tset_strpad(atype, H5T_STR_NULLTERM);
dims[0] = 1;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, atype, meta);
H5Tclose(atype);
H5Sclose(space);
@@ -3664,11 +3710,11 @@ void gent_split_file(void)
/* create dataset */
dims[0] = 10;
dims[1] = 15;
- space = H5Screate_simple(2, dims, NULL);
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 15; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
dset[i][j] = i + j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
@@ -3679,14 +3725,14 @@ void gent_split_file(void)
H5Pclose(fapl);
}
-static
-void gent_family(void)
+static void
+gent_family(void)
{
- hid_t fapl, fid, space, dataset;
+ hid_t fapl, fid, space, dataset;
hsize_t dims[2];
- int i, j, dset[10][15];
+ int i, j, dset[10][15];
-#define FAMILY_SIZE 256
+#define FAMILY_SIZE 256
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT);
@@ -3696,11 +3742,11 @@ void gent_family(void)
/* create dataset */
dims[0] = 10;
dims[1] = 15;
- space = H5Screate_simple(2, dims, NULL);
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 15; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
dset[i][j] = i + j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
@@ -3712,19 +3758,19 @@ void gent_family(void)
static const char *multi_letters = "msbrglo";
-static
-void gent_multi(void)
+static void
+gent_multi(void)
{
- hid_t fapl, fid, space, dataset;
+ hid_t fapl, fid, space, dataset;
hsize_t dims[2];
- int i, j, dset[10][15];
+ int i, j, dset[10][15];
/* Multi-file driver, general case of the split driver */
- H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][1024];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][1024];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
fapl = H5Pcreate(H5P_FILE_ACCESS);
@@ -3735,9 +3781,9 @@ void gent_multi(void)
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
memb_fapl[mt] = H5P_DEFAULT;
- memb_map[mt] = mt;
+ memb_map[mt] = mt;
HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
/*HDprintf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/
@@ -3745,19 +3791,18 @@ void gent_multi(void)
}
memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER;
- H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE);
+ H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE);
fid = H5Fcreate(FILE36, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
/* create dataset */
dims[0] = 10;
dims[1] = 15;
- space = H5Screate_simple(2, dims, NULL);
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 15; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
dset[i][j] = i + j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
@@ -3768,17 +3813,18 @@ void gent_multi(void)
H5Pclose(fapl);
}
-static void gent_large_objname(void)
+static void
+gent_large_objname(void)
{
- hid_t fid, group, group2;
- char grp_name[128];
+ hid_t fid, group, group2;
+ char grp_name[128];
register int i;
fid = H5Fcreate(FILE37, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
group = H5Gcreate2(fid, "this_is_a_large_group_name", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 50; ++i) {
+ for (i = 0; i < 50; ++i) {
HDsprintf(grp_name, "this_is_a_large_group_name%d", i);
group2 = H5Gcreate2(group, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group2);
@@ -3788,20 +3834,19 @@ static void gent_large_objname(void)
H5Fclose(fid);
}
-static void gent_vlstr(void)
+static void
+gent_vlstr(void)
{
- const char *wdata[SPACE1_DIM1]= {
- "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
- "conceived in liberty and dedicated to the proposition that all men are created equal.",
- "",
- NULL
- }; /* Information to write */
- const char *string_att= "This is the string for the attribute";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, root; /* Dataset ID */
- hid_t sid1, dataspace;/* Dataspace ID */
- hid_t tid1, att; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ const char *wdata[SPACE1_DIM1] = {
+ "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty and dedicated to the proposition that all men are created equal.", "",
+ NULL}; /* Information to write */
+ const char *string_att = "This is the string for the attribute";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, root; /* Dataset ID */
+ hid_t sid1, dataspace; /* Dataspace ID */
+ hid_t tid1, att; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
/* Create file */
fid1 = H5Fcreate(FILE38, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3809,8 +3854,8 @@ static void gent_vlstr(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
/* Create a VL string datatype to refer to */
- tid1 = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid1, H5T_VARIABLE);
+ tid1 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid1, H5T_VARIABLE);
/* Create a dataset and write VL string to it. */
dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -3822,7 +3867,7 @@ static void gent_vlstr(void)
H5Tcommit2(fid1, "vl_string_type", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Create an group attribute of VL string type */
- root = H5Gopen2(fid1, "/", H5P_DEFAULT);
+ root = H5Gopen2(fid1, "/", H5P_DEFAULT);
dataspace = H5Screate(H5S_SCALAR);
att = H5Acreate2(root, "test_scalar", tid1, dataspace, H5P_DEFAULT, H5P_DEFAULT);
@@ -3837,19 +3882,19 @@ static void gent_vlstr(void)
H5Fclose(fid1);
}
-static void gent_char(void)
+static void
+gent_char(void)
{
- const char *wdata =
- "Four score and seven years ago our forefathers brought "
- "forth on this continent a new nation, conceived in "
- "liberty and dedicated to the proposition that all "
- "men are created equal. Now we are engaged in a great "
- "civil war, testing whether that nation or any nation "
- "so conceived and so dedicated can long endure.";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[1];
+ const char *wdata = "Four score and seven years ago our forefathers brought "
+ "forth on this continent a new nation, conceived in "
+ "liberty and dedicated to the proposition that all "
+ "men are created equal. Now we are engaged in a great "
+ "civil war, testing whether that nation or any nation "
+ "so conceived and so dedicated can long endure.";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[1];
dims1[0] = HDstrlen(wdata);
@@ -3869,8 +3914,6 @@ static void gent_char(void)
H5Fclose(fid1);
}
-
-
/*-------------------------------------------------------------------------
* Function: write_attr_in
*
@@ -3885,66 +3928,59 @@ static void gent_char(void)
*-------------------------------------------------------------------------
*/
-static void write_attr_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid)
+static void
+write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t fid)
{
/* Compound datatype */
- typedef struct s_t
- {
- char a;
- double b;
+ typedef struct s_t {
+ char a;
+ double b;
} s_t;
- typedef enum
- {
- E_RED,
- E_GREEN
- } e_t;
+ typedef enum { E_RED, E_GREEN } e_t;
- hid_t aid;
- hid_t sid;
- hid_t tid;
- herr_t status;
- int val, i, j, k, n;
- float f;
+ hid_t aid;
+ hid_t sid;
+ hid_t tid;
+ herr_t status;
+ int val, i, j, k, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
/*-------------------------------------------------------------------------
* 1D attributes
@@ -3955,9 +3991,9 @@ static void write_attr_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_attr(loc_id,1,dims,"string",tid,buf1);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -3965,26 +4001,26 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,1,dims,"bitfield",tid,buf2);
+ write_attr(loc_id, 1, dims, "bitfield", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,1,dims,"opaque",tid,buf2);
+ write_attr(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,1,dims,"compound",tid,buf3);
+ write_attr(loc_id, 1, dims, "compound", tid, buf3);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -3992,11 +4028,10 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ if (dset_name) {
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
@@ -4004,9 +4039,9 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_attr(loc_id,1,dims,"enum",tid,0);
+ write_attr(loc_id, 1, dims, "enum", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4016,17 +4051,17 @@ static void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
((int *)buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -4050,7 +4085,6 @@ static void write_attr_in(hid_t loc_id,
write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7);
write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
-
/*-------------------------------------------------------------------------
* 2D attributes
*-------------------------------------------------------------------------
@@ -4060,9 +4094,9 @@ static void write_attr_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_attr(loc_id,2,dims2,"string2D",tid,buf12);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4070,26 +4104,26 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ write_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,2,dims2,"opaque2D",tid,buf22);
+ write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,2,dims2,"compound2D",tid,buf32);
+ write_attr(loc_id, 2, dims2, "compound2D", tid, buf32);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4097,14 +4131,13 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
- status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
@@ -4112,9 +4145,9 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_attr(loc_id,2,dims2,"enum2D",tid,0);
+ write_attr(loc_id, 2, dims2, "enum2D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4123,21 +4156,21 @@ static void write_attr_in(hid_t loc_id,
*/
/* Allocate and initialize VL dataset to write */
- n=0;
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
+ n = 0;
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
}
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -4161,7 +4194,6 @@ static void write_attr_in(hid_t loc_id,
write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72);
write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
-
/*-------------------------------------------------------------------------
* 3D attributes
*-------------------------------------------------------------------------
@@ -4171,9 +4203,9 @@ static void write_attr_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_attr(loc_id,3,dims3,"string3D",tid,buf13);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4181,25 +4213,25 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
buf23[i][j][k] = (char)n++;
}
}
}
tid = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ write_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,3,dims3,"opaque3D",tid,buf23);
+ write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4207,19 +4239,19 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
buf33[i][j][k].a = (char)n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].b = n++;
}
}
}
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,3,dims3,"compound3D",tid,buf33);
+ write_attr(loc_id, 3, dims3, "compound3D", tid, buf33);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4227,15 +4259,14 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++)
- status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++)
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
@@ -4243,9 +4274,9 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_attr(loc_id,3,dims3,"enum3D",tid,0);
+ write_attr(loc_id, 3, dims3, "enum3D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4255,22 +4286,22 @@ static void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
}
}
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -4284,8 +4315,8 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
n = 1;
- for(i = 0; i < 24; i++)
- for(j = 0; j < (int)dimarray[0]; j++)
+ for (i = 0; i < 24; i++)
+ for (j = 0; j < (int)dimarray[0]; j++)
buf63[i][j] = n++;
tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
@@ -4296,21 +4327,20 @@ static void write_attr_in(hid_t loc_id,
* H5T_INTEGER and H5T_FLOAT
*-------------------------------------------------------------------------
*/
- n=1; f=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- buf73[i][j][k]=n++;
- buf83[i][j][k]=f++;
+ n = 1;
+ f = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
}
}
}
- write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
- write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+ write_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73);
+ write_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83);
}
-
-
/*-------------------------------------------------------------------------
* Function: write_dset_in
*
@@ -4325,68 +4355,61 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-static void write_dset_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid)
+static void
+write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t fid)
{
/* Compound datatype */
- typedef struct s_t
- {
- char a;
- double b;
+ typedef struct s_t {
+ char a;
+ double b;
} s_t;
- typedef enum
- {
- E_RED,
- E_GREEN
- } e_t;
+ typedef enum { E_RED, E_GREEN } e_t;
- hid_t did;
- hid_t sid;
- hid_t tid;
- hid_t plist_id;
- herr_t status;
- int val, i, j, k, n;
- float f;
- int fillvalue=2;
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t plist_id;
+ herr_t status;
+ int val, i, j, k, n;
+ float f;
+ int fillvalue = 2;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
/*-------------------------------------------------------------------------
* 1D
@@ -4397,9 +4420,9 @@ static void write_dset_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_dset(loc_id,1,dims,"string",tid,buf1);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4407,26 +4430,26 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_dset(loc_id,1,dims,"bitfield",tid,buf2);
+ write_dset(loc_id, 1, dims, "bitfield", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_dset(loc_id,1,dims,"opaque",tid,buf2);
+ write_dset(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_dset(loc_id,1,dims,"compound",tid,buf3);
+ write_dset(loc_id, 1, dims, "compound", tid, buf3);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4434,11 +4457,10 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ if (dset_name) {
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
@@ -4446,9 +4468,9 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_dset(loc_id,1,dims,"enum",tid,0);
+ write_dset(loc_id, 1, dims, "enum", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4458,17 +4480,17 @@ static void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf5[0].p)[0]=1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc( 2 * sizeof(int));
- ((int *)buf5[1].p)[0]=2;
- ((int *)buf5[1].p)[1]=3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -4489,9 +4511,8 @@ static void write_dset_in(hid_t loc_id,
* H5T_INTEGER and H5T_FLOAT
*-------------------------------------------------------------------------
*/
- write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
- write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
-
+ write_dset(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7);
+ write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
/*-------------------------------------------------------------------------
* 2D
@@ -4502,9 +4523,9 @@ static void write_dset_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_dset(loc_id,2,dims2,"string2D",tid,buf12);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4512,26 +4533,26 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ write_dset(loc_id, 2, dims2, "bitfield2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_dset(loc_id,2,dims2,"opaque2D",tid,buf22);
+ write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_dset(loc_id,2,dims2,"compound2D",tid,buf32);
+ write_dset(loc_id, 2, dims2, "compound2D", tid, buf32);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4539,14 +4560,13 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
- status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
@@ -4554,9 +4574,9 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_dset(loc_id,2,dims2,"enum2D",tid,0);
+ write_dset(loc_id, 2, dims2, "enum2D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4565,20 +4585,20 @@ static void write_dset_in(hid_t loc_id,
*/
/* Allocate and initialize VL dataset to write */
- n=0;
- for(i = 0; i < 3; i++)
- for(j = 0; j < 2; j++) {
+ n = 0;
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -4600,13 +4620,13 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
plist_id = H5Pcreate(H5P_DATASET_CREATE);
- status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue);
- sid = H5Screate_simple(2, dims2, NULL);
- did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT);
- status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
- status = H5Pclose(plist_id);
- status = H5Dclose(did);
- status = H5Sclose(sid);
+ status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue);
+ sid = H5Screate_simple(2, dims2, NULL);
+ did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT);
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
+ status = H5Pclose(plist_id);
+ status = H5Dclose(did);
+ status = H5Sclose(sid);
/*-------------------------------------------------------------------------
* H5T_FLOAT
@@ -4615,7 +4635,6 @@ static void write_dset_in(hid_t loc_id,
write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
-
/*-------------------------------------------------------------------------
* 3D
*-------------------------------------------------------------------------
@@ -4625,9 +4644,9 @@ static void write_dset_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_dset(loc_id,3,dims3,"string3D",tid,buf13);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4635,22 +4654,22 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
- for(k = 0; k < 2; k++)
+ n = 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 2; k++)
buf23[i][j][k] = (char)n++;
tid = H5Tcopy(H5T_STD_B8LE);
- write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ write_dset(loc_id, 3, dims3, "bitfield3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_dset(loc_id,3,dims3,"opaque3D",tid,buf23);
+ write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4658,17 +4677,17 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
- for(k = 0; k < 2; k++) {
+ n = 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 2; k++) {
buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_dset(loc_id,3,dims3,"compound3D",tid,buf33);
+ write_dset(loc_id, 3, dims3, "compound3D", tid, buf33);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4676,15 +4695,14 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++)
- status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++)
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
@@ -4692,9 +4710,9 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_dset(loc_id,3,dims3,"enum3D",tid,0);
+ write_dset(loc_id, 3, dims3, "enum3D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4704,20 +4722,20 @@ static void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
- for(k = 0; k < 2; k++) {
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -4730,10 +4748,10 @@ static void write_dset_in(hid_t loc_id,
* H5T_ARRAY
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 24; i++) {
- for(j = 0; j < (int)dimarray[0]; j++) {
- buf63[i][j]=n++;
+ n = 1;
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
+ buf63[i][j] = n++;
}
}
@@ -4745,22 +4763,20 @@ static void write_dset_in(hid_t loc_id,
* H5T_INTEGER and H5T_FLOAT
*-------------------------------------------------------------------------
*/
- n=1; f=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- buf73[i][j][k]=n++;
- buf83[i][j][k]=f++;
+ n = 1;
+ f = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
}
}
}
- write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
- write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+ write_dset(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73);
+ write_dset(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83);
}
-
-
-
/*-------------------------------------------------------------------------
* Function: gent_attr_all
*
@@ -4775,7 +4791,8 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-static void gent_attr_all(void)
+static void
+gent_attr_all(void)
{
hid_t fid;
hid_t did;
@@ -4790,8 +4807,8 @@ static void gent_attr_all(void)
fid = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create a 1D dataset */
- sid = H5Screate_simple(1,dims,NULL);
- did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Sclose(sid);
HDassert(status >= 0);
@@ -4805,16 +4822,16 @@ static void gent_attr_all(void)
*-------------------------------------------------------------------------
*/
- write_attr_in(did,"dset",fid);
- write_attr_in(group_id,NULL,(hid_t)0);
- write_attr_in(root_id,NULL,(hid_t)0);
+ write_attr_in(did, "dset", fid);
+ write_attr_in(group_id, NULL, (hid_t)0);
+ write_attr_in(root_id, NULL, (hid_t)0);
/*-------------------------------------------------------------------------
* write a series of datasets on group 2
*-------------------------------------------------------------------------
*/
- write_dset_in(group2_id,"/dset",fid);
+ write_dset_in(group2_id, "/dset", fid);
/* Close */
status = H5Dclose(did);
@@ -4831,7 +4848,6 @@ static void gent_attr_all(void)
HDassert(status >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: write_attr
*
@@ -4844,13 +4860,12 @@ static void gent_attr_all(void)
*-------------------------------------------------------------------------
*/
-static
-int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
- hid_t tid, void *buf)
+static int
+write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf)
{
- hid_t aid;
- hid_t sid;
- herr_t status;
+ hid_t aid;
+ hid_t sid;
+ herr_t status;
/* Create a buf space */
sid = H5Screate_simple(rank, dims, NULL);
@@ -4859,7 +4874,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
/* Write the buf */
- if(buf)
+ if (buf)
status = H5Awrite(aid, tid, buf);
/* Close */
@@ -4883,13 +4898,12 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
*-------------------------------------------------------------------------
*/
-static
-int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t tid, void *buf )
+static int
+write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf)
{
- hid_t did;
- hid_t sid;
- herr_t status;
+ hid_t did;
+ hid_t sid;
+ herr_t status;
/* Create a buf space */
sid = H5Screate_simple(rank, dims, NULL);
@@ -4898,7 +4912,7 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the buf */
- if(buf)
+ if (buf)
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* Close */
@@ -4908,67 +4922,64 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
return status;
}
-
-static void gent_compound_complex(void)
+static void
+gent_compound_complex(void)
{
/* Structure and array for compound types */
typedef struct Array1Struct {
- int a;
- const char *b[F41_DIMb];
- char c[F41_ARRAY_DIMc];
- short d[F41_ARRAY_DIMd1][F41_ARRAY_DIMd2];
- float e;
- double f[F41_ARRAY_DIMf];
- char g;
+ int a;
+ const char *b[F41_DIMb];
+ char c[F41_ARRAY_DIMc];
+ short d[F41_ARRAY_DIMd1][F41_ARRAY_DIMd2];
+ float e;
+ double f[F41_ARRAY_DIMf];
+ char g;
} Array1Struct;
- Array1Struct Array1[F41_LENGTH];
+ Array1Struct Array1[F41_LENGTH];
/* Define the value of the string array */
- const char *quote [F41_DIMb] = {
- "A fight is a contract that takes two people to honor.",
- "A combative stance means that you've accepted the contract.",
- "In which case, you deserve what you get.",
- " -- Professor Cheng Man-ch'ing"
- };
+ const char *quote[F41_DIMb] = {"A fight is a contract that takes two people to honor.",
+ "A combative stance means that you've accepted the contract.",
+ "In which case, you deserve what you get.",
+ " -- Professor Cheng Man-ch'ing"};
/* Define the value of the character array */
- char chararray [F41_ARRAY_DIMc] = {'H', 'e', 'l', 'l', 'o', '!'};
+ char chararray[F41_ARRAY_DIMc] = {'H', 'e', 'l', 'l', 'o', '!'};
+
+ hid_t Array1Structid; /* File datatype identifier */
+ hid_t array_tid; /* Array datatype handle */
+ hid_t array1_tid; /* Array datatype handle */
+ hid_t array2_tid; /* Array datatype handle */
+ hid_t array4_tid; /* Array datatype handle */
+ hid_t datafile, dataset; /* Datafile/dataset handles */
+ hid_t dataspace; /* Dataspace handle */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */
+ hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */
+ hsize_t array_dimd[] = {F41_ARRAY_DIMd1, F41_ARRAY_DIMd2}; /* Array dimensions */
+ hsize_t array_dimf[] = {F41_ARRAY_DIMf}; /* Array dimensions */
+ hid_t str_array_id;
-
- hid_t Array1Structid; /* File datatype identifier */
- hid_t array_tid; /* Array datatype handle */
- hid_t array1_tid; /* Array datatype handle */
- hid_t array2_tid; /* Array datatype handle */
- hid_t array4_tid; /* Array datatype handle */
- hid_t datafile, dataset; /* Datafile/dataset handles */
- hid_t dataspace; /* Dataspace handle */
- herr_t status; /* Error checking variable */
- hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */
- hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */
- hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */
- hsize_t array_dimf[]={F41_ARRAY_DIMf}; /* Array dimensions */
- hid_t str_array_id;
-
- int m, n, o; /* Array init loop vars */
+ int m, n, o; /* Array init loop vars */
/* Initialize the data in the arrays/datastructure */
- for(m = 0; m< F41_LENGTH; m++) {
+ for (m = 0; m < F41_LENGTH; m++) {
Array1[m].a = m;
- for(n = 0; n < F41_DIMb; n++)
+ for (n = 0; n < F41_DIMb; n++)
Array1[m].b[n] = quote[n];
- for(n = 0; n < F41_ARRAY_DIMc; n++)
+ for (n = 0; n < F41_ARRAY_DIMc; n++)
Array1[m].c[n] = chararray[n];
- for(n = 0; n < F41_ARRAY_DIMd1; n++)
- for(o = 0; o < F41_ARRAY_DIMd2; o++)
+ for (n = 0; n < F41_ARRAY_DIMd1; n++)
+ for (o = 0; o < F41_ARRAY_DIMd2; o++)
Array1[m].d[n][o] = (short)(m + n + o);
- Array1[m].e = (float)((float)m * 0.96F );
+ Array1[m].e = (float)((float)m * 0.96F);
- for(n = 0; n < F41_ARRAY_DIMf; n++)
- Array1[m].f[n] = ((float)m * 1024.9637F );
+ for (n = 0; n < F41_ARRAY_DIMf; n++)
+ Array1[m].f[n] = ((float)m * 1024.9637F);
Array1[m].g = 'm';
}
@@ -4978,16 +4989,15 @@ static void gent_compound_complex(void)
HDassert(dataspace >= 0);
/* Create the file */
- datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
+ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
HDassert(datafile >= 0);
/* Copy the array data type for the string array */
- array_tid = H5Tcopy (H5T_C_S1);
+ array_tid = H5Tcopy(H5T_C_S1);
HDassert(array_tid >= 0);
/* Set the string array size to Variable */
- status = H5Tset_size (array_tid,H5T_VARIABLE);
+ status = H5Tset_size(array_tid, H5T_VARIABLE);
HDassert(status >= 0);
/* Create the array data type for the string array */
@@ -4995,11 +5005,11 @@ static void gent_compound_complex(void)
HDassert(str_array_id >= 0);
/* Copy the array data type for the character array */
- array1_tid = H5Tcopy (H5T_C_S1);
+ array1_tid = H5Tcopy(H5T_C_S1);
HDassert(array1_tid >= 0);
/* Set the character array size */
- status = H5Tset_size (array1_tid, F41_ARRAY_DIMc);
+ status = H5Tset_size(array1_tid, F41_ARRAY_DIMc);
HDassert(status >= 0);
/* Create the array data type for the character array */
@@ -5011,45 +5021,37 @@ static void gent_compound_complex(void)
HDassert(array4_tid >= 0);
/* Create the memory data type */
- Array1Structid = H5Tcreate (H5T_COMPOUND, sizeof(Array1Struct));
+ Array1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Array1Struct));
HDassert(Array1Structid >= 0);
/* Insert the arrays and variables into the structure */
- status = H5Tinsert(Array1Structid, "a_name",
- HOFFSET(Array1Struct, a), H5T_NATIVE_INT);
+ status = H5Tinsert(Array1Structid, "a_name", HOFFSET(Array1Struct, a), H5T_NATIVE_INT);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "b_name",
- HOFFSET(Array1Struct, b), str_array_id);
+ status = H5Tinsert(Array1Structid, "b_name", HOFFSET(Array1Struct, b), str_array_id);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "c_name",
- HOFFSET(Array1Struct, c), array1_tid);
+ status = H5Tinsert(Array1Structid, "c_name", HOFFSET(Array1Struct, c), array1_tid);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "d_name",
- HOFFSET(Array1Struct, d), array2_tid);
+ status = H5Tinsert(Array1Structid, "d_name", HOFFSET(Array1Struct, d), array2_tid);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "e_name",
- HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT);
+ status = H5Tinsert(Array1Structid, "e_name", HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "f_name",
- HOFFSET(Array1Struct, f), array4_tid);
+ status = H5Tinsert(Array1Structid, "f_name", HOFFSET(Array1Struct, f), array4_tid);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "g_name",
- HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR);
+ status = H5Tinsert(Array1Structid, "g_name", HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR);
HDassert(status >= 0);
/* Create the dataset */
- dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/* Write data to the dataset */
- status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, Array1);
+ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Array1);
HDassert(status >= 0);
/* Release resources */
@@ -5081,21 +5083,21 @@ static void gent_compound_complex(void)
HDassert(status >= 0);
}
-
-static void gent_named_dtype_attr(void)
+static void
+gent_named_dtype_attr(void)
{
- hid_t fid;
- hid_t did;
- hid_t sid;
- hid_t tid;
- hid_t aid;
- hid_t gid;
- int data=8;
+ hid_t fid;
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t aid;
+ hid_t gid;
+ int data = 8;
herr_t ret;
/* Create a file */
- fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>0);
+ fid = H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid > 0);
/*-------------------------------------------------------------------------
* datatype
@@ -5103,8 +5105,8 @@ static void gent_named_dtype_attr(void)
*/
/* Create a datatype to commit and use */
- tid=H5Tcopy(H5T_NATIVE_INT);
- HDassert(tid>0);
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ HDassert(tid > 0);
/* Commit datatype to file */
ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5186,20 +5188,20 @@ static void gent_named_dtype_attr(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: gent_null_space
*
* Purpose: generates dataset and attribute of null dataspace
*-------------------------------------------------------------------------
*/
-static void gent_null_space(void)
+static void
+gent_null_space(void)
{
hid_t fid, root, dataset, space, attr;
- int dset_buf = 10;
- int point = 4;
+ int dset_buf = 10;
+ int point = 4;
- fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* null space */
@@ -5227,22 +5229,23 @@ static void gent_null_space(void)
* Purpose: generates dataset and attribute with dataspace of 0 dimension size
*-------------------------------------------------------------------------
*/
-static void gent_zero_dim_size(void)
+static void
+gent_zero_dim_size(void)
{
- hid_t fid, root, dataset, space, attr;
- hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
- int dset_buf = 10;
- int point = 4;
+ hid_t fid, root, dataset, space, attr;
+ hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
+ int dset_buf = 10;
+ int point = 4;
- fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* dataspace of 0 dimension size */
space = H5Screate_simple(SPACE3_RANK, dims1, NULL);
/* dataset */
- dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/* nothing should be written */
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
@@ -5264,39 +5267,31 @@ static void gent_zero_dim_size(void)
*
*-------------------------------------------------------------------------
*/
-static
-int make_dset(hid_t loc_id,
- const char *name,
- hid_t sid,
- hid_t tid,
- hid_t dcpl,
- void *buf)
+static int
+make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf)
{
- hid_t dsid;
+ hid_t dsid;
/* create the dataset */
- if((dsid = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
/* write */
- if(H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
return -1;
return 0;
- out:
- H5E_BEGIN_TRY {
- H5Dclose(dsid);
- } H5E_END_TRY;
+out:
+ H5E_BEGIN_TRY { H5Dclose(dsid); }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
* Function: make_external
*
@@ -5307,19 +5302,19 @@ int make_dset(hid_t loc_id,
static void
make_external(hid_t fid)
{
- hid_t dcpl; /*dataset creation property list */
- hid_t sid; /*dataspace ID */
- hid_t dsid; /*dataset ID */
- hsize_t cur_size[1]; /*data space current size */
- hsize_t max_size[1]; /*data space maximum size */
- hsize_t size; /*bytes reserved for data in the external file*/
+ hid_t dcpl; /*dataset creation property list */
+ hid_t sid; /*dataspace ID */
+ hid_t dsid; /*dataset ID */
+ hsize_t cur_size[1]; /*data space current size */
+ hsize_t max_size[1]; /*data space maximum size */
+ hsize_t size; /*bytes reserved for data in the external file*/
int ret;
cur_size[0] = max_size[0] = 100;
- size = (max_size[0]*sizeof(int)/2);
+ size = (max_size[0] * sizeof(int) / 2);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size);
+ ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size);
HDassert(ret >= 0);
ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size);
@@ -5348,30 +5343,31 @@ make_external(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-static void gent_filters(void)
+static void
+gent_filters(void)
{
- hid_t fid; /* file id */
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
#ifdef H5_HAVE_FILTER_SZIP
- unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=4;
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
#endif /* H5_HAVE_FILTER_SZIP */
- hsize_t dims1[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf1[DIM1][DIM2];
- int i, j, n, ret;
-
- for(i=n=0; i<DIM1; i++){
- for(j=0; j<DIM2; j++){
- buf1[i][j]=n++;
+ hsize_t dims1[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int buf1[DIM1][DIM2];
+ int i, j, n, ret;
+
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf1[i][j] = n++;
}
}
/* create a file */
- fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/* create a space */
sid = H5Screate_simple(SPACE2_RANK, dims1, NULL);
@@ -5387,7 +5383,7 @@ static void gent_filters(void)
ret = H5Pset_layout(dcpl, H5D_COMPACT);
HDassert(ret >= 0);
- ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "compact", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT);
@@ -5396,7 +5392,7 @@ static void gent_filters(void)
ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS);
HDassert(ret >= 0);
- ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "contiguous", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT);
@@ -5408,7 +5404,7 @@ static void gent_filters(void)
ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
HDassert(ret >= 0);
- ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "chunked", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT);
@@ -5428,16 +5424,16 @@ static void gent_filters(void)
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_SZIP
- if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set szip data */
- ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
+ ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block);
HDassert(ret >= 0);
- ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "szip", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
}
#endif /* H5_HAVE_FILTER_SZIP */
@@ -5446,51 +5442,49 @@ static void gent_filters(void)
* GZIP
*-------------------------------------------------------------------------
*/
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set deflate data */
ret = H5Pset_deflate(dcpl, 9);
HDassert(ret >= 0);
- ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "deflate", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
#endif
-
/*-------------------------------------------------------------------------
* shuffle
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the shuffle filter */
ret = H5Pset_shuffle(dcpl);
HDassert(ret >= 0);
- ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "shuffle", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
-
/*-------------------------------------------------------------------------
* checksum
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the checksum filter */
ret = H5Pset_fletcher32(dcpl);
HDassert(ret >= 0);
- ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "fletcher32", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5499,16 +5493,16 @@ static void gent_filters(void)
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the checksum filter */
ret = H5Pset_nbit(dcpl);
HDassert(ret >= 0);
- tid=H5Tcopy(H5T_NATIVE_INT);
- H5Tset_precision(tid,H5Tget_size(tid)-1);
- ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1);
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_precision(tid, H5Tget_size(tid) - 1);
+ ret = make_dset(fid, "nbit", sid, tid, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5517,14 +5511,14 @@ static void gent_filters(void)
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the scaleoffset filter */
- ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT));
+ ret = H5Pset_scaleoffset(dcpl, H5Z_SO_INT, (int)H5Tget_size(H5T_NATIVE_INT));
HDassert(ret >= 0);
- ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "scaleoffset", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5532,7 +5526,7 @@ static void gent_filters(void)
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the shuffle filter */
@@ -5540,15 +5534,15 @@ static void gent_filters(void)
HDassert(ret >= 0);
#ifdef H5_HAVE_FILTER_SZIP
- if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
- szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK;
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ szip_options_mask = H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK;
/* set szip data */
- ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
+ ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block);
HDassert(ret >= 0);
}
#endif /* H5_HAVE_FILTER_SZIP */
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
ret = H5Pset_deflate(dcpl, 5);
HDassert(ret >= 0);
@@ -5562,29 +5556,28 @@ static void gent_filters(void)
ret = H5Pset_nbit(dcpl);
HDassert(ret >= 0);
- ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "all", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
-
/*-------------------------------------------------------------------------
* user defined filter
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
- ret = H5Zregister (H5Z_MYFILTER);
+ ret = H5Zregister(H5Z_MYFILTER);
HDassert(ret >= 0);
- ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL);
+ ret = H5Pset_filter(dcpl, MYFILTER_ID, 0, 0, NULL);
HDassert(ret >= 0);
- ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "myfilter", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5599,7 +5592,7 @@ static void gent_filters(void)
*/
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
HDassert(ret >= 0);
- ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "alloc_time_early", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5608,7 +5601,7 @@ static void gent_filters(void)
*/
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR);
HDassert(ret >= 0);
- ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "alloc_time_incr", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5617,7 +5610,7 @@ static void gent_filters(void)
*/
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
HDassert(ret >= 0);
- ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "alloc_time_late", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5648,7 +5641,6 @@ static void gent_filters(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: myfilter
*
@@ -5658,13 +5650,12 @@ static void gent_filters(void)
*/
static size_t
myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: set_local_myfilter
*
@@ -5676,21 +5667,21 @@ myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
set_local_myfilter(hid_t dcpl_id, hid_t H5_ATTR_UNUSED tid, hid_t H5_ATTR_UNUSED sid)
{
- unsigned flags; /* Filter flags */
- size_t cd_nelmts = 0; /* Number of filter parameters */
- unsigned cd_values[2] = {5, 6}; /* Filter parameters */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = 0; /* Number of filter parameters */
+ unsigned cd_values[2] = {5, 6}; /* Filter parameters */
/* Get the filter's current parameters */
- if(H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
- return(FAIL);
+ if (H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
+ return (FAIL);
cd_nelmts = 2;
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0)
- return(FAIL);
+ if (H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0)
+ return (FAIL);
- return(SUCCEED);
+ return (SUCCEED);
}
/*-------------------------------------------------------------------------
@@ -5700,63 +5691,54 @@ set_local_myfilter(hid_t dcpl_id, hid_t H5_ATTR_UNUSED tid, hid_t H5_ATTR_UNUSED
*
*-------------------------------------------------------------------------
*/
-static void gent_fcontents(void)
+static void
+gent_fcontents(void)
{
- hid_t fid; /* file id */
- hid_t gid1; /* group ID */
- hid_t tid; /* datatype ID */
- hsize_t dims[1]={4};
- int buf[4]={1,2,3,4};
- int ret;
-
+ hid_t fid; /* file id */
+ hid_t gid1; /* group ID */
+ hid_t tid; /* datatype ID */
+ hsize_t dims[1] = {4};
+ int buf[4] = {1, 2, 3, 4};
+ int ret;
/* create a file */
- fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
-
-
- write_dset(fid,1,dims,"dset",H5T_NATIVE_INT,buf);
+ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+ write_dset(fid, 1, dims, "dset", H5T_NATIVE_INT, buf);
/*-------------------------------------------------------------------------
* links
*-------------------------------------------------------------------------
*/
-
/* hard link to "dset" */
gid1 = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_hard(gid1, "/dset", H5L_SAME_LOC, "dset1", H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(gid1);
-
/* hard link to "dset" */
gid1 = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_hard(gid1, "/dset", H5L_SAME_LOC, "dset2", H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(gid1);
-
/* hard link to "g2" */
gid1 = H5Gopen2(fid, "/g1", H5P_DEFAULT);
H5Lcreate_hard(gid1, "/g2", H5L_SAME_LOC, "g1.1", H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(gid1);
-
/* hard link to "dset" */
ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset3", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
-
/* hard link to "dset" */
ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset4", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
-
/* soft link to itself */
ret = H5Lcreate_soft("mylink", fid, "mylink", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
-
/* soft link to "dset" */
ret = H5Lcreate_soft("/dset", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
@@ -5779,7 +5761,6 @@ static void gent_fcontents(void)
ret = H5Tclose(tid);
HDassert(ret >= 0);
-
/* no name datatype */
tid = H5Tcopy(H5T_NATIVE_INT);
ret = H5Tcommit2(fid, "mytype2", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5790,21 +5771,17 @@ static void gent_fcontents(void)
ret = H5Tclose(tid);
HDassert(ret >= 0);
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
ret = H5Fclose(fid);
HDassert(ret >= 0);
-
/* create a file for the bootblock test */
- fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
-
+ fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
ret = H5Fclose(fid);
HDassert(ret >= 0);
@@ -5817,35 +5794,34 @@ static void gent_fcontents(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_fvalues(void)
+static void
+gent_fvalues(void)
{
/* compound datatype */
- typedef struct c_t
- {
- char a;
- double b;
+ typedef struct c_t {
+ char a;
+ double b;
} c_t;
-
- hid_t fid; /* file id */
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
- hid_t did; /* datasetID */
- hsize_t dims[1]={2};
- int buf[2]={1,2}; /* integer */
- int fillval1=-99; /* integer fill value */
- c_t buf2[2]={{1,2},{3,4}}; /* compound */
- c_t fillval2[1]={{1,2}}; /* compound fill value */
- hvl_t buf3[2]; /* vlen */
- hvl_t fillval3; /* vlen fill value */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int ret;
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ hid_t did; /* datasetID */
+ hsize_t dims[1] = {2};
+ int buf[2] = {1, 2}; /* integer */
+ int fillval1 = -99; /* integer fill value */
+ c_t buf2[2] = {{1, 2}, {3, 4}}; /* compound */
+ c_t fillval2[1] = {{1, 2}}; /* compound fill value */
+ hvl_t buf3[2]; /* vlen */
+ hvl_t fillval3; /* vlen fill value */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf4[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int ret;
/* create a file */
- fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/* create a space */
sid = H5Screate_simple(1, dims, NULL);
@@ -5864,7 +5840,7 @@ static void gent_fvalues(void)
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf);
+ ret = make_dset(fid, "fill_time_ifset", sid, H5T_NATIVE_INT, dcpl, buf);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5877,7 +5853,7 @@ static void gent_fvalues(void)
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf);
+ ret = make_dset(fid, "fill_time_never", sid, H5T_NATIVE_INT, dcpl, buf);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5890,7 +5866,7 @@ static void gent_fvalues(void)
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf);
+ ret = make_dset(fid, "fill_time_alloc", sid, H5T_NATIVE_INT, dcpl, buf);
HDassert(ret >= 0);
ret = H5Pclose(dcpl);
@@ -5900,19 +5876,19 @@ static void gent_fvalues(void)
* dataset with no fill value
*-------------------------------------------------------------------------
*/
- write_dset(fid,1,dims,"no_fill",H5T_NATIVE_INT,buf);
+ write_dset(fid, 1, dims, "no_fill", H5T_NATIVE_INT, buf);
/*-------------------------------------------------------------------------
* dataset with a H5T_COMPOUND fill value
*-------------------------------------------------------------------------
*/
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(c_t));
H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE);
ret = H5Pset_fill_value(dcpl, tid, &fillval2);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2);
+ ret = make_dset(fid, "fill_compound", sid, tid, dcpl, buf2);
HDassert(ret >= 0);
ret = H5Tclose(tid);
HDassert(ret >= 0);
@@ -5923,19 +5899,20 @@ static void gent_fvalues(void)
* dataset with a H5T_VLEN fill value
*-------------------------------------------------------------------------
*/
- buf3[0].len = 1;
- buf3[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf3[0].p)[0]=1;
- buf3[1].len = 2;
- buf3[1].p = HDmalloc(2 * sizeof(int));
+ buf3[0].len = 1;
+ buf3[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf3[0].p)[0] = 1;
+ buf3[1].len = 2;
+ buf3[1].p = HDmalloc(2 * sizeof(int));
((int *)buf3[1].p)[0] = 2;
((int *)buf3[1].p)[1] = 3;
- tid = H5Tvlen_create(H5T_NATIVE_INT);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- fillval3.p=NULL; fillval3.len=0;
- ret = H5Pset_fill_value(dcpl, tid, &fillval3);
+ fillval3.p = NULL;
+ fillval3.len = 0;
+ ret = H5Pset_fill_value(dcpl, tid, &fillval3);
HDassert(ret >= 0);
did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5956,7 +5933,6 @@ static void gent_fvalues(void)
write_dset(fid, 1, dims, "fill_array", tid, buf4);
ret = H5Tclose(tid);
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -5967,7 +5943,6 @@ static void gent_fvalues(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: gent_string
*
@@ -5975,49 +5950,50 @@ static void gent_fvalues(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_string(void)
+static void
+gent_string(void)
{
/* compound datatype */
- typedef struct c_t
- {
- int a;
- char str[255];
+ typedef struct c_t {
+ int a;
+ char str[255];
} c_t;
- hid_t fid; /* file id */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
- hid_t str_tid; /* datatype ID */
- hid_t did; /* dataset ID */
- char buf1[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
- const char *buf2[SPACE1_DIM1]= {
- "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,",
- "conceived in liberty\n and dedicated to the proposition that all men are created equal.",
- "Now we are engaged\n in a great civil war,",
- "testing whether that\n nation or any nation so conceived and so dedicated can long endure."
- };
- c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
- char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
- hsize_t dims1[] = {1};
- hsize_t dims2[] = {SPACE1_DIM1};
- hsize_t dims4[1];
- int ret;
+ hid_t fid; /* file id */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ hid_t str_tid; /* datatype ID */
+ hid_t did; /* dataset ID */
+ char buf1[] = {"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
+ const char *buf2[SPACE1_DIM1] = {
+ "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty\n and dedicated to the proposition that all men are created equal.",
+ "Now we are engaged\n in a great civil war,",
+ "testing whether that\n nation or any nation so conceived and so dedicated can long endure."};
+ c_t buf3 = {
+ 24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
+ char buf4[] = {
+ "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
+ hsize_t dims1[] = {1};
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t dims4[1];
+ int ret;
dims4[0] = sizeof(buf4);
/* create a file */
- fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/*-------------------------------------------------------------------------
* str1
*-------------------------------------------------------------------------
*/
- tid=H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
ret = H5Tset_size(tid, sizeof(buf1));
HDassert(ret >= 0);
- write_dset(fid,1,dims1,"str1",tid,buf1);
+ write_dset(fid, 1, dims1, "str1", tid, buf1);
HDassert(ret >= 0);
ret = H5Tclose(tid);
HDassert(ret >= 0);
@@ -6044,13 +6020,13 @@ static void gent_string(void)
* str3
*-------------------------------------------------------------------------
*/
- sid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t));
- str_tid = H5Tcopy( H5T_C_S1 );
- H5Tset_size( str_tid, 255 );
+ sid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(c_t));
+ str_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(str_tid, 255);
H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT);
- H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid );
- ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3);
+ H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid);
+ ret = make_dset(fid, "str3", sid, tid, H5P_DEFAULT, &buf3);
HDassert(ret >= 0);
ret = H5Tclose(tid);
HDassert(ret >= 0);
@@ -6064,7 +6040,7 @@ static void gent_string(void)
*-------------------------------------------------------------------------
*/
sid = H5Screate_simple(SPACE1_RANK, dims4, NULL);
- ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4);
+ ret = make_dset(fid, "str4", sid, H5T_NATIVE_CHAR, H5P_DEFAULT, buf4);
ret = H5Sclose(sid);
HDassert(ret >= 0);
@@ -6076,7 +6052,6 @@ static void gent_string(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: gent_aindices
*
@@ -6084,48 +6059,49 @@ static void gent_string(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_aindices(void)
+static void
+gent_aindices(void)
{
- hid_t fid; /* file id */
- hid_t gid[6]; /* group ids */
- hsize_t dims1[1] = {100};
- hsize_t dims2[2] = {10,10};
- hsize_t dims3[3] = {2,10,10};
- hsize_t dims4[4] = {2,2,10,10};
- int buf1[100];
- int buf2[10][10];
- int buf3[2][10][10];
- int buf4[2][2][10][10];
- int i, j, k, l, n, ret;
-
- for(i = n = 0; i < 100; i++)
+ hid_t fid; /* file id */
+ hid_t gid[6]; /* group ids */
+ hsize_t dims1[1] = {100};
+ hsize_t dims2[2] = {10, 10};
+ hsize_t dims3[3] = {2, 10, 10};
+ hsize_t dims4[4] = {2, 2, 10, 10};
+ int buf1[100];
+ int buf2[10][10];
+ int buf3[2][10][10];
+ int buf4[2][2][10][10];
+ int i, j, k, l, n, ret;
+
+ for (i = n = 0; i < 100; i++)
buf1[i] = n++;
- for(i = n = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = n = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
buf2[i][j] = n++;
- for(i = n = 0; i < 2; i++)
- for(j = 0; j < 10; j++)
- for(k = 0; k < 10; k++)
+ for (i = n = 0; i < 2; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
buf3[i][j][k] = n++;
- for(i = n = 0; i < 2; i++)
- for(j = 0; j < 2; j++)
- for(k = 0; k < 10; k++)
- for(l = 0; l < 10; l++)
+ for (i = n = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 10; k++)
+ for (l = 0; l < 10; l++)
buf4[i][j][k][l] = n++;
/* create a file */
- fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/*-------------------------------------------------------------------------
* root datasets
*-------------------------------------------------------------------------
*/
- write_dset(fid,1,dims1,"1d",H5T_NATIVE_INT,buf1);
- write_dset(fid,2,dims2,"2d",H5T_NATIVE_INT,buf2);
- write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3);
- write_dset(fid,4,dims4,"4d",H5T_NATIVE_INT,buf4);
+ write_dset(fid, 1, dims1, "1d", H5T_NATIVE_INT, buf1);
+ write_dset(fid, 2, dims2, "2d", H5T_NATIVE_INT, buf2);
+ write_dset(fid, 3, dims3, "3d", H5T_NATIVE_INT, buf3);
+ write_dset(fid, 4, dims4, "4d", H5T_NATIVE_INT, buf4);
/*-------------------------------------------------------------------------
* test with group indentation
@@ -6137,11 +6113,11 @@ static void gent_aindices(void)
gid[3] = H5Gcreate2(fid, "g1/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid[4] = H5Gcreate2(fid, "g1/g2/g3/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid[5] = H5Gcreate2(fid, "g1/g2/g3/g4/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- write_dset(gid[5],1,dims1,"1d",H5T_NATIVE_INT,buf1);
- write_dset(gid[5],2,dims2,"2d",H5T_NATIVE_INT,buf2);
- write_dset(gid[5],3,dims3,"3d",H5T_NATIVE_INT,buf3);
- write_dset(gid[5],4,dims4,"4d",H5T_NATIVE_INT,buf4);
- for(i = 0; i < 6; i++)
+ write_dset(gid[5], 1, dims1, "1d", H5T_NATIVE_INT, buf1);
+ write_dset(gid[5], 2, dims2, "2d", H5T_NATIVE_INT, buf2);
+ write_dset(gid[5], 3, dims3, "3d", H5T_NATIVE_INT, buf3);
+ write_dset(gid[5], 4, dims4, "4d", H5T_NATIVE_INT, buf4);
+ for (i = 0; i < 6; i++)
H5Gclose(gid[i]);
/*-------------------------------------------------------------------------
@@ -6150,10 +6126,8 @@ static void gent_aindices(void)
*/
ret = H5Fclose(fid);
HDassert(ret >= 0);
-
}
-
/*-------------------------------------------------------------------------
* Function: gent_longlinks
*
@@ -6161,13 +6135,14 @@ static void gent_aindices(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_longlinks(void)
+static void
+gent_longlinks(void)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
- char *objname = NULL; /* Name of object [Long] */
- size_t u; /* Local index variable */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
+ char * objname = NULL; /* Name of object [Long] */
+ size_t u; /* Local index variable */
/* Create files */
fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -6178,9 +6153,9 @@ static void gent_longlinks(void)
HDassert(gid >= 0);
/* Construct very long file name */
- objname = (char*) HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
+ objname = (char *)HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
HDassert(objname);
- for(u = 0; u < F51_MAX_NAME_LEN; u++)
+ for (u = 0; u < F51_MAX_NAME_LEN; u++)
objname[u] = 'a';
objname[F51_MAX_NAME_LEN] = '\0';
@@ -6211,40 +6186,41 @@ static void gent_longlinks(void)
*
*-------------------------------------------------------------------------
*/
-static int gent_ldouble(void)
+static int
+gent_ldouble(void)
{
hid_t fid;
hid_t did;
hid_t tid;
hid_t sid;
hsize_t dims[1] = {3};
- long double buf[3] = {1,2,3};
+ long double buf[3] = {1, 2, 3};
- if((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto error;
- if((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
goto error;
- if(H5Tget_size(tid) == 0)
+ if (H5Tget_size(tid) == 0)
goto error;
- if((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
return 0;
@@ -6252,10 +6228,8 @@ static int gent_ldouble(void)
error:
HDprintf("error !\n");
return -1;
-
}
-
/*-------------------------------------------------------------------------
* Function: gent_binary
*
@@ -6270,16 +6244,15 @@ error:
static void
gent_binary(void)
{
- hid_t fid, sid, did, aid;
- hsize_t dims[1] = {6};
- int ibuf[6] = {1,2,3,4,5,6};
- float fbuf[6] = {1,2,3,4,5,6};
- double dbuf[6] = {1,2,3,4,5,6};
+ hid_t fid, sid, did, aid;
+ hsize_t dims[1] = {6};
+ int ibuf[6] = {1, 2, 3, 4, 5, 6};
+ float fbuf[6] = {1, 2, 3, 4, 5, 6};
+ double dbuf[6] = {1, 2, 3, 4, 5, 6};
fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
sid = H5Screate_simple(1, dims, NULL);
-
/*-------------------------------------------------------------------------
* integer
*-------------------------------------------------------------------------
@@ -6308,7 +6281,6 @@ gent_binary(void)
H5Aclose(aid);
H5Dclose(did);
-
/* close */
H5Sclose(sid);
H5Fclose(fid);
@@ -6322,88 +6294,86 @@ gent_binary(void)
*
*-------------------------------------------------------------------------
*/
-#define GB4LL ((unsigned long long) 4*1024*1024*1024)
-#define DIM_4GB (GB4LL + 10)
+#define GB4LL ((unsigned long long)4 * 1024 * 1024 * 1024)
+#define DIM_4GB (GB4LL + 10)
static void
gent_bigdims(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t f_sid = H5I_INVALID_HID;
- hid_t m_sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */
- hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[1] = {DIM_4GB}; /* dataset dimensions */
+ hsize_t chunk_dims[1] = {1024}; /* chunk dimensions */
hsize_t hs_start[1];
- hsize_t hs_size[1]; /* hyperslab dimensions */
+ hsize_t hs_size[1]; /* hyperslab dimensions */
size_t size;
- char fillvalue=0;
- char *buf=NULL;
+ char fillvalue = 0;
+ char * buf = NULL;
hsize_t i;
char c;
size_t nelmts;
int ret;
/* create a file */
- fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
HDassert(fid >= 0);
/* create dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
goto out;
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
goto out;
- if((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(fid, "dset4gb", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset4gb", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((size = H5Tget_size(tid)) <= 0)
+ if ((size = H5Tget_size(tid)) <= 0)
goto out;
/* select an hyperslab */
- nelmts = 20;
+ nelmts = 20;
hs_start[0] = GB4LL - 10;
hs_size[0] = nelmts;
- if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
- buf=(char *) HDmalloc((unsigned)(nelmts*size));
+ buf = (char *)HDmalloc((unsigned)(nelmts * size));
- for(i=0, c=0; i<nelmts; i++, c++)
- {
+ for (i = 0, c = 0; i < nelmts; i++, c++) {
buf[i] = c;
}
- if(H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size,NULL) < 0)
+ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
goto out;
- if(H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_SCHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0)
goto out;
-
HDfree(buf);
- buf=NULL;
+ buf = NULL;
/* close */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
- if(H5Sclose(f_sid) < 0)
+ if (H5Sclose(f_sid) < 0)
goto out;
f_sid = H5I_INVALID_HID;
- if(H5Sclose(m_sid) < 0)
+ if (H5Sclose(m_sid) < 0)
goto out;
m_sid = H5I_INVALID_HID;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
dcpl = H5I_INVALID_HID;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_INVALID_HID;
@@ -6412,21 +6382,21 @@ gent_bigdims(void)
return;
- out:
+out:
HDprintf("Error.....\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
H5Tclose(tid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return;
}
-
-
/*-------------------------------------------------------------------------
* Function: gent_hyperslab
*
@@ -6437,20 +6407,20 @@ gent_bigdims(void)
static void
gent_hyperslab(void)
{
- hid_t fid; /* file id */
- hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */
- double *buf;
- int i, ret;
+ hid_t fid; /* file id */
+ hsize_t dims[2] = {32, 4097}; /* big enough data size to force a second stripmine read */
+ double *buf;
+ int i, ret;
- buf = (double*) HDmalloc(32 * 4097 * sizeof(double) );
- for(i = 0; i < 32 * 4097; i++)
+ buf = (double *)HDmalloc(32 * 4097 * sizeof(double));
+ for (i = 0; i < 32 * 4097; i++)
buf[i] = 1;
/* create a file */
- fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
- write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf);
+ write_dset(fid, 2, dims, "stripmine", H5T_NATIVE_DOUBLE, buf);
ret = H5Fclose(fid);
HDassert(ret >= 0);
@@ -6469,23 +6439,22 @@ gent_hyperslab(void)
static void
gent_group_creation_order(void)
{
- hid_t fid = H5I_INVALID_HID; /* file ID */
- hid_t gid = H5I_INVALID_HID; /* group ID */
- hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
- hid_t fcpl_id = H5I_INVALID_HID; /* file creation property list ID (to set root group order) */
+ hid_t fid = H5I_INVALID_HID; /* file ID */
+ hid_t gid = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
+ hid_t fcpl_id = H5I_INVALID_HID; /* file creation property list ID (to set root group order) */
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
- if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED ) < 0)
+ if (H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
- if((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0)
goto out;
-
/* create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -6493,128 +6462,124 @@ gent_group_creation_order(void)
*-------------------------------------------------------------------------
*/
-
- if((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
-
/*-------------------------------------------------------------------------
* create a group "1" with H5P_CRT_ORDER_TRACKED set
*-------------------------------------------------------------------------
*/
- if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
-
- if((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
-
- if(H5Pclose(gcpl_id) < 0)
+ if (H5Pclose(gcpl_id) < 0)
goto out;
gcpl_id = H5I_INVALID_HID;
- if(H5Pclose(fcpl_id) < 0)
+ if (H5Pclose(fcpl_id) < 0)
goto out;
fcpl_id = H5I_INVALID_HID;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
fid = H5I_INVALID_HID;
return;
- out:
+out:
HDprintf("Error.....\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Pclose(gcpl_id);
H5Pclose(fcpl_id);
H5Fclose(fid);
-
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return;
-
}
/*-------------------------------------------------------------------------
@@ -6628,47 +6593,47 @@ gent_group_creation_order(void)
static void
gent_attr_creation_order(void)
{
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t gid = H5I_INVALID_HID; /* group id */
- hid_t did = H5I_INVALID_HID; /* dataset id */
- hid_t sid = H5I_INVALID_HID; /* space id */
- hid_t aid = H5I_INVALID_HID; /* attribute id */
- hid_t tid = H5I_INVALID_HID; /* datatype id */
- hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
- hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
- int i;
- const char *attr_name[3] = {"c", "b", "a" };
-
- if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t did = H5I_INVALID_HID; /* dataset id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t aid = H5I_INVALID_HID; /* attribute id */
+ hid_t tid = H5I_INVALID_HID; /* datatype id */
+ hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
+ int i;
+ const char *attr_name[3] = {"c", "b", "a"};
+
+ if ((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
goto out;
/* create dataset creation property list */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
/* create dataset creation property list */
- if((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0)
+ if ((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0)
goto out;
/* enable attribute creation order tracking on dataset property list */
- if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
/* enable attribute creation order tracking on group property list */
- if(H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
/* enable attribute creation order tracking on datatype property list */
- if(H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
/* create a dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -6677,74 +6642,68 @@ gent_attr_creation_order(void)
*/
/* create a dataset */
- if((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_INVALID_HID;
-
/*-------------------------------------------------------------------------
* create a dataset without creation order tracked for attributes and atributes in it
*-------------------------------------------------------------------------
*/
/* create a dataset */
- if((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_INVALID_HID;
-
-
/*-------------------------------------------------------------------------
* create a group with creation order tracked for attributes and atributes in it
*-------------------------------------------------------------------------
*/
- if((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
@@ -6753,22 +6712,21 @@ gent_attr_creation_order(void)
*-------------------------------------------------------------------------
*/
- if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
@@ -6777,25 +6735,24 @@ gent_attr_creation_order(void)
*-------------------------------------------------------------------------
*/
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto out;
- if((H5Tcommit2(fid, "tt", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0)
+ if ((H5Tcommit2(fid, "tt", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
@@ -6804,25 +6761,24 @@ gent_attr_creation_order(void)
*-------------------------------------------------------------------------
*/
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto out;
- if((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
@@ -6830,22 +6786,21 @@ gent_attr_creation_order(void)
* add some attributes to the root group
*-------------------------------------------------------------------------
*/
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
@@ -6853,29 +6808,28 @@ gent_attr_creation_order(void)
* close
*-------------------------------------------------------------------------
*/
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_INVALID_HID;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
goto out;
dcpl_id = H5I_INVALID_HID;
- if(H5Pclose(gcpl_id) < 0)
+ if (H5Pclose(gcpl_id) < 0)
goto out;
gcpl_id = H5I_INVALID_HID;
- if(H5Pclose(tcpl_id) < 0)
+ if (H5Pclose(tcpl_id) < 0)
goto out;
tcpl_id = H5I_INVALID_HID;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
fid = H5I_INVALID_HID;
-
-
return;
- out:
+out:
HDprintf("Error.....\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Dclose(did);
H5Sclose(sid);
@@ -6883,10 +6837,9 @@ gent_attr_creation_order(void)
H5Pclose(dcpl_id);
H5Pclose(tcpl_id);
H5Fclose(fid);
-
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return;
-
}
/*-------------------------------------------------------------------------
@@ -6902,10 +6855,10 @@ gent_attr_creation_order(void)
static void
gent_fpformat(void)
{
- hid_t fid, sid, did;
- hsize_t dims[1] = {6};
- double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
- float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
+ hid_t fid, sid, did;
+ hsize_t dims[1] = {6};
+ double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
+ float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
sid = H5Screate_simple(1, dims, NULL);
@@ -6918,7 +6871,6 @@ gent_fpformat(void)
H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
H5Dclose(did);
-
/*-------------------------------------------------------------------------
* float
*-------------------------------------------------------------------------
@@ -6927,7 +6879,6 @@ gent_fpformat(void)
H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf);
H5Dclose(did);
-
/* close */
H5Sclose(sid);
H5Fclose(fid);
@@ -6945,15 +6896,14 @@ gent_fpformat(void)
static void
gent_extlinks(void)
{
- hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid;
- hsize_t dims[1] = {6};
- int buf[6] = {1, 2, 3, 4, 5, 6};
+ hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
/* create two files, a source and a target */
source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
+ far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
* create Groups, a Dataset, a committed Datatype, external links, and a
@@ -6977,7 +6927,6 @@ gent_extlinks(void)
H5Gclose(gid2);
H5Gclose(gid);
-
sid = H5Screate_simple(1, dims, NULL);
did = H5Dcreate2(target_fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -7031,30 +6980,31 @@ gent_extlinks(void)
static void
gent_packedbits(void)
{
- hid_t fid, dataset, space;
- hsize_t dims[2];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8];
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
+ uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
+ uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
+ uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
+ int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
+ int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
+ int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
+ int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
+ double dsetdbl[F66_XDIM][F66_YDIM8];
unsigned int i, j;
fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++)
+ for (j = 1; j < dims[1]; j++)
dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -7064,15 +7014,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++)
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++)
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -7081,15 +7032,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++)
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
valu32bits <<= 1;
}
@@ -7098,15 +7050,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++)
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
valu64bits <<= 1;
}
@@ -7115,15 +7068,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++)
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++)
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
val8bits = (int8_t)(val8bits << 1);
}
@@ -7132,15 +7086,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++)
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++)
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
val16bits = (int16_t)(val16bits << 1);
}
@@ -7149,15 +7104,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++)
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dset32[i][j] = dset32[i][j - 1] << 1;
val32bits <<= 1;
}
@@ -7166,15 +7122,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++)
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dset64[i][j] = dset64[i][j - 1] << 1;
val64bits <<= 1;
}
@@ -7183,12 +7140,13 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -7212,32 +7170,33 @@ gent_packedbits(void)
static void
gent_attr_intsize(void)
{
- hid_t fid, attr, space, root;
- hsize_t dims[2];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8];
+ hid_t fid, attr, space, root;
+ hsize_t dims[2];
+ uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
+ uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
+ uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
+ uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
+ int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
+ int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
+ int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
+ int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
+ double dsetdbl[F66_XDIM][F66_YDIM8];
unsigned int i, j;
- fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* Attribute of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -7247,15 +7206,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -7265,15 +7225,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -7283,15 +7244,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -7301,15 +7263,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -7319,15 +7282,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -7337,15 +7301,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -7355,15 +7320,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -7373,12 +7339,13 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
@@ -7393,77 +7360,85 @@ gent_attr_intsize(void)
static void
gent_nodata(void)
{
- hid_t fid, dataset, space;
+ hid_t fid, dataset, space;
hsize_t dims[2];
fid = H5Fcreate(FILE87, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
}
-
/*-------------------------------------------------------------------------
* Function: gent_charsets
*
@@ -7477,83 +7452,88 @@ gent_nodata(void)
static void
gent_charsets(void)
{
- hid_t fid, did, sid;
- herr_t status;
+ hid_t fid, did, sid;
+ herr_t status;
hsize_t dim[] = {1}; /* Dataspace dimensions */
typedef struct CharSetInfo {
- const char *ascii_p_;
- const char *utf8_p_;
+ const char *ascii_p_;
+ const char *utf8_p_;
} CharSetInfo;
- hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) );
- hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
- hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
- const char * writeData[] = { "ascii", "utf8", };
+ hid_t charset_dtid = H5Tcreate(H5T_COMPOUND, sizeof(CharSetInfo));
+ hid_t ascii_dtid = H5Tcreate(H5T_STRING, H5T_VARIABLE);
+ hid_t utf8_dtid = H5Tcreate(H5T_STRING, H5T_VARIABLE);
+ const char *writeData[] = {
+ "ascii",
+ "utf8",
+ };
- sid = H5Screate_simple( 1, dim, NULL );
- fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
- status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII );
+ sid = H5Screate_simple(1, dim, NULL);
+ fid = H5Fcreate(FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Tset_cset(ascii_dtid, H5T_CSET_ASCII);
HDassert(status >= 0);
- H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid );
+ H5Tinsert(charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_), ascii_dtid);
- status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 );
+ status = H5Tset_cset(utf8_dtid, H5T_CSET_UTF8);
HDassert(status >= 0);
- H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid );
+ H5Tinsert(charset_dtid, "utf8", HOFFSET(CharSetInfo, utf8_p_), utf8_dtid);
- did = H5Dcreate2( fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+ did = H5Dcreate2(fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite( did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData );
+ status = H5Dwrite(did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData);
HDassert(status >= 0);
- H5Tclose( charset_dtid );
- H5Tclose( ascii_dtid );
- H5Tclose( utf8_dtid );
- H5Sclose( sid );
- H5Dclose( did );
- H5Fclose( fid );
+ H5Tclose(charset_dtid);
+ H5Tclose(ascii_dtid);
+ H5Tclose(utf8_dtid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
}
-static void gent_compound_intsizes(void) {
- hid_t fid, dataset, space;
- hsize_t dims[2];
- hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */
- hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */
- hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */
- hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */
- hid_t arrayu8_tid; /* Array datatype handle */
- hid_t arrayu16_tid; /* Array datatype handle */
- hid_t arrayu32_tid; /* Array datatype handle */
- hid_t arrayu64_tid; /* Array datatype handle */
- hid_t array8_tid; /* Array datatype handle */
- hid_t array16_tid; /* Array datatype handle */
- hid_t array32_tid; /* Array datatype handle */
- hid_t array64_tid; /* Array datatype handle */
- hid_t arraydbl_tid; /* Array datatype handle */
+static void
+gent_compound_intsizes(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ hsize_t array_dim8[] = {F70_XDIM, F70_YDIM8}; /* Array dimensions */
+ hsize_t array_dim16[] = {F70_XDIM, F70_YDIM16}; /* Array dimensions */
+ hsize_t array_dim32[] = {F70_XDIM, F70_YDIM32}; /* Array dimensions */
+ hsize_t array_dim64[] = {F70_XDIM, F70_YDIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
/* Structure and array for compound types */
typedef struct Array1Struct {
- uint8_t dsetu8[F70_XDIM][F70_YDIM8];
- uint16_t dsetu16[F70_XDIM][F70_YDIM16];
- uint32_t dsetu32[F70_XDIM][F70_YDIM32];
- uint64_t dsetu64[F70_XDIM][F70_YDIM64];
- int8_t dset8[F70_XDIM][F70_YDIM8];
- int16_t dset16[F70_XDIM][F70_YDIM16];
- int32_t dset32[F70_XDIM][F70_YDIM32];
- int64_t dset64[F70_XDIM][F70_YDIM64];
- double dsetdbl[F70_XDIM][F70_YDIM8];
+ uint8_t dsetu8[F70_XDIM][F70_YDIM8];
+ uint16_t dsetu16[F70_XDIM][F70_YDIM16];
+ uint32_t dsetu32[F70_XDIM][F70_YDIM32];
+ uint64_t dsetu64[F70_XDIM][F70_YDIM64];
+ int8_t dset8[F70_XDIM][F70_YDIM8];
+ int16_t dset16[F70_XDIM][F70_YDIM16];
+ int32_t dset32[F70_XDIM][F70_YDIM32];
+ int64_t dset64[F70_XDIM][F70_YDIM64];
+ double dsetdbl[F70_XDIM][F70_YDIM8];
} Array1Struct;
Array1Struct Array1[F70_LENGTH];
- hid_t Array1Structid; /* File datatype identifier */
- herr_t status; /* Error checking variable */
- hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */
+ hid_t Array1Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F70_LENGTH}; /* Dataspace dimensions */
int m, n, o; /* Array init loop vars */
@@ -7561,106 +7541,115 @@ static void gent_compound_intsizes(void) {
for (m = 0; m < F70_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o - 1] << 1;
}
valu32bits <<= 1;
}
/* Array of 64 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o - 1] << 1;
}
valu64bits <<= 1;
}
/* Array of 8 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset32[n][o] = Array1[m].dset32[n][o - 1] << 1;
}
val32bits <<= 1;
}
/* Array of 64 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset64[n][o] = Array1[m].dset64[n][o - 1] << 1;
}
val64bits <<= 1;
}
/* Double Dummy set for failure tests */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- for(n = 0; n < (int)dims[0]; n++)
- for(o = 0; o < (int)dims[1]; o++)
+ for (n = 0; n < (int)dims[0]; n++)
+ for (o = 0; o < (int)dims[1]; o++)
Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
@@ -7788,47 +7777,49 @@ static void gent_compound_intsizes(void) {
HDassert(status >= 0);
}
-static void gent_compound_attr_intsizes(void) {
- hid_t fid, attr, space, root;
- hsize_t dims[2];
- hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */
- hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */
- hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */
- hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */
- hid_t arrayu8_tid; /* Array datatype handle */
- hid_t arrayu16_tid; /* Array datatype handle */
- hid_t arrayu32_tid; /* Array datatype handle */
- hid_t arrayu64_tid; /* Array datatype handle */
- hid_t array8_tid; /* Array datatype handle */
- hid_t array16_tid; /* Array datatype handle */
- hid_t array32_tid; /* Array datatype handle */
- hid_t array64_tid; /* Array datatype handle */
- hid_t arraydbl_tid; /* Array datatype handle */
+static void
+gent_compound_attr_intsizes(void)
+{
+ hid_t fid, attr, space, root;
+ hsize_t dims[2];
+ hsize_t array_dim8[] = {F70_XDIM, F70_YDIM8}; /* Array dimensions */
+ hsize_t array_dim16[] = {F70_XDIM, F70_YDIM16}; /* Array dimensions */
+ hsize_t array_dim32[] = {F70_XDIM, F70_YDIM32}; /* Array dimensions */
+ hsize_t array_dim64[] = {F70_XDIM, F70_YDIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
/* Structure and array for compound types */
typedef struct Array1Struct {
- uint8_t dsetu8[F70_XDIM][F70_YDIM8];
- uint16_t dsetu16[F70_XDIM][F70_YDIM16];
- uint32_t dsetu32[F70_XDIM][F70_YDIM32];
- uint64_t dsetu64[F70_XDIM][F70_YDIM64];
- int8_t dset8[F70_XDIM][F70_YDIM8];
- int16_t dset16[F70_XDIM][F70_YDIM16];
- int32_t dset32[F70_XDIM][F70_YDIM32];
- int64_t dset64[F70_XDIM][F70_YDIM64];
- double dsetdbl[F70_XDIM][F70_YDIM8];
+ uint8_t dsetu8[F70_XDIM][F70_YDIM8];
+ uint16_t dsetu16[F70_XDIM][F70_YDIM16];
+ uint32_t dsetu32[F70_XDIM][F70_YDIM32];
+ uint64_t dsetu64[F70_XDIM][F70_YDIM64];
+ int8_t dset8[F70_XDIM][F70_YDIM8];
+ int16_t dset16[F70_XDIM][F70_YDIM16];
+ int32_t dset32[F70_XDIM][F70_YDIM32];
+ int64_t dset64[F70_XDIM][F70_YDIM64];
+ double dsetdbl[F70_XDIM][F70_YDIM8];
} Array1Struct;
Array1Struct Array1[F70_LENGTH];
- hid_t Array1Structid; /* File datatype identifier */
- herr_t status; /* Error checking variable */
- hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */
+ hid_t Array1Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F70_LENGTH}; /* Dataspace dimensions */
int m, n, o; /* Array init loop vars */
@@ -7836,106 +7827,115 @@ static void gent_compound_attr_intsizes(void) {
for (m = 0; m < F70_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o - 1] << 1;
}
valu32bits <<= 1;
}
/* Array of 64 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o - 1] << 1;
}
valu64bits <<= 1;
}
/* Array of 8 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset32[n][o] = Array1[m].dset32[n][o - 1] << 1;
}
val32bits <<= 1;
}
/* Array of 64 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset64[n][o] = Array1[m].dset64[n][o - 1] << 1;
}
val64bits <<= 1;
}
/* Double Dummy set for failure tests */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- for(n = 0; n < (int)dims[0]; n++)
- for(o = 0; o < (int)dims[1]; o++)
+ for (n = 0; n < (int)dims[0]; n++)
+ for (o = 0; o < (int)dims[1]; o++)
Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
@@ -8065,51 +8065,53 @@ static void gent_compound_attr_intsizes(void) {
HDassert(status >= 0);
}
-static void gent_nested_compound_dt(void) { /* test nested data type */
- hid_t fid, group, dataset, space, type, create_plist, type1, type2;
- hid_t array_dt, enum_dt;
+static void
+gent_nested_compound_dt(void)
+{ /* test nested data type */
+ hid_t fid, group, dataset, space, type, create_plist, type1, type2;
+ hid_t array_dt, enum_dt;
enumtype val;
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset1_t;
dset1_t dset1[10];
typedef struct {
- int a;
- float b;
- enumtype c;
+ int a;
+ float b;
+ enumtype c;
} dset2_t;
dset2_t dset2[10];
typedef struct {
- int a[5];
- float b[5][6];
- dset1_t c;
+ int a[5];
+ float b[5][6];
+ dset1_t c;
} dset3_t;
dset3_t dset3[10];
enumtype dset4[] = {RED, GREEN, BLUE, GREEN, WHITE, BLUE};
- int i, j, k;
+ int i, j, k;
unsigned ndims;
- hsize_t dim[2];
+ hsize_t dim[2];
hsize_t sdim, maxdim;
sdim = 10;
- for(i = 0; i < (int)sdim; i++) {
+ for (i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
- dset1[i].b = (float)(i*i);
+ dset1[i].b = (float)(i * i);
dset2[i].a = i;
dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset2[i].c = GREEN;
- for(j = 0; j < 5; j++) {
+ for (j = 0; j < 5; j++) {
dset3[i].a[j] = i * j;
- for(k = 0; k < 6; k++) {
+ for (k = 0; k < 6; k++) {
dset3[i].b[j][k] = (float)((float)i * (float)j * (float)k * 1.0F);
}
}
@@ -8124,13 +8126,12 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
sdim = 2;
H5Pset_chunk(create_plist, 1, &sdim);
-
- sdim = 6;
+ sdim = 6;
maxdim = H5S_UNLIMITED;
space = H5Screate_simple(1, &sdim, &maxdim);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32LE);
H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32LE);
@@ -8142,20 +8143,20 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
H5Dclose(dataset);
/* Create the shared enumerated datatype. */
- enum_dt = H5Tenum_create (H5T_NATIVE_INT);
- val = (enumtype) RED;
- H5Tenum_insert (enum_dt, "Red", &val);
- val = (enumtype) GREEN;
- H5Tenum_insert (enum_dt, "Green", &val);
- val = (enumtype) BLUE;
- H5Tenum_insert (enum_dt, "Blue", &val);
- val = (enumtype) WHITE;
- H5Tenum_insert (enum_dt, "White", &val);
- val = (enumtype) BLACK;
- H5Tenum_insert (enum_dt, "Black", &val);
- H5Tcommit2(fid, "enumtype", enum_dt, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2[0]));
+ enum_dt = H5Tenum_create(H5T_NATIVE_INT);
+ val = (enumtype)RED;
+ H5Tenum_insert(enum_dt, "Red", &val);
+ val = (enumtype)GREEN;
+ H5Tenum_insert(enum_dt, "Green", &val);
+ val = (enumtype)BLUE;
+ H5Tenum_insert(enum_dt, "Blue", &val);
+ val = (enumtype)WHITE;
+ H5Tenum_insert(enum_dt, "White", &val);
+ val = (enumtype)BLACK;
+ H5Tenum_insert(enum_dt, "Black", &val);
+ H5Tcommit2(fid, "enumtype", enum_dt, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset2[0]));
H5Tinsert(type2, "a_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "b_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
@@ -8181,19 +8182,22 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
- ndims = 1; dim[0] = 5;
+ ndims = 1;
+ dim[0] = 5;
array_dt = H5Tarray_create2(H5T_STD_I32LE, ndims, dim);
H5Tinsert(type2, "int_name", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
- ndims = 2; dim[0] = 5; dim[1] = 6;
+ ndims = 2;
+ dim[0] = 5;
+ dim[1] = 6;
array_dt = H5Tarray_create2(H5T_IEEE_F32LE, ndims, dim);
H5Tinsert(type2, "float_name", HOFFSET(dset3_t, b), array_dt);
H5Tclose(array_dt);
- H5Tinsert (type2, "cmpd_name", HOFFSET (dset3_t, c), type1);
+ H5Tinsert(type2, "cmpd_name", HOFFSET(dset3_t, c), type1);
dataset = H5Dcreate2(group, "dset3", type2, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
@@ -8211,7 +8215,6 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
H5Pclose(create_plist);
H5Fclose(fid);
-
}
/*-------------------------------------------------------------------------
@@ -8227,32 +8230,33 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
static void
gent_intscalars(void)
{
- hid_t fid, dataset, space, tid;
- hsize_t dims[2];
- uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
- uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
- uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
- uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
- int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
- int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
- int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
- int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
- double dsetdbl[F73_XDIM][F73_YDIM8];
+ hid_t fid, dataset, space, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
unsigned int i, j;
fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -8262,16 +8266,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -8281,16 +8286,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -8300,16 +8306,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -8319,16 +8326,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -8338,16 +8346,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -8357,16 +8366,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -8376,16 +8386,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -8395,13 +8406,14 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -8425,33 +8437,34 @@ gent_intscalars(void)
static void
gent_attr_intscalars(void)
{
- hid_t fid, attr, space, root, tid;
- hsize_t dims[2];
- uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
- uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
- uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
- uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
- int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
- int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
- int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
- int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
- double dsetdbl[F73_XDIM][F73_YDIM8];
+ hid_t fid, attr, space, root, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
unsigned int i, j;
- fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* Attribute of 8 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -8461,16 +8474,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 16 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -8480,16 +8494,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 32 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -8499,16 +8514,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 64 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -8518,16 +8534,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 8 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -8537,16 +8554,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 16 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -8556,16 +8574,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 32 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -8575,16 +8594,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 64 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -8594,13 +8614,14 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Double Dummy set for failure tests */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, tid, dsetdbl);
@@ -8624,28 +8645,29 @@ gent_attr_intscalars(void)
static void
gent_string_scalars(void)
{
- hid_t fid, attr, dataset, space, tid, root;
- hsize_t dims[2];
- char string[F73_XDIM][F73_YDIM8];
+ hid_t fid, attr, dataset, space, tid, root;
+ hsize_t dims[2];
+ char string[F73_XDIM][F73_YDIM8];
unsigned int i, j;
- fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* string scalar */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tcopy(H5T_C_S1);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tcopy(H5T_C_S1);
H5Tset_size(tid, F73_XDIM * F73_YDIM8);
memset(string, ' ', F73_XDIM * F73_YDIM8);
- for(i = 0; i < dims[0]; i++) {
+ for (i = 0; i < dims[0]; i++) {
string[i][0] = (char)('A' + i);
- for(j = 1; j < dims[1]; j++) {
- string[i][j] = (char)(string[i][j-1] + 1);
+ for (j = 1; j < dims[1]; j++) {
+ string[i][j] = (char)(string[i][j - 1] + 1);
}
}
- string[dims[0]-1][dims[1]-1] = 0;
+ string[dims[0] - 1][dims[1] - 1] = 0;
/* Dataset of string scalar */
dataset = H5Dcreate2(fid, "the_str", tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -8664,47 +8686,49 @@ gent_string_scalars(void)
H5Fclose(fid);
}
-static void gent_compound_int_array(void) {
- hid_t fid, dataset, space;
- hsize_t dims[1];
+static void
+gent_compound_int_array(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[1];
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
- hsize_t array_dim8[]={F76_DIM8}; /* Array dimensions */
- hsize_t array_dim16[]={F76_DIM16}; /* Array dimensions */
- hsize_t array_dim32[]={F76_DIM32}; /* Array dimensions */
- hsize_t array_dim64[]={F76_DIM64}; /* Array dimensions */
- hid_t arrayu8_tid; /* Array datatype handle */
- hid_t arrayu16_tid; /* Array datatype handle */
- hid_t arrayu32_tid; /* Array datatype handle */
- hid_t arrayu64_tid; /* Array datatype handle */
- hid_t array8_tid; /* Array datatype handle */
- hid_t array16_tid; /* Array datatype handle */
- hid_t array32_tid; /* Array datatype handle */
- hid_t array64_tid; /* Array datatype handle */
- hid_t arraydbl_tid; /* Array datatype handle */
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+ hsize_t array_dim8[] = {F76_DIM8}; /* Array dimensions */
+ hsize_t array_dim16[] = {F76_DIM16}; /* Array dimensions */
+ hsize_t array_dim32[] = {F76_DIM32}; /* Array dimensions */
+ hsize_t array_dim64[] = {F76_DIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
/* Structure and array for compound types */
typedef struct Cmpd1Struct {
- uint8_t dsetu8[F76_DIM8];
- uint16_t dsetu16[F76_DIM16];
- uint32_t dsetu32[F76_DIM32];
- uint64_t dsetu64[F76_DIM64];
- int8_t dset8[F76_DIM8];
- int16_t dset16[F76_DIM16];
- int32_t dset32[F76_DIM32];
- int64_t dset64[F76_DIM64];
- double dsetdbl[F76_DIM8];
+ uint8_t dsetu8[F76_DIM8];
+ uint16_t dsetu16[F76_DIM16];
+ uint32_t dsetu32[F76_DIM32];
+ uint64_t dsetu64[F76_DIM64];
+ int8_t dset8[F76_DIM8];
+ int16_t dset16[F76_DIM16];
+ int32_t dset32[F76_DIM32];
+ int64_t dset64[F76_DIM64];
+ double dsetdbl[F76_DIM8];
} Cmpd1Struct;
Cmpd1Struct Cmpd1[F76_LENGTH];
- hid_t Cmpd1Structid; /* File datatype identifier */
- herr_t status; /* Error checking variable */
- hsize_t dim[] = { F76_LENGTH }; /* Dataspace dimensions */
+ hid_t Cmpd1Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F76_LENGTH}; /* Dataspace dimensions */
int m, n; /* Array init loop vars */
@@ -8714,26 +8738,26 @@ static void gent_compound_int_array(void) {
/* Array of 8 bits unsigned int */
dims[0] = F76_DIM8;
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu8[n] = valu8bits;
- valu8bits = (uint8_t)(valu8bits << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F76_DIM16;
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu16[n] = valu16bits;
- valu16bits = (uint16_t)(valu16bits << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F76_DIM32;
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu32[n] = valu32bits;
valu32bits <<= 1;
}
@@ -8741,8 +8765,8 @@ static void gent_compound_int_array(void) {
/* Array of 64 bits unsigned int */
dims[0] = F76_DIM64;
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu64[n] = valu64bits;
valu64bits <<= 1;
}
@@ -8750,26 +8774,26 @@ static void gent_compound_int_array(void) {
/* Array of 8 bits signed int */
dims[0] = F76_DIM8;
- val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset8[n] = val8bits;
- val8bits = (int8_t)(val8bits << 1);
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F76_DIM16;
- val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset16[n] = val16bits;
- val16bits = (int16_t)(val16bits << 1);
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F76_DIM32;
- val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset32[n] = val32bits;
val32bits <<= 1;
}
@@ -8777,8 +8801,8 @@ static void gent_compound_int_array(void) {
/* Array of 64 bits signed int */
dims[0] = F76_DIM64;
- val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset64[n] = val64bits;
val64bits <<= 1;
}
@@ -8786,7 +8810,7 @@ static void gent_compound_int_array(void) {
/* Double Dummy set for failure tests */
dims[0] = F76_DIM8;
- for(n = 0; n < (int)dims[0]; n++)
+ for (n = 0; n < (int)dims[0]; n++)
Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n;
}
@@ -8914,47 +8938,49 @@ static void gent_compound_int_array(void) {
HDassert(status >= 0);
}
-static void gent_compound_ints(void) {
- hid_t fid, dataset, space;
- uint8_t valu8bits = (uint8_t) ~0u; /* all 1s */
- uint16_t valu16bits = (uint16_t) ~0u; /* all 1s */
- uint32_t valu32bits = (uint32_t) ~0u; /* all 1s */
- uint64_t valu64bits = (uint64_t) ~0Lu; /* all 1s */
- int8_t val8bits = (int8_t) ~0; /* all 1s */
- int16_t val16bits = (int16_t) ~0; /* all 1s */
- int32_t val32bits = (int32_t) ~0; /* all 1s */
- int64_t val64bits = (int64_t) ~0L; /* all 1s */
+static void
+gent_compound_ints(void)
+{
+ hid_t fid, dataset, space;
+ uint8_t valu8bits = (uint8_t)~0u; /* all 1s */
+ uint16_t valu16bits = (uint16_t)~0u; /* all 1s */
+ uint32_t valu32bits = (uint32_t)~0u; /* all 1s */
+ uint64_t valu64bits = (uint64_t)~0Lu; /* all 1s */
+ int8_t val8bits = (int8_t)~0; /* all 1s */
+ int16_t val16bits = (int16_t)~0; /* all 1s */
+ int32_t val32bits = (int32_t)~0; /* all 1s */
+ int64_t val64bits = (int64_t)~0L; /* all 1s */
/* Structure and array for compound types */
typedef struct Cmpd1Struct {
- uint8_t dsetu8;
- uint16_t dsetu16;
- uint32_t dsetu32;
- uint64_t dsetu64;
- int8_t dset8;
- int16_t dset16;
- int32_t dset32;
- int64_t dset64;
- double dsetdbl;
+ uint8_t dsetu8;
+ uint16_t dsetu16;
+ uint32_t dsetu32;
+ uint64_t dsetu64;
+ int8_t dset8;
+ int16_t dset16;
+ int32_t dset32;
+ int64_t dset64;
+ double dsetdbl;
} Cmpd1Struct;
Cmpd1Struct Cmpd1[F77_LENGTH];
typedef struct Cmpd2Struct {
- uint64_t dsetu64;
- uint32_t dsetu32;
- uint16_t dsetu16;
- uint8_t dsetu8;
- int64_t dset64;
- int32_t dset32;
- int16_t dset16;
- int8_t dset8;
- double dsetdbl;
+ uint64_t dsetu64;
+ uint32_t dsetu32;
+ uint16_t dsetu16;
+ uint8_t dsetu8;
+ int64_t dset64;
+ int32_t dset32;
+ int16_t dset16;
+ int8_t dset8;
+ double dsetdbl;
} Cmpd2Struct;
Cmpd2Struct Cmpd2[F77_LENGTH];
- hid_t Cmpd1Structid; /* File datatype identifier */
- hid_t Cmpd2Structid; /* File datatype identifier */
- herr_t status; /* Error checking variable */
- hsize_t dim[] = { F77_LENGTH }; /* Dataspace dimensions */
+ hid_t Cmpd1Structid; /* File datatype identifier */
+ hid_t Cmpd2Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F77_LENGTH}; /* Dataspace dimensions */
int m; /* Array init loop vars */
@@ -8962,57 +8988,57 @@ static void gent_compound_ints(void) {
for (m = 0; m < F77_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- if((m % F76_DIM8) == 0)
- valu8bits = (uint8_t) ~0u; /* all 1s */
+ if ((m % F76_DIM8) == 0)
+ valu8bits = (uint8_t)~0u; /* all 1s */
Cmpd1[m].dsetu8 = valu8bits;
Cmpd2[m].dsetu8 = valu8bits;
- valu8bits = (uint8_t)(valu8bits << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
/* Array of 16 bits unsigned int */
- if((m % F76_DIM16) == 0)
- valu16bits = (uint16_t) ~0u; /* all 1s */
+ if ((m % F76_DIM16) == 0)
+ valu16bits = (uint16_t)~0u; /* all 1s */
Cmpd1[m].dsetu16 = valu16bits;
Cmpd2[m].dsetu16 = valu16bits;
- valu16bits = (uint16_t)(valu16bits << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
/* Array of 32 bits unsigned int */
- if((m % F76_DIM32) == 0)
- valu32bits = (uint32_t) ~0u; /* all 1s */
+ if ((m % F76_DIM32) == 0)
+ valu32bits = (uint32_t)~0u; /* all 1s */
Cmpd1[m].dsetu32 = valu32bits;
Cmpd2[m].dsetu32 = valu32bits;
valu32bits <<= 1;
/* Array of 64 bits unsigned int */
- if((m % F76_DIM64) == 0)
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ if ((m % F76_DIM64) == 0)
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
Cmpd1[m].dsetu64 = valu64bits;
Cmpd2[m].dsetu64 = valu64bits;
valu64bits <<= 1;
/* Array of 8 bits signed int */
- if((m % F76_DIM8) == 0)
- val8bits = (int8_t) ~0; /* all 1s */
+ if ((m % F76_DIM8) == 0)
+ val8bits = (int8_t)~0; /* all 1s */
Cmpd1[m].dset8 = val8bits;
Cmpd2[m].dset8 = val8bits;
- val8bits = (int8_t)(val8bits << 1);
+ val8bits = (int8_t)(val8bits << 1);
/* Array of 16 bits signed int */
- if((m % F76_DIM16) == 0)
- val16bits = (int16_t) ~0; /* all 1s */
+ if ((m % F76_DIM16) == 0)
+ val16bits = (int16_t)~0; /* all 1s */
Cmpd1[m].dset16 = val16bits;
Cmpd2[m].dset16 = val16bits;
- val16bits = (int16_t)(val16bits << 1);
+ val16bits = (int16_t)(val16bits << 1);
/* Array of 32 bits signed int */
- if((m % F76_DIM32) == 0)
- val32bits = (int32_t) ~0; /* all 1s */
+ if ((m % F76_DIM32) == 0)
+ val32bits = (int32_t)~0; /* all 1s */
Cmpd1[m].dset32 = val32bits;
Cmpd2[m].dset32 = val32bits;
val32bits <<= 1;
/* Array of 64 bits signed int */
- if((m % F76_DIM64) == 0)
- val64bits = (int64_t) ~0L; /* all 1s */
+ if ((m % F76_DIM64) == 0)
+ val64bits = (int64_t)~0L; /* all 1s */
Cmpd1[m].dset64 = val64bits;
Cmpd2[m].dset64 = val64bits;
val64bits <<= 1;
@@ -9149,32 +9175,33 @@ static void gent_compound_ints(void) {
static void
gent_intattrscalars(void)
{
- hid_t fid, attr, dataset, space, tid;
- hsize_t dims[2];
- uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
- uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
- uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
- uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
- int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
- int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
- int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
- int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
- double dsetdbl[F73_XDIM][F73_YDIM8];
+ hid_t fid, attr, dataset, space, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
unsigned int i, j;
fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -9188,16 +9215,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -9211,16 +9239,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -9234,16 +9263,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -9257,16 +9287,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -9280,16 +9311,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -9303,16 +9335,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -9326,16 +9359,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -9349,13 +9383,14 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -9381,33 +9416,34 @@ gent_intattrscalars(void)
static void
gent_intsattrs(void)
{
- hid_t fid, attr, dataset, space, aspace;
- hsize_t dims[2], adims[1];
- uint8_t dsetu8[F66_XDIM][F66_YDIM8], asetu8[F66_XDIM*F66_YDIM8], valu8bits;
- uint16_t dsetu16[F66_XDIM][F66_YDIM16], asetu16[F66_XDIM*F66_YDIM16], valu16bits;
- uint32_t dsetu32[F66_XDIM][F66_YDIM32], asetu32[F66_XDIM*F66_YDIM32], valu32bits;
- uint64_t dsetu64[F66_XDIM][F66_YDIM64], asetu64[F66_XDIM*F66_YDIM64], valu64bits;
- int8_t dset8[F66_XDIM][F66_YDIM8], aset8[F66_XDIM*F66_YDIM8], val8bits;
- int16_t dset16[F66_XDIM][F66_YDIM16], aset16[F66_XDIM*F66_YDIM16], val16bits;
- int32_t dset32[F66_XDIM][F66_YDIM32], aset32[F66_XDIM*F66_YDIM32], val32bits;
- int64_t dset64[F66_XDIM][F66_YDIM64], aset64[F66_XDIM*F66_YDIM64], val64bits;
- double dsetdbl[F66_XDIM][F66_YDIM8], asetdbl[F66_XDIM*F66_YDIM8];
+ hid_t fid, attr, dataset, space, aspace;
+ hsize_t dims[2], adims[1];
+ uint8_t dsetu8[F66_XDIM][F66_YDIM8], asetu8[F66_XDIM * F66_YDIM8], valu8bits;
+ uint16_t dsetu16[F66_XDIM][F66_YDIM16], asetu16[F66_XDIM * F66_YDIM16], valu16bits;
+ uint32_t dsetu32[F66_XDIM][F66_YDIM32], asetu32[F66_XDIM * F66_YDIM32], valu32bits;
+ uint64_t dsetu64[F66_XDIM][F66_YDIM64], asetu64[F66_XDIM * F66_YDIM64], valu64bits;
+ int8_t dset8[F66_XDIM][F66_YDIM8], aset8[F66_XDIM * F66_YDIM8], val8bits;
+ int16_t dset16[F66_XDIM][F66_YDIM16], aset16[F66_XDIM * F66_YDIM16], val16bits;
+ int32_t dset32[F66_XDIM][F66_YDIM32], aset32[F66_XDIM * F66_YDIM32], val32bits;
+ int64_t dset64[F66_XDIM][F66_YDIM64], aset64[F66_XDIM * F66_YDIM64], val64bits;
+ double dsetdbl[F66_XDIM][F66_YDIM8], asetdbl[F66_XDIM * F66_YDIM8];
unsigned int i, j;
fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu8[i][0] = valu8bits;
- asetu8[i*dims[1]] = dsetu8[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
- asetu8[i*dims[1]+j] = dsetu8[i][j];
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu8[i][0] = valu8bits;
+ asetu8[i * dims[1]] = dsetu8[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
+ asetu8[i * dims[1] + j] = dsetu8[i][j];
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -9415,8 +9451,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
/* Attribute of 8 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM8;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU08, H5T_STD_U8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU08, H5T_STD_U8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT8, asetu8);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9424,17 +9460,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu16[i][0] = valu16bits;
- asetu16[i*dims[1]] = dsetu16[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
- asetu16[i*dims[1]+j] = dsetu16[i][j];
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu16[i][0] = valu16bits;
+ asetu16[i * dims[1]] = dsetu16[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
+ asetu16[i * dims[1] + j] = dsetu16[i][j];
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -9442,8 +9479,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
/* Attribute of 16 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM16;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU16, H5T_STD_U16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU16, H5T_STD_U16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT16, asetu16);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9451,17 +9488,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu32[i][0] = valu32bits;
- asetu32[i*dims[1]] = dsetu32[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
- asetu32[i*dims[1]+j] = dsetu32[i][j];
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu32[i][0] = valu32bits;
+ asetu32[i * dims[1]] = dsetu32[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
+ asetu32[i * dims[1] + j] = dsetu32[i][j];
}
valu32bits <<= 1;
}
@@ -9469,8 +9507,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
/* Attribute of 32 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM32;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU32, H5T_STD_U32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU32, H5T_STD_U32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT32, asetu32);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9478,17 +9516,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu64[i][0] = valu64bits;
- asetu64[i*dims[1]] = dsetu64[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
- asetu64[i*dims[1]+j] = dsetu64[i][j];
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu64[i][0] = valu64bits;
+ asetu64[i * dims[1]] = dsetu64[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
+ asetu64[i * dims[1] + j] = dsetu64[i][j];
}
valu64bits <<= 1;
}
@@ -9496,8 +9535,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
/* Attribute of 64 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM64;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU64, H5T_STD_U64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU64, H5T_STD_U64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT64, asetu64);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9505,17 +9544,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset8[i][0] = val8bits;
- aset8[i*dims[1]] = dset8[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
- aset8[i*dims[1]+j] = dset8[i][j];
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset8[i][0] = val8bits;
+ aset8[i * dims[1]] = dset8[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
+ aset8[i * dims[1] + j] = dset8[i][j];
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -9523,8 +9563,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
/* Attribute of 8 bits signed int */
adims[0] = F66_XDIM * F66_YDIM8;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS08, H5T_STD_I8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS08, H5T_STD_I8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT8, aset8);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9532,17 +9572,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset16[i][0] = val16bits;
- aset16[i*dims[1]] = dset16[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
- aset16[i*dims[1]+j] = dset16[i][j];
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset16[i][0] = val16bits;
+ aset16[i * dims[1]] = dset16[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
+ aset16[i * dims[1] + j] = dset16[i][j];
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -9550,8 +9591,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
/* Attribute of 16 bits signed int */
adims[0] = F66_XDIM * F66_YDIM16;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS16, H5T_STD_I16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS16, H5T_STD_I16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT16, aset16);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9559,17 +9600,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset32[i][0] = val32bits;
- aset32[i*dims[1]] = dset32[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
- aset32[i*dims[1]+j] = dset32[i][j];
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset32[i][0] = val32bits;
+ aset32[i * dims[1]] = dset32[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
+ aset32[i * dims[1] + j] = dset32[i][j];
}
val32bits <<= 1;
}
@@ -9577,8 +9619,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
/* Attribute of 32 bits signed int */
adims[0] = F66_XDIM * F66_YDIM32;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS32, H5T_STD_I32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS32, H5T_STD_I32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT32, aset32);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9586,17 +9628,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset64[i][0] = val64bits;
- aset64[i*dims[1]] = dset64[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
- aset64[i*dims[1]+j] = dset64[i][j];
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset64[i][0] = val64bits;
+ aset64[i * dims[1]] = dset64[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
+ aset64[i * dims[1] + j] = dset64[i][j];
}
val64bits <<= 1;
}
@@ -9604,8 +9647,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
/* Attribute of 64 bits signed int */
adims[0] = F66_XDIM * F66_YDIM64;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS64, H5T_STD_I64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS64, H5T_STD_I64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT64, aset64);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9613,21 +9656,22 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++) {
- dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
- asetdbl[i*dims[1]+j] = dsetdbl[i][j];
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++) {
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+ asetdbl[i * dims[1] + j] = dsetdbl[i][j];
}
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
/* Attribute of double */
adims[0] = F66_XDIM * F66_YDIM8;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DUMMYDBL, H5T_IEEE_F64BE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DUMMYDBL, H5T_IEEE_F64BE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_DOUBLE, asetdbl);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9636,25 +9680,26 @@ gent_intsattrs(void)
H5Fclose(fid);
}
-static void gent_bitnopaquefields(void)
+static void
+gent_bitnopaquefields(void)
{
/* Compound datatype */
- typedef struct s_t
- {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
+ typedef struct s_t {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
} s_t;
- hid_t file_id=H5I_INVALID_HID, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
- size_t i;
+ hid_t file_id = H5I_INVALID_HID, grp = H5I_INVALID_HID, type = H5I_INVALID_HID, space = H5I_INVALID_HID,
+ dset = H5I_INVALID_HID;
+ size_t i;
hsize_t nelmts = F80_DIM32;
- uint8_t buf[F80_DIM32]; /* bitfield, opaque */
- uint16_t buf2[F80_DIM32]; /* bitfield, opaque */
- uint32_t buf3[F80_DIM32]; /* bitfield, opaque */
- uint64_t buf4[F80_DIM32]; /* bitfield, opaque */
- s_t buf5[F80_DIM32]; /* compound */
+ uint8_t buf[F80_DIM32]; /* bitfield, opaque */
+ uint16_t buf2[F80_DIM32]; /* bitfield, opaque */
+ uint32_t buf3[F80_DIM32]; /* bitfield, opaque */
+ uint64_t buf4[F80_DIM32]; /* bitfield, opaque */
+ s_t buf5[F80_DIM32]; /* compound */
file_id = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -9662,7 +9707,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_1 */
if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf[i] = (uint8_t)(0xff ^ i);
}
@@ -9677,7 +9723,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_2 */
if ((type = H5Tcopy(H5T_STD_B16LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf2[i] = (uint16_t)(0xffff ^ (i * 16));
}
@@ -9692,7 +9739,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_3 */
if ((type = H5Tcopy(H5T_STD_B32LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf3[i] = (uint32_t)0xffffffff ^ (uint32_t)(i * 32);
}
@@ -9707,7 +9755,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_4 */
if ((type = H5Tcopy(H5T_STD_B64LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf4[i] = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64);
}
@@ -9727,8 +9776,9 @@ static void gent_bitnopaquefields(void)
if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) {
if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++)
+ if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++)
H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t);
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
H5Dclose(dset);
@@ -9743,8 +9793,9 @@ static void gent_bitnopaquefields(void)
if ((type = H5Tcreate(H5T_OPAQUE, 2)) >= 0) {
if ((H5Tset_tag(type, "2-byte opaque type")) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++)
+ if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++)
H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t);
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
@@ -9766,8 +9817,9 @@ static void gent_bitnopaquefields(void)
H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
+ if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
H5_CHECKED_ASSIGN(buf5[i].a, uint8_t, 0xff ^ i, size_t);
H5_CHECKED_ASSIGN(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t);
buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32);
@@ -9797,23 +9849,27 @@ static void gent_bitnopaquefields(void)
static void
gent_intsfourdims(void)
{
- hid_t fid, dataset, space;
- hsize_t dims[F81_RANK];
- uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
+ hid_t fid, dataset, space;
+ hsize_t dims[F81_RANK];
+ uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
unsigned int i, j, k, l;
fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 32 bits unsigned int */
- dims[0] = F81_ZDIM; dims[1] = F81_YDIM; dims[2] = F81_XDIM; dims[3] = F81_WDIM;
- space = H5Screate_simple(F81_RANK, dims, NULL);
+ dims[0] = F81_ZDIM;
+ dims[1] = F81_YDIM;
+ dims[2] = F81_XDIM;
+ dims[3] = F81_WDIM;
+ space = H5Screate_simple(F81_RANK, dims, NULL);
dataset = H5Dcreate2(fid, F81_DATASETNAME, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < F81_ZDIM; i++)
- for(j = 0; j < F81_YDIM; j++)
- for(k = 0; k < F81_XDIM; k++)
- for(l = 0; l < F81_WDIM; l++)
- dset1[i][j][k][l] = i*F81_YDIM*F81_XDIM*F81_WDIM + j*F81_XDIM*F81_WDIM + k*F81_WDIM + l;
+ for (i = 0; i < F81_ZDIM; i++)
+ for (j = 0; j < F81_YDIM; j++)
+ for (k = 0; k < F81_XDIM; k++)
+ for (l = 0; l < F81_WDIM; l++)
+ dset1[i][j][k][l] =
+ i * F81_YDIM * F81_XDIM * F81_WDIM + j * F81_XDIM * F81_WDIM + k * F81_WDIM + l;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
H5Sclose(space);
@@ -9829,7 +9885,8 @@ gent_intsfourdims(void)
* various sizes, dimensions, member types and nesting.
*-------------------------------------------------------------------------
*/
-static void gent_compound_complex2(void)
+static void
+gent_compound_complex2(void)
{
/* Third-level nested compound */
typedef struct {
@@ -9849,45 +9906,42 @@ static void gent_compound_complex2(void)
} further_nested;
typedef struct {
- char further_nested_string[11];
- char further_nested_string_array[4][13];
+ char further_nested_string[11];
+ char further_nested_string_array[4][13];
third_level_compound deep_nest;
} further_nested2;
/* First First-level nested compound */
- typedef struct
- {
+ typedef struct {
double nested_a;
char nested_string[23];
char nested_string_array[4][12];
} nested_compound;
/* Second First-level nested compound */
- typedef struct
- {
+ typedef struct {
float a;
further_nested b;
further_nested2 c;
} multiple_nested_compound;
/* Compound datatype with different member types */
- typedef struct
- {
+ typedef struct {
/* Arrays nested inside compound */
unsigned int a[4];
int b[6];
float c[2][4];
- nested_compound d; /* Compound inside compound */
- multiple_nested_compound e; /* Compound inside compound with further nested compound */
+ nested_compound d; /* Compound inside compound */
+ multiple_nested_compound e; /* Compound inside compound with further nested compound */
} compound;
- compound buf[F82_DIM32]; /* compound */
+ compound buf[F82_DIM32]; /* compound */
- hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
- hid_t dset_array_a, dset_array_b, dset_array_c;
- hid_t cmpd_tid1 = H5I_INVALID_HID, cmpd_tid2 = H5I_INVALID_HID, cmpd_tid3 = H5I_INVALID_HID;
- size_t i;
- size_t j, k;
+ hid_t file, type = H5I_INVALID_HID, space = H5I_INVALID_HID, dset = H5I_INVALID_HID;
+ hid_t dset_array_a, dset_array_b, dset_array_c;
+ hid_t cmpd_tid1 = H5I_INVALID_HID, cmpd_tid2 = H5I_INVALID_HID, cmpd_tid3 = H5I_INVALID_HID;
+ size_t i;
+ size_t j, k;
unsigned dset_array_ndims;
hsize_t dset_array_a_dims[1], dset_array_b_dims[1], dset_array_c_dims[2];
hsize_t nelmts = F82_DIM32;
@@ -9897,23 +9951,27 @@ static void gent_compound_complex2(void)
if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) {
/* CompoundComplex1D */
if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
- hid_t str_type, array;
+ hid_t str_type, array;
hsize_t dims[1];
- hid_t nest1, nest2;
+ hid_t nest1, nest2;
/* Insert top-level array members */
- dset_array_ndims = 1; dset_array_a_dims[0] = 4;
- dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
+ dset_array_ndims = 1;
+ dset_array_a_dims[0] = 4;
+ dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
H5Tinsert(type, "a", HOFFSET(compound, a), dset_array_a);
H5Tclose(dset_array_a);
- dset_array_ndims = 1; dset_array_b_dims[0] = 6;
- dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
+ dset_array_ndims = 1;
+ dset_array_b_dims[0] = 6;
+ dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
H5Tinsert(type, "b", HOFFSET(compound, b), dset_array_b);
H5Tclose(dset_array_b);
- dset_array_ndims = 2; dset_array_c_dims[0] = 2; dset_array_c_dims[1] = 4;
- dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
+ dset_array_ndims = 2;
+ dset_array_c_dims[0] = 2;
+ dset_array_c_dims[1] = 4;
+ dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
H5Tinsert(type, "c", HOFFSET(compound, c), dset_array_c);
H5Tclose(dset_array_c);
@@ -9922,16 +9980,16 @@ static void gent_compound_complex2(void)
H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE);
- dims[0] = 1;
+ dims[0] = 1;
str_type = mkstr(23, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
+ array = H5Tarray_create2(str_type, 1, dims);
H5Tinsert(cmpd_tid1, "nested_string", HOFFSET(nested_compound, nested_string), array);
H5Tclose(array);
H5Tclose(str_type);
- dims[0] = 4;
+ dims[0] = 4;
str_type = mkstr(12, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
+ array = H5Tarray_create2(str_type, 1, dims);
H5Tinsert(cmpd_tid1, "nested_string_array", HOFFSET(nested_compound, nested_string_array), array);
H5Tclose(array);
H5Tclose(str_type);
@@ -9947,7 +10005,7 @@ static void gent_compound_complex2(void)
nest1 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested));
dims[0] = 5;
- array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
+ array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
H5Tinsert(nest1, "nested_unsigned_int", HOFFSET(further_nested, multiple_nested_a), array);
H5Tclose(array);
@@ -9969,17 +10027,18 @@ static void gent_compound_complex2(void)
/* Add second further nested compound */
nest2 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested2));
- dims[0] = 1;
+ dims[0] = 1;
str_type = mkstr(11, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
+ array = H5Tarray_create2(str_type, 1, dims);
H5Tinsert(nest2, "nested_string", HOFFSET(further_nested2, further_nested_string), array);
H5Tclose(array);
H5Tclose(str_type);
- dims[0] = 4;
+ dims[0] = 4;
str_type = mkstr(13, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
- H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array), array);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array),
+ array);
H5Tclose(array);
H5Tclose(str_type);
@@ -9987,8 +10046,9 @@ static void gent_compound_complex2(void)
cmpd_tid3 = H5Tcreate(H5T_COMPOUND, sizeof(third_level_compound));
dims[0] = 10;
- array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
- H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short), array);
+ array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short),
+ array);
H5Tclose(array);
array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
@@ -10000,11 +10060,13 @@ static void gent_compound_complex2(void)
H5Tclose(array);
array = H5Tarray_create2(H5T_IEEE_F64LE, 1, dims);
- H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double), array);
+ H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double),
+ array);
H5Tclose(array);
array = H5Tarray_create2(H5T_IEEE_F32LE, 1, dims);
- H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float), array);
+ H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float),
+ array);
H5Tclose(array);
H5Tinsert(nest2, "deep_nested_compound", HOFFSET(further_nested2, deep_nest), cmpd_tid3);
@@ -10014,19 +10076,19 @@ static void gent_compound_complex2(void)
H5Tinsert(type, "multiple_nested_compound", HOFFSET(compound, e), cmpd_tid2);
-
- if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
+ if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
for (j = 0; j < dset_array_a_dims[0]; j++)
- buf[i].a[j] = (unsigned int)(j + i*10);
+ buf[i].a[j] = (unsigned int)(j + i * 10);
for (j = 0; j < dset_array_b_dims[0]; j++)
- buf[i].b[j] = (int)(j - i*10);
+ buf[i].b[j] = (int)(j - i * 10);
for (j = 0; j < dset_array_c_dims[0]; j++)
for (k = 0; k < dset_array_c_dims[1]; k++)
- buf[i].c[j][k] = (float)(j + k + i*10) + (float)(j) * 0.1F;
+ buf[i].c[j][k] = (float)(j + k + i * 10) + (float)(j)*0.1F;
/* Set up first nested compound */
- buf[i].d.nested_a = (double) i;
+ buf[i].d.nested_a = (double)i;
HDstrcpy(buf[i].d.nested_string, "This is a test string.");
@@ -10034,13 +10096,13 @@ static void gent_compound_complex2(void)
HDstrcpy(buf[i].d.nested_string_array[j], "String test");
/* Set up multiple nested compound */
- buf[i].e.a = (float) i;
+ buf[i].e.a = (float)i;
for (j = 0; j < 5; j++) {
- buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i*10);
- buf[i].e.b.multiple_nested_b[j] = (int)(j - i*10);
- buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i*10);
- buf[i].e.b.multiple_nested_d[j] = (long)(j - i*10);
+ buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i * 10);
+ buf[i].e.b.multiple_nested_b[j] = (int)(j - i * 10);
+ buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i * 10);
+ buf[i].e.b.multiple_nested_d[j] = (long)(j - i * 10);
}
HDstrcpy(buf[i].e.c.further_nested_string, "1234567890");
@@ -10048,11 +10110,11 @@ static void gent_compound_complex2(void)
HDstrcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY");
for (j = 0; j < 10; j++) {
- buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i*10);
- buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i*10);
- buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i*10);
- buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i*10);
- buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i * 10);
+ buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i * 10);
+ buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i * 10);
+ buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i * 10);
+ buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i * 10);
}
}
@@ -10070,74 +10132,71 @@ static void gent_compound_complex2(void)
}
/* CompoundComplex2D */
-/* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
- H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
- H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
- H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
- H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
- if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
- buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
- buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
- buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
- buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
- }
+ /* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
- H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
- H5Dclose(dset);
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
}
- H5Sclose(space);
+ H5Tclose(type);
}
- H5Tclose(type);
- }
-*/
+ */
/* CompoundComplex3D */
-/* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
- H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
- H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
- H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
- H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
- if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
- buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
- buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
- buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
- buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
- }
+ /* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
- H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
- H5Dclose(dset);
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
}
- H5Sclose(space);
+ H5Tclose(type);
}
- H5Tclose(type);
- }
-*/
+ */
/* CompoundComplex4D */
-/* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
- H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
- H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
- H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
- H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
- if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
- buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
- buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
- buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
- buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
- }
+ /* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
- H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
- H5Dclose(dset);
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
}
- H5Sclose(space);
+ H5Tclose(type);
}
- H5Tclose(type);
- }
-*/
+ */
H5Fclose(file);
}
@@ -10148,32 +10207,30 @@ static void gent_compound_complex2(void)
* length strings.
*-------------------------------------------------------------------------
*/
-static void gent_vlenstr_array(void)
+static void
+gent_vlenstr_array(void)
{
/* Compound datatype with different member types */
- typedef struct compound
- {
+ typedef struct compound {
/* Array of variable-length strings*/
const char *vlen_array[F83_ARRAYDIM];
} compound;
- compound buf[F83_DIM];
+ compound buf[F83_DIM];
const char *test[F83_ARRAYDIM] = {
- "This is a variable-length test string.",
- "This test string is also variable-length.",
- "A final test of variable-length strings. This string is longer than the others."
- };
- const char *buffer[F83_DIM*F83_ARRAYDIM];
+ "This is a variable-length test string.", "This test string is also variable-length.",
+ "A final test of variable-length strings. This string is longer than the others."};
+ const char *buffer[F83_DIM * F83_ARRAYDIM];
- hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
+ hid_t file, type = H5I_INVALID_HID, space = H5I_INVALID_HID, dset = H5I_INVALID_HID;
hid_t cmpd_tid1, array_tid;
- int i, j;
+ int i, j;
hsize_t dims[] = {F83_DIM}, arraydim[] = {F83_ARRAYDIM};
/* Initialize scalar data */
for (i = 0; i < F83_DIM; i++)
for (j = 0; j < 3; j++)
- buffer[j + 3*i] = test[j];
+ buffer[j + 3 * i] = test[j];
/* Initialize compound data */
for (i = 0; i < F83_DIM; i++)
@@ -10188,7 +10245,8 @@ static void gent_vlenstr_array(void)
/* ScalarArrayOfVlenStr */
if ((type = H5Tarray_create2(array_tid, F83_RANK, arraydim)) >= 0) {
- if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
@@ -10209,7 +10267,8 @@ static void gent_vlenstr_array(void)
array_tid = H5Tarray_create2(cmpd_tid1, F83_RANK, arraydim);
H5Tinsert(type, "vlen_str_array", HOFFSET(compound, vlen_array), array_tid);
- if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
@@ -10230,33 +10289,34 @@ static void gent_vlenstr_array(void)
* Purpose: Generate a file to be used in testing user defined filter plugin3.
*-------------------------------------------------------------------------
*/
-static void gent_udfilter(void)
+static void
+gent_udfilter(void)
{
- hid_t fid; /* file id */
- hid_t dcpl; /* dataset creation property list */
- hid_t dsid; /* dataset ID */
- hid_t sid; /* dataspace ID */
-
- hsize_t dims1[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf1[DIM1][DIM2];
- int i, j, n, ret;
-
- for(i=n=0; i<DIM1; i++){
- for(j=0; j<DIM2; j++){
- buf1[i][j]=n++;
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t dsid; /* dataset ID */
+ hid_t sid; /* dataspace ID */
+
+ hsize_t dims1[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int buf1[DIM1][DIM2];
+ int i, j, n, ret;
+
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf1[i][j] = n++;
}
}
/* create a file */
- fid = H5Fcreate(FILE84, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE84, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/* create a space */
sid = H5Screate_simple(SPACE2_RANK, dims1, NULL);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- HDassert(dcpl>=0);
+ HDassert(dcpl >= 0);
ret = H5Pset_layout(dcpl, H5D_CHUNKED);
HDassert(ret >= 0);
@@ -10264,10 +10324,10 @@ static void gent_udfilter(void)
ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
HDassert(ret >= 0);
- ret = H5Zregister (H5Z_DYNLIBUD);
+ ret = H5Zregister(H5Z_DYNLIBUD);
HDassert(ret >= 0);
- ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL);
+ ret = H5Pset_filter(dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL);
HDassert(ret >= 0);
/* create the dataset */
@@ -10314,38 +10374,37 @@ static void gent_udfilter(void)
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
@@ -10362,13 +10421,14 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
* Purpose: generates dataset and attribute of null dataspace in a group
*-------------------------------------------------------------------------
*/
-static void gent_null_space_group(void)
+static void
+gent_null_space_group(void)
{
hid_t fid, root, group, dataset, space, attr;
- int dset_buf = 10;
- int point = 4;
+ int dset_buf = 10;
+ int point = 4;
- fid = H5Fcreate(FILE85, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE85, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -10393,7 +10453,8 @@ static void gent_null_space_group(void)
H5Fclose(fid);
}
-int main(void)
+int
+main(void)
{
gent_group();
gent_attribute();
@@ -10487,4 +10548,3 @@ int main(void)
return 0;
}
-