summaryrefslogtreecommitdiffstats
path: root/HDF5Examples/C/H5T
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-11-27 21:30:15 (GMT)
committerGitHub <noreply@github.com>2023-11-27 21:30:15 (GMT)
commitfc88fcde1091cf12c1e88c783a14ee0f1cffe31c (patch)
tree91b88b62cd30ed37ee9227e43989e95035be43c3 /HDF5Examples/C/H5T
parenta067bf71f57723d2dfca7dfe2ffd9ea502eccd4f (diff)
downloadhdf5-fc88fcde1091cf12c1e88c783a14ee0f1cffe31c.zip
hdf5-fc88fcde1091cf12c1e88c783a14ee0f1cffe31c.tar.gz
hdf5-fc88fcde1091cf12c1e88c783a14ee0f1cffe31c.tar.bz2
Develop merge examples (#3851)
* Merge examples repo into library * Change grepTest to be more fault-tolerant * Update examples macro file * Exclude all Fortran examples from doxygen
Diffstat (limited to 'HDF5Examples/C/H5T')
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_array.c166
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_arrayatt.c177
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_bit.c137
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_bitatt.c148
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_cmpd.c161
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_cmpdatt.c172
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_commit.c114
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_convert.c145
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_cpxcmpd.c319
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_cpxcmpdatt.c331
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_enum.c164
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_enumatt.c175
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_float.c130
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_floatatt.c142
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_int.c129
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_intatt.c140
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_objref.c158
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_objrefatt.c175
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_opaque.c142
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_opaqueatt.c153
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_regref.c170
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_regrefatt.c182
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_string.c144
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_stringatt.c155
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_vlen.c145
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_vlenatt.c156
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_vlstring.c126
-rw-r--r--HDF5Examples/C/H5T/16/h5ex_t_vlstringatt.c138
-rw-r--r--HDF5Examples/C/H5T/CMakeLists.txt371
-rw-r--r--HDF5Examples/C/H5T/C_sourcefiles.cmake33
-rw-r--r--HDF5Examples/C/H5T/Makefile.am48
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_array.c170
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_arrayatt.c182
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_bit.c136
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_bitatt.c147
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_cmpd.c160
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_cmpdatt.c171
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_commit.c116
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_convert.c143
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c319
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c331
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_enum.c163
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_enumatt.c174
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_float.c129
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_floatatt.c141
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_int.c128
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_intatt.c139
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_objref.c203
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_objrefatt.c216
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_opaque.c135
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_opaqueatt.c146
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_regref.c243
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_regrefatt.c263
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_string.c144
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_stringatt.c155
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_vlen.c144
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_vlenatt.c155
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_vlstring.c126
-rw-r--r--HDF5Examples/C/H5T/h5ex_t_vlstringatt.c138
-rwxr-xr-xHDF5Examples/C/H5T/test.sh.in203
-rw-r--r--HDF5Examples/C/H5T/tfiles/110/h5ex_t_objref06.ddl19
-rw-r--r--HDF5Examples/C/H5T/tfiles/110/h5ex_t_objrefatt06.ddl25
-rw-r--r--HDF5Examples/C/H5T/tfiles/110/h5ex_t_regref06.ddl24
-rw-r--r--HDF5Examples/C/H5T/tfiles/110/h5ex_t_regrefatt06.ddl31
-rw-r--r--HDF5Examples/C/H5T/tfiles/112/h5ex_t_objref.ddl22
-rw-r--r--HDF5Examples/C/H5T/tfiles/112/h5ex_t_objrefatt.ddl28
-rw-r--r--HDF5Examples/C/H5T/tfiles/112/h5ex_t_regref.ddl33
-rw-r--r--HDF5Examples/C/H5T/tfiles/112/h5ex_t_regrefatt.ddl39
-rw-r--r--HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlen.ddl11
-rw-r--r--HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlenatt.ddl17
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objref.ddl24
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objrefatt.ddl31
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regref.ddl33
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regrefatt.ddl40
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.ddl22
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.tst20
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.ddl29
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.tst20
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.ddl21
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.ddl44
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.tst24
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.ddl51
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.tst24
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.ddl15
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.tst6
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_convert.tst24
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.ddl9
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.tst13
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.ddl9
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.tst13
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.ddl20
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.ddl27
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.ddl21
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.ddl21
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.ddl26
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.ddl33
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.ddl21
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.tst5
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.ddl33
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.ddl40
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.ddl16
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.ddl23
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.ddl11
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.ddl18
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.ddl16
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.ddl23
-rw-r--r--HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.tst4
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objref.ddl22
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objrefatt.ddl28
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regref.ddl33
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regrefatt.ddl39
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_array.ddl22
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_arrayatt.ddl28
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_bit.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_bitatt.ddl20
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpd.ddl44
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpdatt.ddl50
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_commit.ddl15
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpd.ddl9
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpdatt.ddl9
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_enum.ddl20
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_enumatt.ddl26
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_float.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_floatatt.ddl20
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_int.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_intatt.ddl20
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref.ddl24
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref21.ddl19
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt.ddl30
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt21.ddl25
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaque.ddl14
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaqueatt.ddl20
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref.ddl33
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref21.ddl24
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt.ddl39
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt21.ddl31
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_string.ddl16
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_stringatt.ddl22
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlen.ddl11
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlenatt.ddl17
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstring.ddl16
-rw-r--r--HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstringatt.ddl22
164 files changed, 12092 insertions, 0 deletions
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_array.c b/HDF5Examples/C/H5T/16/h5ex_t_array.c
new file mode 100644
index 0000000..0537352
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_array.c
@@ -0,0 +1,166 @@
+/************************************************************
+
+ This example shows how to read and write array datatypes
+ to a dataset. The program first writes integers arrays of
+ dimension ADIM0xADIM1 to a dataset with a dataspace of
+ DIM0, then closes the file. Next, it reopens the file,
+ reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_array.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define ADIM0 3
+#define ADIM1 5
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, adims[2] = {ADIM0, ADIM1};
+ int wdata[DIM0][ADIM0][ADIM1], /* Write buffer */
+ ***rdata, /* Read buffer */
+ ndims, i, j, k;
+
+ /*
+ * Initialize data. i is the element in the dataspace, j and k the
+ * elements within the array datatype.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < ADIM0; j++)
+ for (k = 0; k < ADIM1; k++)
+ wdata[i][j][k] = i * j - j * k + i * k;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create array datatypes for file and memory.
+ */
+ filetype = H5Tarray_create(H5T_STD_I64LE, 2, adims, NULL);
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims, NULL);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the array data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0][0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset and array have the same name and rank, but can have
+ * any size. Therefore we must allocate a new array to read in
+ * data using malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get the datatype and its dimensions.
+ */
+ filetype = H5Dget_type(dset);
+ ndims = H5Tget_array_dims(filetype, adims, NULL);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * three dimensional dataset when the array datatype is included so
+ * the dynamic allocation must be done in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to two-dimensional arrays (the
+ * elements of the dataset.
+ */
+ rdata = (int ***)malloc(dims[0] * sizeof(int **));
+
+ /*
+ * Allocate two dimensional array of pointers to rows in the data
+ * elements.
+ */
+ rdata[0] = (int **)malloc(dims[0] * adims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0][0] = (int *)malloc(dims[0] * adims[0] * adims[1] * sizeof(int));
+
+ /*
+ * Set the members of the pointer arrays allocated above to point
+ * to the correct locations in their respective arrays.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ rdata[i] = rdata[0] + i * adims[0];
+ for (j = 0; j < adims[0]; j++)
+ rdata[i][j] = rdata[0][0] + (adims[0] * adims[1] * i) + (adims[1] * j);
+ }
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims, NULL);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0][0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n", DATASET, i);
+ for (j = 0; j < adims[0]; j++) {
+ printf(" [");
+ for (k = 0; k < adims[1]; k++)
+ printf(" %3d", rdata[i][j][k]);
+ printf("]\n");
+ }
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0][0]);
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_arrayatt.c b/HDF5Examples/C/H5T/16/h5ex_t_arrayatt.c
new file mode 100644
index 0000000..0750cc2
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_arrayatt.c
@@ -0,0 +1,177 @@
+/************************************************************
+
+ This example shows how to read and write array datatypes
+ to an attribute. The program first writes integers arrays
+ of dimension ADIM0xADIM1 to an attribute with a dataspace
+ of DIM0, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_arrayatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define ADIM0 3
+#define ADIM1 5
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, adims[2] = {ADIM0, ADIM1};
+ int wdata[DIM0][ADIM0][ADIM1], /* Write buffer */
+ ***rdata, /* Read buffer */
+ ndims, i, j, k;
+
+ /*
+ * Initialize data. i is the element in the dataspace, j and k the
+ * elements within the array datatype.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < ADIM0; j++)
+ for (k = 0; k < ADIM1; k++)
+ wdata[i][j][k] = i * j - j * k + i * k;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create array datatypes for file and memory.
+ */
+ filetype = H5Tarray_create(H5T_STD_I64LE, 2, adims, NULL);
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims, NULL);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the array data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata[0][0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute and array have the same name and rank, but can
+ * have any size. Therefore we must allocate a new array to read
+ * in data using malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get the datatype and its dimensions.
+ */
+ filetype = H5Aget_type(attr);
+ ndims = H5Tget_array_dims(filetype, adims, NULL);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * three dimensional attribute when the array datatype is included
+ * so the dynamic allocation must be done in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to two-dimensional arrays (the
+ * elements of the attribute.
+ */
+ rdata = (int ***)malloc(dims[0] * sizeof(int **));
+
+ /*
+ * Allocate two dimensional array of pointers to rows in the data
+ * elements.
+ */
+ rdata[0] = (int **)malloc(dims[0] * adims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0][0] = (int *)malloc(dims[0] * adims[0] * adims[1] * sizeof(int));
+
+ /*
+ * Set the members of the pointer arrays allocated above to point
+ * to the correct locations in their respective arrays.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ rdata[i] = rdata[0] + i * adims[0];
+ for (j = 0; j < adims[0]; j++)
+ rdata[i][j] = rdata[0][0] + (adims[0] * adims[1] * i) + (adims[1] * j);
+ }
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims, NULL);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata[0][0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n", ATTRIBUTE, i);
+ for (j = 0; j < adims[0]; j++) {
+ printf(" [");
+ for (k = 0; k < adims[1]; k++)
+ printf(" %3d", rdata[i][j][k]);
+ printf("]\n");
+ }
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0][0]);
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_bit.c b/HDF5Examples/C/H5T/16/h5ex_t_bit.c
new file mode 100644
index 0000000..39f0566
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_bit.c
@@ -0,0 +1,137 @@
+/************************************************************
+
+ This example shows how to read and write bitfield
+ datatypes to a dataset. The program first writes bit
+ fields to a dataset with a dataspace of DIM0xDIM1, then
+ closes the file. Next, it reopens the file, reads back
+ the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_bit.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ unsigned char wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, A, B, C, D, i, j;
+
+ /*
+ * Initialize data. We will manually pack 4 2-bit integers into
+ * each unsigned char data element.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++) {
+ wdata[i][j] = 0;
+ wdata[i][j] |= (i * j - j) & 0x03; /* Field "A" */
+ wdata[i][j] |= (i & 0x03) << 2; /* Field "B" */
+ wdata[i][j] |= (j & 0x03) << 4; /* Field "C" */
+ wdata[i][j] |= ((i + j) & 0x03) << 6; /* Field "D" */
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the bitfield data to it.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_STD_B8BE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_B8, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (unsigned char **)malloc(dims[0] * sizeof(unsigned char *));
+
+ /*
+ * Allocate space for bitfield data.
+ */
+ rdata[0] = (unsigned char *)malloc(dims[0] * dims[1] * sizeof(unsigned char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_NATIVE_B8, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+ A = rdata[i][j] & 0x03; /* Retrieve field "A" */
+ B = (rdata[i][j] >> 2) & 0x03; /* Retrieve field "B" */
+ C = (rdata[i][j] >> 4) & 0x03; /* Retrieve field "C" */
+ D = (rdata[i][j] >> 6) & 0x03; /* Retrieve field "D" */
+ printf(" {%d, %d, %d, %d}", A, B, C, D);
+ }
+ printf(" ]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_bitatt.c b/HDF5Examples/C/H5T/16/h5ex_t_bitatt.c
new file mode 100644
index 0000000..be19a28
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_bitatt.c
@@ -0,0 +1,148 @@
+/************************************************************
+
+ This example shows how to read and write bitfield
+ datatypes to an attribute. The program first writes bit
+ fields to an attribute with a dataspace of DIM0xDIM1, then
+ closes the file. Next, it reopens the file, reads back
+ the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_bitatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ unsigned char wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, A, B, C, D, i, j;
+
+ /*
+ * Initialize data. We will manually pack 4 2-bit integers into
+ * each unsigned char data element.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++) {
+ wdata[i][j] = 0;
+ wdata[i][j] |= (i * j - j) & 0x03; /* Field "A" */
+ wdata[i][j] |= (i & 0x03) << 2; /* Field "B" */
+ wdata[i][j] |= (j & 0x03) << 4; /* Field "C" */
+ wdata[i][j] |= ((i + j) & 0x03) << 6; /* Field "D" */
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the bitfield data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_STD_B8BE, space, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_NATIVE_B8, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (unsigned char **)malloc(dims[0] * sizeof(unsigned char *));
+
+ /*
+ * Allocate space for bitfield data.
+ */
+ rdata[0] = (unsigned char *)malloc(dims[0] * dims[1] * sizeof(unsigned char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_NATIVE_B8, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+ A = rdata[i][j] & 0x03; /* Retrieve field "A" */
+ B = (rdata[i][j] >> 2) & 0x03; /* Retrieve field "B" */
+ C = (rdata[i][j] >> 4) & 0x03; /* Retrieve field "C" */
+ D = (rdata[i][j] >> 6) & 0x03; /* Retrieve field "D" */
+ printf(" {%d, %d, %d, %d}", A, B, C, D);
+ }
+ printf(" ]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_cmpd.c b/HDF5Examples/C/H5T/16/h5ex_t_cmpd.c
new file mode 100644
index 0000000..4870857
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_cmpd.c
@@ -0,0 +1,161 @@
+/************************************************************
+
+ This example shows how to read and write compound
+ datatypes to a dataset. The program first writes
+ compound structures to a dataset with a dataspace of DIM0,
+ then closes the file. Next, it reopens the file, reads
+ back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cmpd.h5"
+#define DATASET "DS1"
+#define DIM0 4
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Compound type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, strtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ sensor_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Initialize data.
+ */
+ wdata[0].serial_no = 1153;
+ wdata[0].location = "Exterior (static)";
+ wdata[0].temperature = 53.23;
+ wdata[0].pressure = 24.57;
+ wdata[1].serial_no = 1184;
+ wdata[1].location = "Intake";
+ wdata[1].temperature = 55.12;
+ wdata[1].pressure = 22.95;
+ wdata[2].serial_no = 1027;
+ wdata[2].location = "Intake manifold";
+ wdata[2].temperature = 103.55;
+ wdata[2].pressure = 31.23;
+ wdata[3].serial_no = 1313;
+ wdata[3].location = "Exhaust manifold";
+ wdata[3].temperature = 1252.89;
+ wdata[3].pressure = 84.11;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype for memory.
+ */
+ memtype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(memtype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(memtype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(memtype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(memtype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the compound datatype for the file. Because the standard
+ * types we are using for the file may have different sizes than
+ * the corresponding native types, we must manually calculate the
+ * offset of each member.
+ */
+ filetype = H5Tcreate(H5T_COMPOUND, 8 + sizeof(hvl_t) + 8 + 8);
+ status = H5Tinsert(filetype, "Serial number", 0, H5T_STD_I64BE);
+ status = H5Tinsert(filetype, "Location", 8, strtype);
+ status = H5Tinsert(filetype, "Temperature (F)", 8 + sizeof(hvl_t), H5T_IEEE_F64BE);
+ status = H5Tinsert(filetype, "Pressure (inHg)", 8 + sizeof(hvl_t) + 8, H5T_IEEE_F64BE);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the compound data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (sensor_t *)malloc(dims[0] * sizeof(sensor_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n", DATASET, i);
+ printf("Serial number : %d\n", rdata[i].serial_no);
+ printf("Location : %s\n", rdata[i].location);
+ printf("Temperature (F) : %f\n", rdata[i].temperature);
+ printf("Pressure (inHg) : %f\n\n", rdata[i].pressure);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (strings in this
+ * case).
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Tclose(strtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_cmpdatt.c b/HDF5Examples/C/H5T/16/h5ex_t_cmpdatt.c
new file mode 100644
index 0000000..c9f9b7e
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_cmpdatt.c
@@ -0,0 +1,172 @@
+/************************************************************
+
+ This example shows how to read and write compound
+ datatypes to an attribute. The program first writes
+ compound structures to an attribute with a dataspace of
+ DIM0, then closes the file. Next, it reopens the file,
+ reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cmpdatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Compound type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, strtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ sensor_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Initialize data.
+ */
+ wdata[0].serial_no = 1153;
+ wdata[0].location = "Exterior (static)";
+ wdata[0].temperature = 53.23;
+ wdata[0].pressure = 24.57;
+ wdata[1].serial_no = 1184;
+ wdata[1].location = "Intake";
+ wdata[1].temperature = 55.12;
+ wdata[1].pressure = 22.95;
+ wdata[2].serial_no = 1027;
+ wdata[2].location = "Intake manifold";
+ wdata[2].temperature = 103.55;
+ wdata[2].pressure = 31.23;
+ wdata[3].serial_no = 1313;
+ wdata[3].location = "Exhaust manifold";
+ wdata[3].temperature = 1252.89;
+ wdata[3].pressure = 84.11;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype for memory.
+ */
+ memtype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(memtype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(memtype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(memtype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(memtype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the compound datatype for the file. Because the standard
+ * types we are using for the file may have different sizes than
+ * the corresponding native types, we must manually calculate the
+ * offset of each member.
+ */
+ filetype = H5Tcreate(H5T_COMPOUND, 8 + sizeof(hvl_t) + 8 + 8);
+ status = H5Tinsert(filetype, "Serial number", 0, H5T_STD_I64BE);
+ status = H5Tinsert(filetype, "Location", 8, strtype);
+ status = H5Tinsert(filetype, "Temperature (F)", 8 + sizeof(hvl_t), H5T_IEEE_F64BE);
+ status = H5Tinsert(filetype, "Pressure (inHg)", 8 + sizeof(hvl_t) + 8, H5T_IEEE_F64BE);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the compound data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (sensor_t *)malloc(dims[0] * sizeof(sensor_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n", ATTRIBUTE, i);
+ printf("Serial number : %d\n", rdata[i].serial_no);
+ printf("Location : %s\n", rdata[i].location);
+ printf("Temperature (F) : %f\n", rdata[i].temperature);
+ printf("Pressure (inHg) : %f\n\n", rdata[i].pressure);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (strings in this
+ * case).
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Tclose(strtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_commit.c b/HDF5Examples/C/H5T/16/h5ex_t_commit.c
new file mode 100644
index 0000000..eab8793
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_commit.c
@@ -0,0 +1,114 @@
+/************************************************************
+
+ This example shows how to commit a named datatype to a
+ file, and read back that datatype. The program first
+ defines a compound datatype, commits it to a file, then
+ closes the file. Next, it reopens the file, opens the
+ datatype, and outputs the names of its fields to the
+ screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_commit.h5"
+#define DATATYPE "Sensor_Type"
+
+int
+main(void)
+{
+ hid_t file, filetype, strtype;
+ /* Handles */
+ herr_t status;
+ H5T_class_t typeclass;
+ char *name;
+ int nmembs, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype. Because the standard types we are
+ * using may have different sizes than the corresponding native
+ * types, we must manually calculate the offset of each member.
+ */
+ filetype = H5Tcreate(H5T_COMPOUND, 8 + sizeof(char *) + 8 + 8);
+ status = H5Tinsert(filetype, "Serial number", 0, H5T_STD_I64BE);
+ status = H5Tinsert(filetype, "Location", 8, strtype);
+ status = H5Tinsert(filetype, "Temperature (F)", 8 + sizeof(char *), H5T_IEEE_F64BE);
+ status = H5Tinsert(filetype, "Pressure (inHg)", 8 + sizeof(char *) + 8, H5T_IEEE_F64BE);
+
+ /*
+ * Commit the compound datatype to the file, creating a named
+ * datatype.
+ */
+ status = H5Tcommit(file, DATATYPE, filetype);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Tclose(filetype);
+ status = H5Tclose(strtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example.
+ */
+
+ /*
+ * Open file.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Open the named datatype.
+ */
+ filetype = H5Topen(file, DATATYPE);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("Named datatype: %s:\n", DATATYPE);
+ /*
+ * Get datatype class. If it isn't compound, we won't print
+ * anything.
+ */
+ typeclass = H5Tget_class(filetype);
+ if (typeclass == H5T_COMPOUND) {
+ printf(" Class: H5T_COMPOUND\n");
+ nmembs = H5Tget_nmembers(filetype);
+ /*
+ * Iterate over compound datatype members.
+ */
+ for (i = 0; i < nmembs; i++) {
+ /*
+ * Get the member name and print it. Note that
+ * H5Tget_member_name allocates space for the string in
+ * name, so we must free() it after use.
+ */
+ name = H5Tget_member_name(filetype, i);
+ printf(" %s\n", name);
+ free(name);
+ }
+ }
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_convert.c b/HDF5Examples/C/H5T/16/h5ex_t_convert.c
new file mode 100644
index 0000000..78aaadb
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_convert.c
@@ -0,0 +1,145 @@
+/************************************************************
+
+ This example shows how to convert between different
+ datatypes in memory. The program converts DIM0 elements
+ of compound type sourcetype to desttype, then outputs the
+ converted data to the screen. A background buffer is used
+ to fill in the elements of desttype that are not in
+ sourcetype.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define DIM0 4
+
+typedef struct {
+ double temperature;
+ double pressure;
+} reading_t; /* Source type */
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Destination type */
+
+int
+main(void)
+{
+ hid_t sourcetype, desttype, strtype, space;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ reading_t *reading; /* Conversion buffer */
+ sensor_t *sensor, /* Conversion buffer */
+ bkgrd[DIM0]; /* Background buffer */
+ int i;
+
+ /*
+ * Allocate memory for conversion buffer. We will allocate space
+ * for it to hold DIM0 elements of the destination type, as the
+ * type conversion is performed in place. Of course, if the
+ * destination type were smaller than the source type, we would
+ * allocate space to hold DIM0 elements of the source type.
+ */
+ reading = (reading_t *)malloc(DIM0 * sizeof(sensor_t));
+
+ /*
+ * Assign the allocated space to a pointer of the destination type,
+ * to allow the buffer to be accessed correctly after the
+ * conversion has taken place.
+ */
+ sensor = (sensor_t *)reading;
+
+ /*
+ * Initialize data.
+ */
+ bkgrd[0].serial_no = 1153;
+ bkgrd[0].location = "Exterior (static)";
+ bkgrd[0].temperature = 53.23;
+ bkgrd[0].pressure = 24.57;
+ bkgrd[1].serial_no = 1184;
+ bkgrd[1].location = "Intake";
+ bkgrd[1].temperature = 55.12;
+ bkgrd[1].pressure = 22.95;
+ bkgrd[2].serial_no = 1027;
+ bkgrd[2].location = "Intake manifold";
+ bkgrd[2].temperature = 103.55;
+ bkgrd[2].pressure = 31.23;
+ bkgrd[3].serial_no = 1313;
+ bkgrd[3].location = "Exhaust manifold";
+ bkgrd[3].temperature = 1252.89;
+ bkgrd[3].pressure = 84.11;
+
+ reading[0].temperature = 54.84;
+ reading[0].pressure = 24.76;
+ reading[1].temperature = 56.63;
+ reading[1].pressure = 23.10;
+ reading[2].temperature = 102.69;
+ reading[2].pressure = 30.97;
+ reading[3].temperature = 1238.27;
+ reading[3].pressure = 82.15;
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype for memory.
+ */
+ sourcetype = H5Tcreate(H5T_COMPOUND, sizeof(reading_t));
+ status = H5Tinsert(sourcetype, "Temperature (F)", HOFFSET(reading_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(sourcetype, "Pressure (inHg)", HOFFSET(reading_t, pressure), H5T_NATIVE_DOUBLE);
+
+ desttype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(desttype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(desttype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(desttype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(desttype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Convert the buffer in reading from sourcetype to desttype.
+ * After this conversion we will use sensor to access the buffer,
+ * as the buffer now matches its type.
+ */
+ status = H5Tconvert(sourcetype, desttype, DIM0, reading, bkgrd, H5P_DEFAULT);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < DIM0; i++) {
+ printf("sensor[%d]:\n", i);
+ printf("Serial number : %d\n", sensor[i].serial_no);
+ printf("Location : %s\n", sensor[i].location);
+ printf("Temperature (F) : %f\n", sensor[i].temperature);
+ printf("Pressure (inHg) : %f\n\n", sensor[i].pressure);
+ }
+
+ /*
+ * Close and release resources. In this case H5Tconvert preserves
+ * the memory locations of the variable-length strings in
+ * "location", so we do not need to free those strings as they were
+ * initialized as string constants.
+ */
+ free(sensor);
+ status = H5Sclose(space);
+ status = H5Tclose(sourcetype);
+ status = H5Tclose(desttype);
+ status = H5Tclose(strtype);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_cpxcmpd.c b/HDF5Examples/C/H5T/16/h5ex_t_cpxcmpd.c
new file mode 100644
index 0000000..d2fabe9
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_cpxcmpd.c
@@ -0,0 +1,319 @@
+/************************************************************
+
+ This example shows how to read and write a complex
+ compound datatype to a dataset. The program first writes
+ complex compound structures to a dataset with a dataspace
+ of DIM0, then closes the file. Next, it reopens the file,
+ reads back selected fields in the structure, and outputs
+ them to the screen.
+
+ Unlike the other datatype examples, in this example we
+ save to the file using native datatypes to simplify the
+ type definitions here. To save using standard types you
+ must manually calculate the sizes and offsets of compound
+ types as shown in h5ex_t_cmpd.c, and convert enumerated
+ values as shown in h5ex_t_enum.c.
+
+ The datatype defined here consists of a compound
+ containing a variable-length list of compound types, as
+ well as a variable-length string, enumeration, double
+ array, object reference and region reference. The nested
+ compound type contains an int, variable-length string and
+ two doubles.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cpxcmpd.h5"
+#define DATASET "DS1"
+#define DIM0 2
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Nested compound type */
+
+typedef enum { RED, GREEN, BLUE } color_t; /* Enumerated type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+ color_t color;
+ double location[3];
+ hobj_ref_t group;
+ hdset_reg_ref_t surveyed_areas;
+} vehicle_t; /* Main compound type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+} rvehicle_t; /* Read type */
+
+int
+main(void)
+{
+ hid_t file, vehicletype, colortype, sensortype, sensorstype, loctype, strtype, rvehicletype, rsensortype,
+ rsensorstype, space, dset, group;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, adims[1] = {3}, adims2[2] = {32, 32}, start[2] = {8, 26}, count[2] = {4, 3},
+ coords[3][2] = {{3, 2}, {3, 3}, {4, 4}};
+ vehicle_t wdata[2]; /* Write buffer */
+ rvehicle_t *rdata; /* Read buffer */
+ color_t val;
+ sensor_t *ptr;
+ double wdata2[32][32];
+ int ndims, i, j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset to use for region references.
+ */
+ for (i = 0; i < 32; i++)
+ for (j = 0; j < 32; j++)
+ wdata2[i][j] = 70. + 0.1 * (i - 16.) + 0.1 * (j - 16.);
+ space = H5Screate_simple(2, adims2, NULL);
+ dset = H5Dcreate(file, "Ambient_Temperature", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2[0]);
+ status = H5Dclose(dset);
+
+ /*
+ * Create groups to use for object references.
+ */
+ group = H5Gcreate(file, "Land_Vehicles", H5P_DEFAULT);
+ status = H5Gclose(group);
+ group = H5Gcreate(file, "Air_Vehicles", H5P_DEFAULT);
+ status = H5Gclose(group);
+
+ /*
+ * Initialize variable-length compound in the first data element.
+ */
+ wdata[0].sensors.len = 4;
+ ptr = (sensor_t *)malloc(wdata[0].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 1153;
+ ptr[0].location = "Exterior (static)";
+ ptr[0].temperature = 53.23;
+ ptr[0].pressure = 24.57;
+ ptr[1].serial_no = 1184;
+ ptr[1].location = "Intake";
+ ptr[1].temperature = 55.12;
+ ptr[1].pressure = 22.95;
+ ptr[2].serial_no = 1027;
+ ptr[2].location = "Intake manifold";
+ ptr[2].temperature = 103.55;
+ ptr[2].pressure = 31.23;
+ ptr[3].serial_no = 1313;
+ ptr[3].location = "Exhaust manifold";
+ ptr[3].temperature = 1252.89;
+ ptr[3].pressure = 84.11;
+ wdata[0].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the first data element.
+ */
+ wdata[0].name = "Airplane";
+ wdata[0].color = GREEN;
+ wdata[0].location[0] = -103234.21;
+ wdata[0].location[1] = 422638.78;
+ wdata[0].location[2] = 5996.43;
+ status = H5Rcreate(&wdata[0].group, file, "Air_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 3, coords[0]);
+ status = H5Rcreate(&wdata[0].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ /*
+ * Initialize variable-length compound in the second data element.
+ */
+ wdata[1].sensors.len = 1;
+ ptr = (sensor_t *)malloc(wdata[1].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 3244;
+ ptr[0].location = "Roof";
+ ptr[0].temperature = 83.82;
+ ptr[0].pressure = 29.92;
+ wdata[1].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the second data element.
+ */
+ wdata[1].name = "Automobile";
+ wdata[1].color = RED;
+ wdata[1].location[0] = 326734.36;
+ wdata[1].location[1] = 221568.23;
+ wdata[1].location[2] = 432.36;
+ status = H5Rcreate(&wdata[1].group, file, "Land_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Rcreate(&wdata[1].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ status = H5Sclose(space);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype.
+ */
+ sensortype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(sensortype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(sensortype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(sensortype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(sensortype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the variable-length datatype.
+ */
+ sensorstype = H5Tvlen_create(sensortype);
+
+ /*
+ * Create the enumerated datatype.
+ */
+ colortype = H5Tenum_create(H5T_NATIVE_INT);
+ val = (color_t)RED;
+ status = H5Tenum_insert(colortype, "Red", &val);
+ val = (color_t)GREEN;
+ status = H5Tenum_insert(colortype, "Green", &val);
+ val = (color_t)BLUE;
+ status = H5Tenum_insert(colortype, "Blue", &val);
+
+ /*
+ * Create the array datatype.
+ */
+ loctype = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, adims, NULL);
+
+ /*
+ * Create the main compound datatype.
+ */
+ vehicletype = H5Tcreate(H5T_COMPOUND, sizeof(vehicle_t));
+ status = H5Tinsert(vehicletype, "Sensors", HOFFSET(vehicle_t, sensors), sensorstype);
+ status = H5Tinsert(vehicletype, "Name", HOFFSET(vehicle_t, name), strtype);
+ status = H5Tinsert(vehicletype, "Color", HOFFSET(vehicle_t, color), colortype);
+ status = H5Tinsert(vehicletype, "Location", HOFFSET(vehicle_t, location), loctype);
+ status = H5Tinsert(vehicletype, "Group", HOFFSET(vehicle_t, group), H5T_STD_REF_OBJ);
+ status =
+ H5Tinsert(vehicletype, "Surveyed areas", HOFFSET(vehicle_t, surveyed_areas), H5T_STD_REF_DSETREG);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the compound data to it.
+ */
+ dset = H5Dcreate(file, DATASET, vehicletype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, vehicletype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources. Note that we cannot use
+ * H5Dvlen_reclaim as it would attempt to free() the string
+ * constants used to initialize the name fields in wdata. We must
+ * therefore manually free() only the data previously allocated
+ * through malloc().
+ */
+ for (i = 0; i < dims[0]; i++)
+ free(wdata[i].sensors.p);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(sensortype);
+ status = H5Tclose(sensorstype);
+ status = H5Tclose(colortype);
+ status = H5Tclose(loctype);
+ status = H5Tclose(vehicletype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). We will only read back the variable length strings.
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype for reading. Even though it
+ * has only one field, it must still be defined as a compound type
+ * so the library can match the correct field in the file type.
+ * This matching is done by name. However, we do not need to
+ * define a structure for the read buffer as we can simply treat it
+ * as a char *.
+ */
+ rsensortype = H5Tcreate(H5T_COMPOUND, sizeof(char *));
+ status = H5Tinsert(rsensortype, "Location", 0, strtype);
+
+ /*
+ * Create the variable-length datatype for reading.
+ */
+ rsensorstype = H5Tvlen_create(rsensortype);
+
+ /*
+ * Create the main compound datatype for reading.
+ */
+ rvehicletype = H5Tcreate(H5T_COMPOUND, sizeof(rvehicle_t));
+ status = H5Tinsert(rvehicletype, "Sensors", HOFFSET(rvehicle_t, sensors), rsensorstype);
+ status = H5Tinsert(rvehicletype, "Name", HOFFSET(rvehicle_t, name), strtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (rvehicle_t *)malloc(dims[0] * sizeof(rvehicle_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, rvehicletype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n", DATASET, i);
+ printf(" Vehicle name :\n %s\n", rdata[i].name);
+ printf(" Sensor locations :\n");
+ for (j = 0; j < rdata[i].sensors.len; j++)
+ printf(" %s\n", ((char **)rdata[i].sensors.p)[j]);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (including
+ * strings).
+ */
+ status = H5Dvlen_reclaim(rvehicletype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(rsensortype);
+ status = H5Tclose(rsensorstype);
+ status = H5Tclose(rvehicletype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_cpxcmpdatt.c b/HDF5Examples/C/H5T/16/h5ex_t_cpxcmpdatt.c
new file mode 100644
index 0000000..5932e1e
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_cpxcmpdatt.c
@@ -0,0 +1,331 @@
+/************************************************************
+
+ This example shows how to read and write a complex
+ compound datatype to an attribute. The program first
+ writes complex compound structures to an attribute with a
+ dataspace of DIM0, then closes the file. Next, it reopens
+ the file, reads back selected fields in the structure, and
+ outputs them to the screen.
+
+ Unlike the other datatype examples, in this example we
+ save to the file using native datatypes to simplify the
+ type definitions here. To save using standard types you
+ must manually calculate the sizes and offsets of compound
+ types as shown in h5ex_t_cmpd.c, and convert enumerated
+ values as shown in h5ex_t_enum.c.
+
+ The datatype defined here consists of a compound
+ containing a variable-length list of compound types, as
+ well as a variable-length string, enumeration, double
+ array, object reference and region reference. The nested
+ compound type contains an int, variable-length string and
+ two doubles.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cpxcmpdatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 2
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Nested compound type */
+
+typedef enum { RED, GREEN, BLUE } color_t; /* Enumerated type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+ color_t color;
+ double location[3];
+ hobj_ref_t group;
+ hdset_reg_ref_t surveyed_areas;
+} vehicle_t; /* Main compound type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+} rvehicle_t; /* Read type */
+
+int
+main(void)
+{
+ hid_t file, vehicletype, colortype, sensortype, sensorstype, loctype, strtype, rvehicletype, rsensortype,
+ rsensorstype, space, dset, group, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, adims[1] = {3}, adims2[2] = {32, 32}, start[2] = {8, 26}, count[2] = {4, 3},
+ coords[3][2] = {{3, 2}, {3, 3}, {4, 4}};
+ vehicle_t wdata[2]; /* Write buffer */
+ rvehicle_t *rdata; /* Read buffer */
+ color_t val;
+ sensor_t *ptr;
+ double wdata2[32][32];
+ int ndims, i, j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset to use for region references.
+ */
+ for (i = 0; i < 32; i++)
+ for (j = 0; j < 32; j++)
+ wdata2[i][j] = 70. + 0.1 * (i - 16.) + 0.1 * (j - 16.);
+ space = H5Screate_simple(2, adims2, NULL);
+ dset = H5Dcreate(file, "Ambient_Temperature", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2[0]);
+ status = H5Dclose(dset);
+
+ /*
+ * Create groups to use for object references.
+ */
+ group = H5Gcreate(file, "Land_Vehicles", H5P_DEFAULT);
+ status = H5Gclose(group);
+ group = H5Gcreate(file, "Air_Vehicles", H5P_DEFAULT);
+ status = H5Gclose(group);
+
+ /*
+ * Initialize variable-length compound in the first data element.
+ */
+ wdata[0].sensors.len = 4;
+ ptr = (sensor_t *)malloc(wdata[0].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 1153;
+ ptr[0].location = "Exterior (static)";
+ ptr[0].temperature = 53.23;
+ ptr[0].pressure = 24.57;
+ ptr[1].serial_no = 1184;
+ ptr[1].location = "Intake";
+ ptr[1].temperature = 55.12;
+ ptr[1].pressure = 22.95;
+ ptr[2].serial_no = 1027;
+ ptr[2].location = "Intake manifold";
+ ptr[2].temperature = 103.55;
+ ptr[2].pressure = 31.23;
+ ptr[3].serial_no = 1313;
+ ptr[3].location = "Exhaust manifold";
+ ptr[3].temperature = 1252.89;
+ ptr[3].pressure = 84.11;
+ wdata[0].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the first data element.
+ */
+ wdata[0].name = "Airplane";
+ wdata[0].color = GREEN;
+ wdata[0].location[0] = -103234.21;
+ wdata[0].location[1] = 422638.78;
+ wdata[0].location[2] = 5996.43;
+ status = H5Rcreate(&wdata[0].group, file, "Air_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 3, coords[0]);
+ status = H5Rcreate(&wdata[0].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ /*
+ * Initialize variable-length compound in the second data element.
+ */
+ wdata[1].sensors.len = 1;
+ ptr = (sensor_t *)malloc(wdata[1].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 3244;
+ ptr[0].location = "Roof";
+ ptr[0].temperature = 83.82;
+ ptr[0].pressure = 29.92;
+ wdata[1].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the second data element.
+ */
+ wdata[1].name = "Automobile";
+ wdata[1].color = RED;
+ wdata[1].location[0] = 326734.36;
+ wdata[1].location[1] = 221568.23;
+ wdata[1].location[2] = 432.36;
+ status = H5Rcreate(&wdata[1].group, file, "Land_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Rcreate(&wdata[1].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ status = H5Sclose(space);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype.
+ */
+ sensortype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(sensortype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(sensortype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(sensortype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(sensortype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the variable-length datatype.
+ */
+ sensorstype = H5Tvlen_create(sensortype);
+
+ /*
+ * Create the enumerated datatype.
+ */
+ colortype = H5Tenum_create(H5T_NATIVE_INT);
+ val = (color_t)RED;
+ status = H5Tenum_insert(colortype, "Red", &val);
+ val = (color_t)GREEN;
+ status = H5Tenum_insert(colortype, "Green", &val);
+ val = (color_t)BLUE;
+ status = H5Tenum_insert(colortype, "Blue", &val);
+
+ /*
+ * Create the array datatype.
+ */
+ loctype = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, adims, NULL);
+
+ /*
+ * Create the main compound datatype.
+ */
+ vehicletype = H5Tcreate(H5T_COMPOUND, sizeof(vehicle_t));
+ status = H5Tinsert(vehicletype, "Sensors", HOFFSET(vehicle_t, sensors), sensorstype);
+ status = H5Tinsert(vehicletype, "Name", HOFFSET(vehicle_t, name), strtype);
+ status = H5Tinsert(vehicletype, "Color", HOFFSET(vehicle_t, color), colortype);
+ status = H5Tinsert(vehicletype, "Location", HOFFSET(vehicle_t, location), loctype);
+ status = H5Tinsert(vehicletype, "Group", HOFFSET(vehicle_t, group), H5T_STD_REF_OBJ);
+ status =
+ H5Tinsert(vehicletype, "Surveyed areas", HOFFSET(vehicle_t, surveyed_areas), H5T_STD_REF_DSETREG);
+
+ /*
+ * Create dataset with a scalar dataspace. to serve as the parent
+ * for the attribute.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the compound data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, vehicletype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, vehicletype, wdata);
+
+ /*
+ * Close and release resources. Note that we cannot use
+ * H5Dvlen_reclaim as it would attempt to free() the string
+ * constants used to initialize the name fields in wdata. We must
+ * therefore manually free() only the data previously allocated
+ * through malloc().
+ */
+ for (i = 0; i < dims[0]; i++)
+ free(wdata[i].sensors.p);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(sensortype);
+ status = H5Tclose(sensorstype);
+ status = H5Tclose(colortype);
+ status = H5Tclose(loctype);
+ status = H5Tclose(vehicletype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). We will only read back the variable length strings.
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype for reading. Even though it
+ * has only one field, it must still be defined as a compound type
+ * so the library can match the correct field in the file type.
+ * This matching is done by name. However, we do not need to
+ * define a structure for the read buffer as we can simply treat it
+ * as a char *.
+ */
+ rsensortype = H5Tcreate(H5T_COMPOUND, sizeof(char *));
+ status = H5Tinsert(rsensortype, "Location", 0, strtype);
+
+ /*
+ * Create the variable-length datatype for reading.
+ */
+ rsensorstype = H5Tvlen_create(rsensortype);
+
+ /*
+ * Create the main compound datatype for reading.
+ */
+ rvehicletype = H5Tcreate(H5T_COMPOUND, sizeof(rvehicle_t));
+ status = H5Tinsert(rvehicletype, "Sensors", HOFFSET(rvehicle_t, sensors), rsensorstype);
+ status = H5Tinsert(rvehicletype, "Name", HOFFSET(rvehicle_t, name), strtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (rvehicle_t *)malloc(dims[0] * sizeof(rvehicle_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, rvehicletype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n", ATTRIBUTE, i);
+ printf(" Vehicle name :\n %s\n", rdata[i].name);
+ printf(" Sensor locations :\n");
+ for (j = 0; j < rdata[i].sensors.len; j++)
+ printf(" %s\n", ((char **)rdata[i].sensors.p)[j]);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (including
+ * strings).
+ */
+ status = H5Dvlen_reclaim(rvehicletype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(rsensortype);
+ status = H5Tclose(rsensorstype);
+ status = H5Tclose(rvehicletype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_enum.c b/HDF5Examples/C/H5T/16/h5ex_t_enum.c
new file mode 100644
index 0000000..108182b
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_enum.c
@@ -0,0 +1,164 @@
+/************************************************************
+
+ This example shows how to read and write enumerated
+ datatypes to a dataset. The program first writes
+ enumerated values to a dataset with a dataspace of
+ DIM0xDIM1, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_enum.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+#define F_BASET H5T_STD_I16BE /* File base type */
+#define M_BASET H5T_NATIVE_INT /* Memory base type */
+#define NAME_BUF_SIZE 16
+
+typedef enum { SOLID, LIQUID, GAS, PLASMA } phase_t; /* Enumerated type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ phase_t wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ val;
+ char *names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}, name[NAME_BUF_SIZE];
+ int ndims, i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (phase_t)((i + 1) * j - j) % (int)(PLASMA + 1);
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the enumerated datatypes for file and memory. This
+ * process is simplified if native types are used for the file,
+ * as only one type must be defined.
+ */
+ filetype = H5Tenum_create(F_BASET);
+ memtype = H5Tenum_create(M_BASET);
+
+ for (i = (int)SOLID; i <= (int)PLASMA; i++) {
+ /*
+ * Insert enumerated value for memtype.
+ */
+ val = (phase_t)i;
+ status = H5Tenum_insert(memtype, names[i], &val);
+ /*
+ * Insert enumerated value for filetype. We must first convert
+ * the numerical value val to the base type of the destination.
+ */
+ status = H5Tconvert(M_BASET, F_BASET, 1, &val, NULL, H5P_DEFAULT);
+ status = H5Tenum_insert(filetype, names[i], &val);
+ }
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the enumerated data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (phase_t **)malloc(dims[0] * sizeof(phase_t *));
+
+ /*
+ * Allocate space for enumerated data.
+ */
+ rdata[0] = (phase_t *)malloc(dims[0] * dims[1] * sizeof(phase_t));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+
+ /*
+ * Get the name of the enumeration member.
+ */
+ status = H5Tenum_nameof(memtype, &rdata[i][j], name, NAME_BUF_SIZE);
+ printf(" %-6s", name);
+ }
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_enumatt.c b/HDF5Examples/C/H5T/16/h5ex_t_enumatt.c
new file mode 100644
index 0000000..ae6c087
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_enumatt.c
@@ -0,0 +1,175 @@
+/************************************************************
+
+ This example shows how to read and write enumerated
+ datatypes to an attribute. The program first writes
+ enumerated values to an attribute with a dataspace of
+ DIM0xDIM1, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_enumatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+#define F_BASET H5T_STD_I16BE /* File base type */
+#define M_BASET H5T_NATIVE_INT /* Memory base type */
+#define NAME_BUF_SIZE 16
+
+typedef enum { SOLID, LIQUID, GAS, PLASMA } phase_t; /* Enumerated type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ phase_t wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ val;
+ char *names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}, name[NAME_BUF_SIZE];
+ int ndims, i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (phase_t)((i + 1) * j - j) % (int)(PLASMA + 1);
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the enumerated datatypes for file and memory. This
+ * process is simplified if native types are used for the file,
+ * as only one type must be defined.
+ */
+ filetype = H5Tenum_create(F_BASET);
+ memtype = H5Tenum_create(M_BASET);
+
+ for (i = (int)SOLID; i <= (int)PLASMA; i++) {
+ /*
+ * Insert enumerated value for memtype.
+ */
+ val = (phase_t)i;
+ status = H5Tenum_insert(memtype, names[i], &val);
+ /*
+ * Insert enumerated value for filetype. We must first convert
+ * the numerical value val to the base type of the destination.
+ */
+ status = H5Tconvert(M_BASET, F_BASET, 1, &val, NULL, H5P_DEFAULT);
+ status = H5Tenum_insert(filetype, names[i], &val);
+ }
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the enumerated data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (phase_t **)malloc(dims[0] * sizeof(phase_t *));
+
+ /*
+ * Allocate space for enumerated data.
+ */
+ rdata[0] = (phase_t *)malloc(dims[0] * dims[1] * sizeof(phase_t));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+
+ /*
+ * Get the name of the enumeration member.
+ */
+ status = H5Tenum_nameof(memtype, &rdata[i][j], name, NAME_BUF_SIZE);
+ printf(" %-6s", name);
+ }
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_float.c b/HDF5Examples/C/H5T/16/h5ex_t_float.c
new file mode 100644
index 0000000..70e2249
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_float.c
@@ -0,0 +1,130 @@
+/************************************************************
+
+ This example shows how to read and write float datatypes
+ to a dataset. The program first writes floats to a
+ dataset with a dataspace of DIM0xDIM1, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_float.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ double wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (double)i / (j + 0.5) + j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the floating point data to it. In
+ * this example we will save the data as 64 bit little endian IEEE
+ * floating point numbers, regardless of the native type. The HDF5
+ * library automatically converts between different floating point
+ * types.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_IEEE_F64LE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (double **)malloc(dims[0] * sizeof(double *));
+
+ /*
+ * Allocate space for floating point data.
+ */
+ rdata[0] = (double *)malloc(dims[0] * dims[1] * sizeof(double));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %6.4f", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_floatatt.c b/HDF5Examples/C/H5T/16/h5ex_t_floatatt.c
new file mode 100644
index 0000000..f0a4404
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_floatatt.c
@@ -0,0 +1,142 @@
+/************************************************************
+
+ This example shows how to read and write floating point
+ datatypes to an attribute. The program first writes
+ floating point numbers to an attribute with a dataspace of
+ DIM0xDIM1, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_floatatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ double wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (double)i / (j + 0.5) + j;
+ ;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the floating point data to it.
+ * In this example we will save the data as 64 bit little endian
+ * IEEE floating point numbers, regardless of the native type. The
+ * HDF5 library automatically converts between different floating
+ * point types.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_IEEE_F64LE, space, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_NATIVE_DOUBLE, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (double **)malloc(dims[0] * sizeof(double *));
+
+ /*
+ * Allocate space for floating point data.
+ */
+ rdata[0] = (double *)malloc(dims[0] * dims[1] * sizeof(double));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_NATIVE_DOUBLE, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %6.4f", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_int.c b/HDF5Examples/C/H5T/16/h5ex_t_int.c
new file mode 100644
index 0000000..8534025
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_int.c
@@ -0,0 +1,129 @@
+/************************************************************
+
+ This example shows how to read and write integer datatypes
+ to a dataset. The program first writes integers to a
+ dataset with a dataspace of DIM0xDIM1, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_int.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ int wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ ndims, i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = i * j - j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the integer data to it. In this
+ * example we will save the data as 64 bit big endian integers,
+ * regardless of the native integer type. The HDF5 library
+ * automatically converts between different integer types.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_STD_I64BE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (int **)malloc(dims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (int *)malloc(dims[0] * dims[1] * sizeof(int));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %3d", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_intatt.c b/HDF5Examples/C/H5T/16/h5ex_t_intatt.c
new file mode 100644
index 0000000..d7a43d6
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_intatt.c
@@ -0,0 +1,140 @@
+/************************************************************
+
+ This example shows how to read and write integer datatypes
+ to an attribute. The program first writes integers to an
+ attribute with a dataspace of DIM0xDIM1, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_intatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ int wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ ndims, i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = i * j - j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the integer data to it. In this
+ * example we will save the data as 64 bit big endian integers,
+ * regardless of the native integer type. The HDF5 library
+ * automatically converts between different integer types.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_STD_I64BE, space, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_NATIVE_INT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (int **)malloc(dims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (int *)malloc(dims[0] * dims[1] * sizeof(int));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_NATIVE_INT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %3d", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_objref.c b/HDF5Examples/C/H5T/16/h5ex_t_objref.c
new file mode 100644
index 0000000..4c35239
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_objref.c
@@ -0,0 +1,158 @@
+/************************************************************
+
+ This example shows how to read and write object references
+ to a dataset. The program first creates objects in the
+ file and writes references to those objects to a dataset
+ with a dataspace of DIM0, then closes the file. Next, it
+ reopens the file, dereferences the references, and outputs
+ the names of their targets to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_objref.h5"
+#define DATASET "DS1"
+#define DIM0 2
+
+int
+main(void)
+{
+ hid_t file, space, dset, obj; /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ hobj_ref_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ H5G_obj_t objtype;
+ ssize_t size;
+ char *name;
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ obj = H5Dcreate(file, "DS2", H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Dclose(obj);
+ status = H5Sclose(space);
+
+ /*
+ * Create a group.
+ */
+ obj = H5Gcreate(file, "G1", H5P_DEFAULT);
+ status = H5Gclose(obj);
+
+ /*
+ * Create references to the previously created objects. Passing -1
+ * as space_id causes this parameter to be ignored. Other values
+ * besides valid dataspaces result in an error.
+ */
+ status = H5Rcreate(&wdata[0], file, "G1", H5R_OBJECT, -1);
+ status = H5Rcreate(&wdata[1], file, "DS2", H5R_OBJECT, -1);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the object references to it.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_STD_REF_OBJ, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hobj_ref_t *)malloc(dims[0] * sizeof(hobj_ref_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n ->", DATASET, i);
+ /*
+ * Open the referenced object, get its name and type.
+ */
+ obj = H5Rdereference(dset, H5R_OBJECT, &rdata[i]);
+ objtype = H5Rget_obj_type(dset, H5R_OBJECT, &rdata[i]);
+
+ /*
+ * Get the length of the name, allocate space, then retrieve
+ * the name.
+ */
+ size = 1 + H5Iget_name(obj, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(obj, name, size);
+
+ /*
+ * Print the object type and close the object.
+ */
+ switch (objtype) {
+ case H5G_GROUP:
+ printf("Group");
+ status = H5Gclose(obj);
+ break;
+ case H5G_DATASET:
+ printf("Dataset");
+ status = H5Dclose(obj);
+ break;
+ case H5G_TYPE:
+ printf("Named Datatype");
+ status = H5Tclose(obj);
+ }
+
+ /*
+ * Print the name and deallocate space for the name.
+ */
+ printf(": %s\n", name);
+ free(name);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_objrefatt.c b/HDF5Examples/C/H5T/16/h5ex_t_objrefatt.c
new file mode 100644
index 0000000..95d86dc
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_objrefatt.c
@@ -0,0 +1,175 @@
+/************************************************************
+
+ This example shows how to read and write object references
+ to an attribute. The program first creates objects in the
+ file and writes references to those objects to an
+ attribute with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, dereferences the references,
+ and outputs the names of their targets to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_objrefatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 2
+
+int
+main(void)
+{
+ hid_t file; /* File Handle */
+ hid_t space; /* Dataspace Handle */
+ hid_t dset; /* Dataset Handle */
+ hid_t obj; /* Object Handle */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ hobj_ref_t wdata[DIM0]; /* Write buffer */
+ hobj_ref_t *rdata = NULL; /* Read buffer */
+ H5G_obj_t objtype;
+ ssize_t size;
+ char *name = NULL;
+ int ndims;
+ int i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ obj = H5Dcreate(file, "DS2", H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Dclose(obj);
+ status = H5Sclose(space);
+
+ /*
+ * Create a group.
+ */
+ obj = H5Gcreate(file, "G1", H5P_DEFAULT);
+ status = H5Gclose(obj);
+
+ /*
+ * Create references to the previously created objects. Passing -1
+ * as space_id causes this parameter to be ignored. Other values
+ * besides valid dataspaces result in an error.
+ */
+ status = H5Rcreate(&wdata[0], file, "G1", H5R_OBJECT, -1);
+ status = H5Rcreate(&wdata[1], file, "DS2", H5R_OBJECT, -1);
+
+ /*
+ * Create dataset with a scalar dataspace to serve as the parent
+ * for the attribute.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the object references to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_STD_REF_OBJ, space, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_STD_REF_OBJ, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hobj_ref_t *)malloc(dims[0] * sizeof(hobj_ref_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_STD_REF_OBJ, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n ->", ATTRIBUTE, i);
+
+ /*
+ * Open the referenced object, get its name and type.
+ */
+ obj = H5Rdereference(dset, H5R_OBJECT, &rdata[i]);
+ objtype = H5Rget_obj_type(dset, H5R_OBJECT, &rdata[i]);
+
+ /*
+ * Get the length of the name, allocate space, then retrieve
+ * the name.
+ */
+ size = 1 + H5Iget_name(obj, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(obj, name, size);
+
+ /*
+ * Print the object type and close the object.
+ */
+ switch (objtype) {
+ case H5G_GROUP:
+ printf("Group");
+ status = H5Gclose(obj);
+ break;
+ case H5G_DATASET:
+ printf("Dataset");
+ status = H5Dclose(obj);
+ break;
+ case H5G_TYPE:
+ printf("Named Datatype");
+ status = H5Tclose(obj);
+ }
+
+ /*
+ * Print the name and deallocate space for the name.
+ */
+ printf(": %s\n", name);
+ free(name);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_opaque.c b/HDF5Examples/C/H5T/16/h5ex_t_opaque.c
new file mode 100644
index 0000000..8755ccc
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_opaque.c
@@ -0,0 +1,142 @@
+/************************************************************
+
+ This example shows how to read and write opaque datatypes
+ to a dataset. The program first writes opaque data to a
+ dataset with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_opaque.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define LEN 7
+
+int
+main(void)
+{
+ hid_t file, space, dtype, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t len;
+ char wdata[DIM0 * LEN], /* Write buffer */
+ *rdata, /* Read buffer */
+ str[LEN] = "OPAQUE", *tag;
+ int ndims, i, j;
+ unsigned majnum, minnum, relnum;
+
+ /* Get library version to differentiate between acceptable version methods
+ * to free the tag returned by H5Tget_tag. */
+ H5get_libversion(&majnum, &minnum, &relnum);
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < LEN - 1; j++)
+ wdata[j + i * LEN] = str[j];
+ wdata[LEN - 1 + i * LEN] = (char)i + '0';
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create opaque datatype and set the tag to something appropriate.
+ * For this example we will write and view the data as a character
+ * array.
+ */
+ dtype = H5Tcreate(H5T_OPAQUE, LEN);
+ status = H5Tset_tag(dtype, "Character array");
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the opaque data to it.
+ */
+ dset = H5Dcreate(file, DATASET, dtype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get datatype and properties for the datatype. Note that H5Tget_tag
+ * allocates space for the string in tag, so we must remember to free() it
+ * later.
+ */
+ dtype = H5Dget_type(dset);
+ len = H5Tget_size(dtype);
+ tag = H5Tget_tag(dtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char *)malloc(dims[0] * len);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("Datatype tag for %s is: \"%s\"\n", DATASET, tag);
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%u]: ", DATASET, i);
+ for (j = 0; j < len; j++)
+ printf("%c", rdata[j + i * len]);
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ /* H5free_memory is available in 1.8.16 and above.
+ * Last version for 1.6 was 1.6.10. */
+ if (minnum > 8 || relnum > 15)
+ H5free_memory(tag);
+ else
+ free(tag);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_opaqueatt.c b/HDF5Examples/C/H5T/16/h5ex_t_opaqueatt.c
new file mode 100644
index 0000000..4a54fbb
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_opaqueatt.c
@@ -0,0 +1,153 @@
+/************************************************************
+
+ This example shows how to read and write opaque datatypes
+ to an attribute. The program first writes opaque data to
+ an attribute with a dataspace of DIM0, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_opaqueatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define LEN 7
+
+int
+main(void)
+{
+ hid_t file, space, dtype, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t len;
+ char wdata[DIM0 * LEN], /* Write buffer */
+ *rdata, /* Read buffer */
+ str[LEN] = "OPAQUE", *tag;
+ int ndims, i, j;
+ unsigned majnum, minnum, relnum;
+
+ /* Get library version to differentiate between acceptable version methods
+ * to free the tag returned by H5Tget_tag. */
+ H5get_libversion(&majnum, &minnum, &relnum);
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < LEN - 1; j++)
+ wdata[j + i * LEN] = str[j];
+ wdata[LEN - 1 + i * LEN] = (char)i + '0';
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create opaque datatype and set the tag to something appropriate.
+ * For this example we will write and view the data as a character
+ * array.
+ */
+ dtype = H5Tcreate(H5T_OPAQUE, LEN);
+ status = H5Tset_tag(dtype, "Character array");
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the opaque data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, dtype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, dtype, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get datatype and properties for the datatype. Note that H5Tget_tag
+ * allocates space for the string in tag, so we must remember to free() it
+ * later.
+ */
+ dtype = H5Aget_type(attr);
+ len = H5Tget_size(dtype);
+ tag = H5Tget_tag(dtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char *)malloc(dims[0] * len);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, dtype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("Datatype tag for %s is: \"%s\"\n", ATTRIBUTE, tag);
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%u]: ", ATTRIBUTE, i);
+ for (j = 0; j < len; j++)
+ printf("%c", rdata[j + i * len]);
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ /* H5free_memory is available in 1.8.16 and above.
+ * Last version for 1.6 was 1.6.10. */
+ if (minnum > 8 || relnum > 15)
+ H5free_memory(tag);
+ else
+ free(tag);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_regref.c b/HDF5Examples/C/H5T/16/h5ex_t_regref.c
new file mode 100644
index 0000000..50b3ff0
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_regref.c
@@ -0,0 +1,170 @@
+/************************************************************
+
+ This example shows how to read and write region references
+ to a dataset. The program first creates a dataset
+ containing characters and writes references to region of
+ the dataset to a new dataset with a dataspace of DIM0,
+ then closes the file. Next, it reopens the file,
+ dereferences the references, and outputs the referenced
+ regions to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_regref.h5"
+#define DATASET "DS1"
+#define DATASET2 "DS2"
+#define DIM0 2
+#define DS2DIM0 3
+#define DS2DIM1 16
+
+int
+main(void)
+{
+ hid_t file, space, memspace, dset, dset2;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, dims2[2] = {DS2DIM0, DS2DIM1}, coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}},
+ start[2] = {0, 0}, stride[2] = {2, 11}, count[2] = {2, 2}, block[2] = {1, 3};
+ hssize_t npoints;
+ hdset_reg_ref_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ ssize_t size;
+ char wdata2[DS2DIM0][DS2DIM1] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"}, *rdata2, *name;
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a dataset with character data.
+ */
+ space = H5Screate_simple(2, dims2, NULL);
+ dset2 = H5Dcreate(file, DATASET2, H5T_STD_I8LE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
+
+ /*
+ * Create reference to a list of elements in dset2.
+ */
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 4, coords[0]);
+ status = H5Rcreate(&wdata[0], file, DATASET2, H5R_DATASET_REGION, space);
+
+ /*
+ * Create reference to a hyperslab in dset2, close dataspace.
+ */
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Rcreate(&wdata[1], file, DATASET2, H5R_DATASET_REGION, space);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the region references to it.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_STD_REF_DSETREG, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Dclose(dset2);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hdset_reg_ref_t *)malloc(dims[0] * sizeof(hdset_reg_ref_t));
+ status = H5Sclose(space);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n ->", DATASET, i);
+
+ /*
+ * Open the referenced object, retrieve its region as a
+ * dataspace selection.
+ */
+ dset2 = H5Rdereference(dset, H5R_DATASET_REGION, &rdata[i]);
+ space = H5Rget_region(dset, H5R_DATASET_REGION, &rdata[i]);
+
+ /*
+ * Get the length of the object's name, allocate space, then
+ * retrieve the name.
+ */
+ size = 1 + H5Iget_name(dset2, NULL, 0);
+ name = (char *)malloc(size);
+ size = 1 + H5Iget_name(dset2, name, size);
+ if (size <= 1)
+ name[0] = '\0';
+
+ /*
+ * Allocate space for the read buffer. We will only allocate
+ * enough space for the selection, plus a null terminator. The
+ * read buffer will be 1-dimensional.
+ */
+ npoints = H5Sget_select_npoints(space);
+ rdata2 = (char *)malloc(npoints + 1);
+
+ /*
+ * Read the dataset region, and add a null terminator so we can
+ * print it as a string.
+ */
+ memspace = H5Screate_simple(1, (hsize_t *)&npoints, NULL);
+ status = H5Dread(dset2, H5T_NATIVE_CHAR, memspace, space, H5P_DEFAULT, rdata2);
+ rdata2[npoints] = '\0';
+
+ /*
+ * Print the name and region data, close and release resources.
+ */
+ printf(" %s: %s\n", name, rdata2);
+ free(rdata2);
+ free(name);
+ status = H5Sclose(space);
+ status = H5Sclose(memspace);
+ status = H5Dclose(dset2);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_regrefatt.c b/HDF5Examples/C/H5T/16/h5ex_t_regrefatt.c
new file mode 100644
index 0000000..1f993fb
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_regrefatt.c
@@ -0,0 +1,182 @@
+/************************************************************
+
+ This example shows how to read and write region references
+ to an attribute. The program first creates a dataset
+ containing characters and writes references to region of
+ the dataset to a new attribute with a dataspace of DIM0,
+ then closes the file. Next, it reopens the file,
+ dereferences the references, and outputs the referenced
+ regions to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_regrefatt.h5"
+#define DATASET "DS1"
+#define DATASET2 "DS2"
+#define ATTRIBUTE "A1"
+#define DIM0 2
+#define DS2DIM0 3
+#define DS2DIM1 16
+
+int
+main(void)
+{
+ hid_t file, space, memspace, dset, dset2, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, dims2[2] = {DS2DIM0, DS2DIM1}, coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}},
+ start[2] = {0, 0}, stride[2] = {2, 11}, count[2] = {2, 2}, block[2] = {1, 3};
+ hssize_t npoints;
+ hdset_reg_ref_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ ssize_t size;
+ char wdata2[DS2DIM0][DS2DIM1] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"}, *rdata2, *name;
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a dataset with character data.
+ */
+ space = H5Screate_simple(2, dims2, NULL);
+ dset2 = H5Dcreate(file, DATASET2, H5T_STD_I8LE, space, H5P_DEFAULT);
+ status = H5Dwrite(dset2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
+
+ /*
+ * Create reference to a list of elements in dset2.
+ */
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 4, coords[0]);
+ status = H5Rcreate(&wdata[0], file, DATASET2, H5R_DATASET_REGION, space);
+
+ /*
+ * Create reference to a hyperslab in dset2, close dataspace.
+ */
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Rcreate(&wdata[1], file, DATASET2, H5R_DATASET_REGION, space);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataset with a scalar dataspace to serve as the parent
+ * for the attribute.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the region references to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_STD_REF_DSETREG, space, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_STD_REF_DSETREG, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Dclose(dset2);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hdset_reg_ref_t *)malloc(dims[0] * sizeof(hdset_reg_ref_t));
+ status = H5Sclose(space);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_STD_REF_DSETREG, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%d]:\n ->", ATTRIBUTE, i);
+
+ /*
+ * Open the referenced object, retrieve its region as a
+ * dataspace selection.
+ */
+ dset2 = H5Rdereference(dset, H5R_DATASET_REGION, &rdata[i]);
+ space = H5Rget_region(dset, H5R_DATASET_REGION, &rdata[i]);
+
+ /*
+ * Get the length of the object's name, allocate space, then
+ * retrieve the name.
+ */
+ size = 1 + H5Iget_name(dset2, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(dset2, name, size);
+ if (size <= 1)
+ name[0] = '\0';
+
+ /*
+ * Allocate space for the read buffer. We will only allocate
+ * enough space for the selection, plus a null terminator. The
+ * read buffer will be 1-dimensional.
+ */
+ npoints = H5Sget_select_npoints(space);
+ rdata2 = (char *)malloc(npoints + 1);
+
+ /*
+ * Read the dataset region, and add a null terminator so we can
+ * print it as a string.
+ */
+ memspace = H5Screate_simple(1, (hsize_t *)&npoints, NULL);
+ status = H5Dread(dset2, H5T_NATIVE_CHAR, memspace, space, H5P_DEFAULT, rdata2);
+ rdata2[npoints] = '\0';
+
+ /*
+ * Print the name and region data, close and release resources.
+ */
+ printf(" %s: %s\n", name, rdata2);
+ free(rdata2);
+ free(name);
+ status = H5Sclose(space);
+ status = H5Sclose(memspace);
+ status = H5Dclose(dset2);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_string.c b/HDF5Examples/C/H5T/16/h5ex_t_string.c
new file mode 100644
index 0000000..532e664
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_string.c
@@ -0,0 +1,144 @@
+/************************************************************
+
+ This example shows how to read and write string datatypes
+ to a dataset. The program first writes strings to a
+ dataset with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_string.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define SDIM 8
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t sdim;
+ char wdata[DIM0][SDIM] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings, therefore they do not need space
+ * for the null terminator in the file.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, SDIM - 1);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, SDIM);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the string data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset and string have the same name and rank, but can have
+ * any size. Therefore we must allocate a new array to read in
+ * data using malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get the datatype and its size.
+ */
+ filetype = H5Dget_type(dset);
+ sdim = H5Tget_size(filetype);
+ sdim++; /* Make room for null terminator */
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (char *)malloc(dims[0] * sdim * sizeof(char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * sdim;
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, sdim);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", DATASET, i, rdata[i]);
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_stringatt.c b/HDF5Examples/C/H5T/16/h5ex_t_stringatt.c
new file mode 100644
index 0000000..7aa0af2
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_stringatt.c
@@ -0,0 +1,155 @@
+/************************************************************
+
+ This example shows how to read and write string datatypes
+ to an attribute. The program first writes strings to an
+ attribute with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_stringatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define SDIM 8
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t sdim;
+ char wdata[DIM0][SDIM] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings, therefore they do not need space
+ * for the null terminator in the file.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, SDIM - 1);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, SDIM);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the string data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute and string have the same name and rank, but can
+ * have any size. Therefore we must allocate a new array to read
+ * in data using malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get the datatype and its size.
+ */
+ filetype = H5Aget_type(attr);
+ sdim = H5Tget_size(filetype);
+ sdim++; /* Make room for null terminator */
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (char *)malloc(dims[0] * sdim * sizeof(char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * sdim;
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, sdim);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", ATTRIBUTE, i, rdata[i]);
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_vlen.c b/HDF5Examples/C/H5T/16/h5ex_t_vlen.c
new file mode 100644
index 0000000..ab0e178
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_vlen.c
@@ -0,0 +1,145 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ datatypes to a dataset. The program first writes two
+ variable-length integer arrays to a dataset then closes
+ the file. Next, it reopens the file, reads back the data,
+ and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlen.h5"
+#define DATASET "DS1"
+#define LEN0 3
+#define LEN1 12
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hvl_t wdata[2], /* Array of vlen structures */
+ *rdata; /* Pointer to vlen structures */
+ hsize_t dims[1] = {2};
+ int *ptr, ndims, i, j;
+
+ /*
+ * Initialize variable-length data. wdata[0] is a countdown of
+ * length LEN0, wdata[1] is a Fibonacci sequence of length LEN1.
+ */
+ wdata[0].len = LEN0;
+ ptr = (int *)malloc(wdata[0].len * sizeof(int));
+ for (i = 0; i < wdata[0].len; i++)
+ ptr[i] = wdata[0].len - i; /* 3 2 1 */
+ wdata[0].p = (void *)ptr;
+
+ wdata[1].len = LEN1;
+ ptr = (int *)malloc(wdata[1].len * sizeof(int));
+ ptr[0] = 1;
+ ptr[1] = 1;
+ for (i = 2; i < wdata[1].len; i++)
+ ptr[i] = ptr[i - 1] + ptr[i - 2]; /* 1 1 2 3 5 8 etc. */
+ wdata[1].p = (void *)ptr;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length datatype for file and memory.
+ */
+ filetype = H5Tvlen_create(H5T_STD_I32LE);
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the variable-length data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources. Note the use of H5Dvlen_reclaim
+ * removes the need to manually free() the previously malloc'ed
+ * data.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, wdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get dataspace and allocate memory for array of vlen structures.
+ * This does not actually allocate memory for the vlen data, that
+ * will be done by the library.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hvl_t *)malloc(dims[0] * sizeof(hvl_t));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the variable-length data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%u]:\n {", DATASET, i);
+ ptr = rdata[i].p;
+ for (j = 0; j < rdata[i].len; j++) {
+ printf(" %d", ptr[j]);
+ if ((j + 1) < rdata[i].len)
+ printf(",");
+ }
+ printf(" }\n");
+ }
+
+ /*
+ * Close and release resources. Note we must still free the
+ * top-level pointer "rdata", as H5Dvlen_reclaim only frees the
+ * actual variable-length data, and not the structures themselves.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_vlenatt.c b/HDF5Examples/C/H5T/16/h5ex_t_vlenatt.c
new file mode 100644
index 0000000..084596c
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_vlenatt.c
@@ -0,0 +1,156 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ datatypes to an attribute. The program first writes two
+ variable-length integer arrays to the attribute then
+ closes the file. Next, it reopens the file, reads back
+ the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlenatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define LEN0 3
+#define LEN1 12
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hvl_t wdata[2], /* Array of vlen structures */
+ *rdata; /* Pointer to vlen structures */
+ hsize_t dims[1] = {2};
+ int *ptr, ndims, i, j;
+
+ /*
+ * Initialize variable-length data. wdata[0] is a countdown of
+ * length LEN0, wdata[1] is a Fibonacci sequence of length LEN1.
+ */
+ wdata[0].len = LEN0;
+ ptr = (int *)malloc(wdata[0].len * sizeof(int));
+ for (i = 0; i < wdata[0].len; i++)
+ ptr[i] = wdata[0].len - i; /* 3 2 1 */
+ wdata[0].p = (void *)ptr;
+
+ wdata[1].len = LEN1;
+ ptr = (int *)malloc(wdata[1].len * sizeof(int));
+ ptr[0] = 1;
+ ptr[1] = 1;
+ for (i = 2; i < wdata[1].len; i++)
+ ptr[i] = ptr[i - 1] + ptr[i - 2]; /* 1 1 2 3 5 8 etc. */
+ wdata[1].p = (void *)ptr;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length datatype for file and memory.
+ */
+ filetype = H5Tvlen_create(H5T_STD_I32LE);
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the variable-length data to it
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata);
+
+ /*
+ * Close and release resources. Note the use of H5Dvlen_reclaim
+ * removes the need to manually free() the previously malloc'ed
+ * data.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, wdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get dataspace and allocate memory for array of vlen structures.
+ * This does not actually allocate memory for the vlen data, that
+ * will be done by the library.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hvl_t *)malloc(dims[0] * sizeof(hvl_t));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata);
+
+ /*
+ * Output the variable-length data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%u]:\n {", ATTRIBUTE, i);
+ ptr = rdata[i].p;
+ for (j = 0; j < rdata[i].len; j++) {
+ printf(" %d", ptr[j]);
+ if ((j + 1) < rdata[i].len)
+ printf(",");
+ }
+ printf(" }\n");
+ }
+
+ /*
+ * Close and release resources. Note we must still free the
+ * top-level pointer "rdata", as H5Dvlen_reclaim only frees the
+ * actual variable-length data, and not the structures themselves.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_vlstring.c b/HDF5Examples/C/H5T/16/h5ex_t_vlstring.c
new file mode 100644
index 0000000..f790424
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_vlstring.c
@@ -0,0 +1,126 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ string datatypes to a dataset. The program first writes
+ variable-length strings to a dataset with a dataspace of
+ DIM0, then closes the file. Next, it reopens the file,
+ reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlstring.h5"
+#define DATASET "DS1"
+#define DIM0 4
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ char *wdata[DIM0] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, H5T_VARIABLE);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the variable-length string data to
+ * it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+
+ /*
+ * Get the datatype.
+ */
+ filetype = H5Dget_type(dset);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", DATASET, i, rdata[i]);
+
+ /*
+ * Close and release resources. Note that H5Dvlen_reclaim works
+ * for variable-length strings as well as variable-length arrays.
+ * Also note that we must still free the array of pointers stored
+ * in rdata, as H5Tvlen_reclaim only frees the data these point to.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/16/h5ex_t_vlstringatt.c b/HDF5Examples/C/H5T/16/h5ex_t_vlstringatt.c
new file mode 100644
index 0000000..6ee3118
--- /dev/null
+++ b/HDF5Examples/C/H5T/16/h5ex_t_vlstringatt.c
@@ -0,0 +1,138 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ string datatypes to an attribute. The program first
+ writes variable-length strings to an attribute with a
+ dataspace of DIM0, then closes the file. Next, it reopens
+ the file, reads back the data, and outputs it to the
+ screen.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlstringatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ char *wdata[DIM0] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, H5T_VARIABLE);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Create dataset with a scalar dataspace.
+ */
+ space = H5Screate(H5S_SCALAR);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the variable-length string data
+ * to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET);
+ attr = H5Aopen_name(dset, ATTRIBUTE);
+
+ /*
+ * Get the datatype.
+ */
+ filetype = H5Aget_type(attr);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", ATTRIBUTE, i, rdata[i]);
+
+ /*
+ * Close and release resources. Note that H5Dvlen_reclaim works
+ * for variable-length strings as well as variable-length arrays.
+ * Also note that we must still free the array of pointers stored
+ * in rdata, as H5Tvlen_reclaim only frees the data these point to.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/CMakeLists.txt b/HDF5Examples/C/H5T/CMakeLists.txt
new file mode 100644
index 0000000..4673562
--- /dev/null
+++ b/HDF5Examples/C/H5T/CMakeLists.txt
@@ -0,0 +1,371 @@
+cmake_minimum_required (VERSION 3.12)
+project (HDF5Examples_C_H5T)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+include (C_sourcefiles.cmake)
+
+foreach (example_name ${common_examples})
+ if (${H5_LIBVER_DIR} EQUAL 16)
+ add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/16/${example_name}.c)
+ else ()
+ add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/${example_name}.c)
+ endif ()
+ target_compile_options(${EXAMPLE_VARNAME}_${example_name}
+ PRIVATE
+ "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_16_API}>:-DH5_USE_16_API>"
+ "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_18_API}>:-DH5_USE_18_API>"
+ "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_110_API}>:-DH5_USE_110_API>"
+ "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_112_API}>:-DH5_USE_112_API>"
+ "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_114_API}>:-DH5_USE_114_API>"
+ "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_116_API}>:-DH5_USE_116_API>"
+ )
+ if (H5_HAVE_PARALLEL)
+ target_include_directories (${EXAMPLE_VARNAME}_${example_name} PUBLIC ${MPI_C_INCLUDE_DIRS})
+ endif ()
+ target_link_libraries (${EXAMPLE_VARNAME}_${example_name} ${H5EX_HDF5_LINK_LIBS})
+ if (H5EX_BUILD_TESTING)
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.tst ${PROJECT_BINARY_DIR}/${example_name}.tst
+ )
+ endif ()
+endforeach ()
+
+#if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8")
+# foreach (example_name ${1_8_examples})
+# add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/${example_name}.c)
+# target_compile_options(${EXAMPLE_VARNAME}_${example_name}
+# PRIVATE
+# "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_16_API}>:-DH5_USE_16_API>"
+# "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_18_API}>:-DH5_USE_18_API>"
+# "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_110_API}>:-DH5_USE_110_API>"
+# "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_112_API}>:-DH5_USE_112_API>"
+# "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_114_API}>:-DH5_USE_114_API>"
+# "$<$<BOOL:${${EXAMPLE_VARNAME}_USE_116_API}>:-DH5_USE_116_API>"
+# )
+# if (H5_HAVE_PARALLEL)
+# target_include_directories (${EXAMPLE_VARNAME}_${example_name} PUBLIC ${MPI_C_INCLUDE_DIRS})
+# endif ()
+# target_link_libraries (${EXAMPLE_VARNAME}_${example_name} ${H5EX_HDF5_LINK_LIBS})
+# if (H5EX_BUILD_TESTING)
+# add_custom_command (
+# TARGET ${EXAMPLE_VARNAME}_${example_name}
+# POST_BUILD
+# COMMAND ${CMAKE_COMMAND}
+# ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.tst ${PROJECT_BINARY_DIR}/${example_name}.tst
+# )
+# endif ()
+# endforeach ()
+#endif ()
+#if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.10")
+# foreach (example_name ${1_10_examples})
+# if (H5EX_BUILD_TESTING)
+# add_custom_command (
+# TARGET ${EXAMPLE_VARNAME}_${example_name}
+# POST_BUILD
+# COMMAND ${CMAKE_COMMAND}
+# ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}.tst ${PROJECT_BINARY_DIR}/${example_name}.tst
+# )
+# endif ()
+# endforeach ()
+#endif ()
+#if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12")
+# foreach (example_name ${1_12_examples})
+# if (H5EX_BUILD_TESTING)
+# add_custom_command (
+# TARGET ${EXAMPLE_VARNAME}_${example_name}
+# POST_BUILD
+# COMMAND ${CMAKE_COMMAND}
+# ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.tst ${PROJECT_BINARY_DIR}/${example_name}.tst
+# )
+# endif ()
+# endforeach ()
+#endif ()
+#if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.14")
+# foreach (example_name ${1_14_examples})
+# if (H5EX_BUILD_TESTING)
+# add_custom_command (
+# TARGET ${EXAMPLE_VARNAME}_${example_name}
+# POST_BUILD
+# COMMAND ${CMAKE_COMMAND}
+# ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.tst ${PROJECT_BINARY_DIR}/${example_name}.tst
+# )
+# endif ()
+# endforeach ()
+#endif ()
+#if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.16")
+# foreach (example_name ${1_16_examples})
+# if (H5EX_BUILD_TESTING)
+# add_custom_command (
+# TARGET ${EXAMPLE_VARNAME}_${example_name}
+# POST_BUILD
+# COMMAND ${CMAKE_COMMAND}
+# ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/116/${example_name}.tst ${PROJECT_BINARY_DIR}/${example_name}.tst
+# )
+# endif ()
+# endforeach ()
+#endif ()
+
+if (HDF5_BUILD_TOOLS)
+ foreach (example_name ${common_examples})
+ if (NOT ${example_name} STREQUAL "h5ex_t_convert")
+ if (HDF5_VERSION_MAJOR VERSION_EQUAL "1.6")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
+ )
+ else ()
+ if (${example_name} STREQUAL "h5ex_t_vlen" OR ${example_name} STREQUAL "h5ex_t_vlenatt")
+ if (HDF5_VERSION_STRING VERSION_GREATER_EQUAL "1.14.3")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ elseif ((${example_name} STREQUAL "h5ex_t_objref" OR ${example_name} STREQUAL "h5ex_t_objrefatt") OR (${example_name} STREQUAL "h5ex_t_regref" OR ${example_name} STREQUAL "h5ex_t_regrefatt"))
+ if (${${EXAMPLE_VARNAME}_USE_16_API} OR ${${EXAMPLE_VARNAME}_USE_18_API} OR ${${EXAMPLE_VARNAME}_USE_110_API})
+ if (HDF5_VERSION_MAJOR VERSION_EQUAL "1.8")
+ if (HDF5_VERSION_STRING VERSION_LESS_EQUAL "1.8.21")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ elseif (HDF5_VERSION_MAJOR VERSION_EQUAL "1.10")
+ if (HDF5_VERSION_STRING VERSION_LESS_EQUAL "1.10.6")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/112/${example_name}.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ else ()
+ if (HDF5_VERSION_MAJOR VERSION_EQUAL "1.8")
+ if (HDF5_VERSION_STRING VERSION_LESS_EQUAL "1.8.21")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ elseif (HDF5_VERSION_MAJOR VERSION_EQUAL "1.10")
+ if (HDF5_VERSION_STRING VERSION_LESS_EQUAL "1.10.6")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${example_name}.ddl
+ )
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ endif ()
+ else ()
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl
+ )
+ endif ()
+ endif ()
+ endif ()
+ endforeach ()
+
+# foreach (example_name ${1_8_examples})
+ #if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8")
+ # add_custom_command (
+ # TARGET ${EXAMPLE_VARNAME}_${example_name}
+ # POST_BUILD
+ # COMMAND ${CMAKE_COMMAND}
+ # ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
+ # )
+ #endif ()
+ #if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.10")
+ # add_custom_command (
+ # TARGET ${EXAMPLE_VARNAME}_${example_name}
+ # POST_BUILD
+ # COMMAND ${CMAKE_COMMAND}
+ # ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
+ # )
+ #endif ()
+ #if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12")
+ # add_custom_command (
+ # TARGET ${EXAMPLE_VARNAME}_${example_name}
+ # POST_BUILD
+ # COMMAND ${CMAKE_COMMAND}
+ # ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
+ # )
+ #endif ()
+ #if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.14")
+ # add_custom_command (
+ # TARGET ${EXAMPLE_VARNAME}_${example_name}
+ # POST_BUILD
+ # COMMAND ${CMAKE_COMMAND}
+ # ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
+ # )
+ #endif ()
+ #if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.16")
+ # add_custom_command (
+ # TARGET ${EXAMPLE_VARNAME}_${example_name}
+ # POST_BUILD
+ # COMMAND ${CMAKE_COMMAND}
+ # ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/116/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
+ # )
+ #endif ()
+# endforeach ()
+# foreach (example_name ${1_10_examples})
+# endforeach ()
+# foreach (example_name ${1_12_examples})
+# endforeach ()
+# foreach (example_name ${1_14_examples})
+# endforeach ()
+# foreach (example_name ${1_16_examples})
+# endforeach ()
+endif ()
+
+if (H5EX_BUILD_TESTING)
+ macro (ADD_H5_TEST testname)
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_${testname}-clearall
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${testname}.h5
+ )
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${EXAMPLE_VARNAME}_${testname}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_REFERENCE=${testname}.tst"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_LIB_DIRECTORY}"
+ -P "${${EXAMPLE_PACKAGE_NAME}_RESOURCES_DIR}/runTest.cmake"
+ )
+ set_tests_properties (${EXAMPLE_VARNAME}_${testname} PROPERTIES DEPENDS ${EXAMPLE_VARNAME}_${testname}-clearall)
+ if (HDF5_BUILD_TOOLS)
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_H5DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=${H5EX_HDF5_DUMP_EXECUTABLE}"
+ -D "TEST_ARGS:STRING=${ARGN};${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testname}.ddl.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=${testname}.ddl"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_LIB_DIRECTORY}"
+ -P "${${EXAMPLE_PACKAGE_NAME}_RESOURCES_DIR}/runTest.cmake"
+ )
+ set_tests_properties (${EXAMPLE_VARNAME}_H5DUMP-${testname} PROPERTIES DEPENDS ${EXAMPLE_VARNAME}_${testname})
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_CMP_TEST testname)
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_${testname}-clearall
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${testname}.h5
+ )
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${EXAMPLE_VARNAME}_${testname}>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_REFERENCE=${testname}.tst"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_LIB_DIRECTORY}"
+ -P "${${EXAMPLE_PACKAGE_NAME}_RESOURCES_DIR}/runTest.cmake"
+ )
+ set_tests_properties (${EXAMPLE_VARNAME}_${testname} PROPERTIES DEPENDS ${EXAMPLE_VARNAME}_${testname}-clearall)
+ endmacro ()
+
+ foreach (example_name ${common_examples})
+ if (${example_name} STREQUAL "h5ex_t_convert")
+ ADD_H5_CMP_TEST (${example_name})
+ elseif (${example_name} STREQUAL "h5ex_t_cpxcmpd" OR ${example_name} STREQUAL "h5ex_t_cpxcmpdatt")
+ ADD_H5_TEST (${example_name} -n)
+ else ()
+ ADD_H5_TEST (${example_name})
+ endif ()
+ endforeach ()
+endif ()
diff --git a/HDF5Examples/C/H5T/C_sourcefiles.cmake b/HDF5Examples/C/H5T/C_sourcefiles.cmake
new file mode 100644
index 0000000..8c51b33
--- /dev/null
+++ b/HDF5Examples/C/H5T/C_sourcefiles.cmake
@@ -0,0 +1,33 @@
+#-----------------------------------------------------------------------------
+# Define Sources, one file per application
+#-----------------------------------------------------------------------------
+set (common_examples
+ h5ex_t_array
+ h5ex_t_arrayatt
+ h5ex_t_bit
+ h5ex_t_bitatt
+ h5ex_t_cmpd
+ h5ex_t_cmpdatt
+ h5ex_t_enum
+ h5ex_t_enumatt
+ h5ex_t_float
+ h5ex_t_floatatt
+ h5ex_t_int
+ h5ex_t_intatt
+ h5ex_t_objref
+ h5ex_t_objrefatt
+ h5ex_t_opaque
+ h5ex_t_opaqueatt
+ h5ex_t_regref
+ h5ex_t_regrefatt
+ h5ex_t_string
+ h5ex_t_stringatt
+ h5ex_t_vlen
+ h5ex_t_vlenatt
+ h5ex_t_vlstring
+ h5ex_t_vlstringatt
+ h5ex_t_cpxcmpd
+ h5ex_t_cpxcmpdatt
+ h5ex_t_commit
+ h5ex_t_convert
+)
diff --git a/HDF5Examples/C/H5T/Makefile.am b/HDF5Examples/C/H5T/Makefile.am
new file mode 100644
index 0000000..a4f4be5
--- /dev/null
+++ b/HDF5Examples/C/H5T/Makefile.am
@@ -0,0 +1,48 @@
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+##
+
+noinst_PROGRAMS = h5ex_t_int h5ex_t_intatt h5ex_t_float h5ex_t_floatatt \
+h5ex_t_enum h5ex_t_enumatt h5ex_t_bit h5ex_t_bitatt h5ex_t_opaque \
+h5ex_t_opaqueatt h5ex_t_array h5ex_t_arrayatt h5ex_t_vlen h5ex_t_vlenatt \
+h5ex_t_string h5ex_t_stringatt h5ex_t_vlstring h5ex_t_vlstringatt h5ex_t_cmpd \
+h5ex_t_cmpdatt h5ex_t_cpxcmpd h5ex_t_cpxcmpdatt h5ex_t_objref h5ex_t_objrefatt \
+h5ex_t_regref h5ex_t_regrefatt h5ex_t_commit h5ex_t_convert
+
+EXTRA_DIST = tfiles/h5ex_t_int.tst tfiles/h5ex_t_intatt.tst tfiles/h5ex_t_float.tst \
+tfiles/h5ex_t_floatatt.tst tfiles/h5ex_t_enum.tst tfiles/h5ex_t_enumatt.tst tfiles/h5ex_t_bit.tst \
+tfiles/h5ex_t_bitatt.tst tfiles/h5ex_t_opaque.tst tfiles/h5ex_t_opaqueatt.tst tfiles/h5ex_t_array.tst \
+tfiles/h5ex_t_arrayatt.tst tfiles/h5ex_t_vlen.tst tfiles/h5ex_t_vlenatt.tst tfiles/h5ex_t_string.tst \
+tfiles/h5ex_t_stringatt.tst tfiles/h5ex_t_vlstring.tst tfiles/h5ex_t_vlstringatt.tst \
+tfiles/h5ex_t_cmpd.tst tfiles/h5ex_t_cmpdatt.tst tfiles/h5ex_t_cpxcmpd.tst \
+tfiles/h5ex_t_cpxcmpdatt.tst tfiles/h5ex_t_objref.tst tfiles/h5ex_t_objrefatt.tst \
+tfiles/h5ex_t_regref.tst tfiles/h5ex_t_regrefatt.tst tfiles/h5ex_t_commit.tst \
+tfiles/h5ex_t_convert.tst \
+tfiles/h5ex_t_int.ddl tfiles/h5ex_t_intatt.ddl tfiles/h5ex_t_float.ddl \
+tfiles/h5ex_t_floatatt.ddl tfiles/h5ex_t_enum.ddl tfiles/h5ex_t_enumatt.ddl tfiles/h5ex_t_bit.ddl \
+tfiles/h5ex_t_bitatt.ddl tfiles/h5ex_t_opaque.ddl tfiles/h5ex_t_opaqueatt.ddl tfiles/h5ex_t_array.ddl \
+tfiles/h5ex_t_arrayatt.ddl tfiles/h5ex_t_vlen.ddl tfiles/h5ex_t_vlenatt.ddl tfiles/h5ex_t_string.ddl \
+tfiles/h5ex_t_stringatt.ddl tfiles/h5ex_t_vlstring.ddl tfiles/h5ex_t_vlstringatt.ddl \
+tfiles/h5ex_t_cmpd.ddl tfiles/h5ex_t_cmpdatt.ddl tfiles/h5ex_t_cpxcmpd.ddl \
+tfiles/h5ex_t_cpxcmpdatt.ddl tfiles/h5ex_t_objref.ddl tfiles/h5ex_t_objrefatt.ddl \
+tfiles/h5ex_t_regref.ddl tfiles/h5ex_t_regrefatt.ddl tfiles/h5ex_t_commit.ddl \
+tfiles/h5ex_t_convert.ddl test.sh
+
+
+TESTS = test.sh
+
+CLEANFILES = Makefile test.sh
diff --git a/HDF5Examples/C/H5T/h5ex_t_array.c b/HDF5Examples/C/H5T/h5ex_t_array.c
new file mode 100644
index 0000000..b63e4e0
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_array.c
@@ -0,0 +1,170 @@
+/************************************************************
+
+ This example shows how to read and write array datatypes
+ to a dataset. The program first writes integers arrays of
+ dimension ADIM0xADIM1 to a dataset with a dataspace of
+ DIM0, then closes the file. Next, it reopens the file,
+ reads back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_array.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define ADIM0 3
+#define ADIM1 5
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID; /* File Handle */
+ hid_t space = H5I_INVALID_HID; /* Dataspace Handle */
+ hid_t dset = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t filetype = H5I_INVALID_HID;
+ hid_t memtype = H5I_INVALID_HID;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ hsize_t adims[2] = {ADIM0, ADIM1};
+ int wdata[DIM0][ADIM0][ADIM1]; /* Write buffer */
+ int ***rdata = NULL; /* Read buffer */
+ int ndims;
+ hsize_t i, j, k;
+
+ /*
+ * Initialize data. i is the element in the dataspace, j and k the
+ * elements within the array datatype.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < ADIM0; j++)
+ for (k = 0; k < ADIM1; k++)
+ wdata[i][j][k] = i * j - j * k + i * k;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create array datatypes for file and memory.
+ */
+ filetype = H5Tarray_create(H5T_STD_I64LE, 2, adims);
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the array data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0][0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset and array have the same name and rank, but can have
+ * any size. Therefore we must allocate a new array to read in
+ * data using malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get the datatype and its dimensions.
+ */
+ filetype = H5Dget_type(dset);
+ ndims = H5Tget_array_dims(filetype, adims);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * three dimensional dataset when the array datatype is included so
+ * the dynamic allocation must be done in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to two-dimensional arrays (the
+ * elements of the dataset.
+ */
+ rdata = (int ***)malloc(dims[0] * sizeof(int **));
+
+ /*
+ * Allocate two dimensional array of pointers to rows in the data
+ * elements.
+ */
+ rdata[0] = (int **)malloc(dims[0] * adims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0][0] = (int *)malloc(dims[0] * adims[0] * adims[1] * sizeof(int));
+
+ /*
+ * Set the members of the pointer arrays allocated above to point
+ * to the correct locations in their respective arrays.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ rdata[i] = rdata[0] + i * adims[0];
+ for (j = 0; j < adims[0]; j++)
+ rdata[i][j] = rdata[0][0] + (adims[0] * adims[1] * i) + (adims[1] * j);
+ }
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0][0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n", DATASET, i);
+ for (j = 0; j < adims[0]; j++) {
+ printf(" [");
+ for (k = 0; k < adims[1]; k++)
+ printf(" %3d", rdata[i][j][k]);
+ printf("]\n");
+ }
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0][0]);
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_arrayatt.c b/HDF5Examples/C/H5T/h5ex_t_arrayatt.c
new file mode 100644
index 0000000..a89f2b2
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_arrayatt.c
@@ -0,0 +1,182 @@
+/************************************************************
+
+ This example shows how to read and write array datatypes
+ to an attribute. The program first writes integers arrays
+ of dimension ADIM0xADIM1 to an attribute with a dataspace
+ of DIM0, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_arrayatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define ADIM0 3
+#define ADIM1 5
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID; /* File Handle */
+ hid_t space = H5I_INVALID_HID; /* Dataspace Handle */
+ hid_t dset = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t filetype = H5I_INVALID_HID;
+ hid_t memtype = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID; /* Attribute Handle */
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ hsize_t adims[2] = {ADIM0, ADIM1};
+ int wdata[DIM0][ADIM0][ADIM1]; /* Write buffer */
+ int ***rdata = NULL; /* Read buffer */
+ int ndims;
+ hsize_t i, j, k;
+
+ /*
+ * Initialize data. i is the element in the dataspace, j and k the
+ * elements within the array datatype.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < ADIM0; j++)
+ for (k = 0; k < ADIM1; k++)
+ wdata[i][j][k] = i * j - j * k + i * k;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create array datatypes for file and memory.
+ */
+ filetype = H5Tarray_create(H5T_STD_I64LE, 2, adims);
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the array data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata[0][0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute and array have the same name and rank, but can
+ * have any size. Therefore we must allocate a new array to read
+ * in data using malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get the datatype and its dimensions.
+ */
+ filetype = H5Aget_type(attr);
+ ndims = H5Tget_array_dims(filetype, adims);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * three dimensional attribute when the array datatype is included
+ * so the dynamic allocation must be done in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to two-dimensional arrays (the
+ * elements of the attribute.
+ */
+ rdata = (int ***)malloc(dims[0] * sizeof(int **));
+
+ /*
+ * Allocate two dimensional array of pointers to rows in the data
+ * elements.
+ */
+ rdata[0] = (int **)malloc(dims[0] * adims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0][0] = (int *)malloc(dims[0] * adims[0] * adims[1] * sizeof(int));
+
+ /*
+ * Set the members of the pointer arrays allocated above to point
+ * to the correct locations in their respective arrays.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ rdata[i] = rdata[0] + i * adims[0];
+ for (j = 0; j < adims[0]; j++)
+ rdata[i][j] = rdata[0][0] + (adims[0] * adims[1] * i) + (adims[1] * j);
+ }
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tarray_create(H5T_NATIVE_INT, 2, adims);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata[0][0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n", ATTRIBUTE, i);
+ for (j = 0; j < adims[0]; j++) {
+ printf(" [");
+ for (k = 0; k < adims[1]; k++)
+ printf(" %3d", rdata[i][j][k]);
+ printf("]\n");
+ }
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0][0]);
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_bit.c b/HDF5Examples/C/H5T/h5ex_t_bit.c
new file mode 100644
index 0000000..015c7e8
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_bit.c
@@ -0,0 +1,136 @@
+/************************************************************
+
+ This example shows how to read and write bitfield
+ datatypes to a dataset. The program first writes bit
+ fields to a dataset with a dataspace of DIM0xDIM1, then
+ closes the file. Next, it reopens the file, reads back
+ the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_bit.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ unsigned char wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, A, B, C, D;
+ hsize_t i, j;
+
+ /*
+ * Initialize data. We will manually pack 4 2-bit integers into
+ * each unsigned char data element.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++) {
+ wdata[i][j] = 0;
+ wdata[i][j] |= (i * j - j) & 0x03; /* Field "A" */
+ wdata[i][j] |= (i & 0x03) << 2; /* Field "B" */
+ wdata[i][j] |= (j & 0x03) << 4; /* Field "C" */
+ wdata[i][j] |= ((i + j) & 0x03) << 6; /* Field "D" */
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the bitfield data to it.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_STD_B8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_B8, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (unsigned char **)malloc(dims[0] * sizeof(unsigned char *));
+
+ /*
+ * Allocate space for bitfield data.
+ */
+ rdata[0] = (unsigned char *)malloc(dims[0] * dims[1] * sizeof(unsigned char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_NATIVE_B8, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+ A = rdata[i][j] & 0x03; /* Retrieve field "A" */
+ B = (rdata[i][j] >> 2) & 0x03; /* Retrieve field "B" */
+ C = (rdata[i][j] >> 4) & 0x03; /* Retrieve field "C" */
+ D = (rdata[i][j] >> 6) & 0x03; /* Retrieve field "D" */
+ printf(" {%d, %d, %d, %d}", A, B, C, D);
+ }
+ printf(" ]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_bitatt.c b/HDF5Examples/C/H5T/h5ex_t_bitatt.c
new file mode 100644
index 0000000..e4f81c3
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_bitatt.c
@@ -0,0 +1,147 @@
+/************************************************************
+
+ This example shows how to read and write bitfield
+ datatypes to an attribute. The program first writes bit
+ fields to an attribute with a dataspace of DIM0xDIM1, then
+ closes the file. Next, it reopens the file, reads back
+ the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_bitatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ unsigned char wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, A, B, C, D;
+ hsize_t i, j;
+
+ /*
+ * Initialize data. We will manually pack 4 2-bit integers into
+ * each unsigned char data element.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++) {
+ wdata[i][j] = 0;
+ wdata[i][j] |= (i * j - j) & 0x03; /* Field "A" */
+ wdata[i][j] |= (i & 0x03) << 2; /* Field "B" */
+ wdata[i][j] |= (j & 0x03) << 4; /* Field "C" */
+ wdata[i][j] |= ((i + j) & 0x03) << 6; /* Field "D" */
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the bitfield data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_STD_B8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_NATIVE_B8, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (unsigned char **)malloc(dims[0] * sizeof(unsigned char *));
+
+ /*
+ * Allocate space for bitfield data.
+ */
+ rdata[0] = (unsigned char *)malloc(dims[0] * dims[1] * sizeof(unsigned char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_NATIVE_B8, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+ A = rdata[i][j] & 0x03; /* Retrieve field "A" */
+ B = (rdata[i][j] >> 2) & 0x03; /* Retrieve field "B" */
+ C = (rdata[i][j] >> 4) & 0x03; /* Retrieve field "C" */
+ D = (rdata[i][j] >> 6) & 0x03; /* Retrieve field "D" */
+ printf(" {%d, %d, %d, %d}", A, B, C, D);
+ }
+ printf(" ]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_cmpd.c b/HDF5Examples/C/H5T/h5ex_t_cmpd.c
new file mode 100644
index 0000000..739d061
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_cmpd.c
@@ -0,0 +1,160 @@
+/************************************************************
+
+ This example shows how to read and write compound
+ datatypes to a dataset. The program first writes
+ compound structures to a dataset with a dataspace of DIM0,
+ then closes the file. Next, it reopens the file, reads
+ back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cmpd.h5"
+#define DATASET "DS1"
+#define DIM0 4
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Compound type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, strtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ sensor_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ int ndims;
+ hsize_t i;
+
+ /*
+ * Initialize data.
+ */
+ wdata[0].serial_no = 1153;
+ wdata[0].location = "Exterior (static)";
+ wdata[0].temperature = 53.23;
+ wdata[0].pressure = 24.57;
+ wdata[1].serial_no = 1184;
+ wdata[1].location = "Intake";
+ wdata[1].temperature = 55.12;
+ wdata[1].pressure = 22.95;
+ wdata[2].serial_no = 1027;
+ wdata[2].location = "Intake manifold";
+ wdata[2].temperature = 103.55;
+ wdata[2].pressure = 31.23;
+ wdata[3].serial_no = 1313;
+ wdata[3].location = "Exhaust manifold";
+ wdata[3].temperature = 1252.89;
+ wdata[3].pressure = 84.11;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype for memory.
+ */
+ memtype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(memtype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(memtype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(memtype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(memtype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the compound datatype for the file. Because the standard
+ * types we are using for the file may have different sizes than
+ * the corresponding native types, we must manually calculate the
+ * offset of each member.
+ */
+ filetype = H5Tcreate(H5T_COMPOUND, 8 + sizeof(hvl_t) + 8 + 8);
+ status = H5Tinsert(filetype, "Serial number", 0, H5T_STD_I64BE);
+ status = H5Tinsert(filetype, "Location", 8, strtype);
+ status = H5Tinsert(filetype, "Temperature (F)", 8 + sizeof(hvl_t), H5T_IEEE_F64BE);
+ status = H5Tinsert(filetype, "Pressure (inHg)", 8 + sizeof(hvl_t) + 8, H5T_IEEE_F64BE);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the compound data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (sensor_t *)malloc(dims[0] * sizeof(sensor_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n", DATASET, i);
+ printf("Serial number : %d\n", rdata[i].serial_no);
+ printf("Location : %s\n", rdata[i].location);
+ printf("Temperature (F) : %f\n", rdata[i].temperature);
+ printf("Pressure (inHg) : %f\n\n", rdata[i].pressure);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (strings in this
+ * case).
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Tclose(strtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c b/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c
new file mode 100644
index 0000000..246537b
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c
@@ -0,0 +1,171 @@
+/************************************************************
+
+ This example shows how to read and write compound
+ datatypes to an attribute. The program first writes
+ compound structures to an attribute with a dataspace of
+ DIM0, then closes the file. Next, it reopens the file,
+ reads back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cmpdatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Compound type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, strtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ sensor_t wdata[DIM0], /* Write buffer */
+ *rdata; /* Read buffer */
+ int ndims;
+ hsize_t i;
+
+ /*
+ * Initialize data.
+ */
+ wdata[0].serial_no = 1153;
+ wdata[0].location = "Exterior (static)";
+ wdata[0].temperature = 53.23;
+ wdata[0].pressure = 24.57;
+ wdata[1].serial_no = 1184;
+ wdata[1].location = "Intake";
+ wdata[1].temperature = 55.12;
+ wdata[1].pressure = 22.95;
+ wdata[2].serial_no = 1027;
+ wdata[2].location = "Intake manifold";
+ wdata[2].temperature = 103.55;
+ wdata[2].pressure = 31.23;
+ wdata[3].serial_no = 1313;
+ wdata[3].location = "Exhaust manifold";
+ wdata[3].temperature = 1252.89;
+ wdata[3].pressure = 84.11;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype for memory.
+ */
+ memtype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(memtype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(memtype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(memtype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(memtype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the compound datatype for the file. Because the standard
+ * types we are using for the file may have different sizes than
+ * the corresponding native types, we must manually calculate the
+ * offset of each member.
+ */
+ filetype = H5Tcreate(H5T_COMPOUND, 8 + sizeof(hvl_t) + 8 + 8);
+ status = H5Tinsert(filetype, "Serial number", 0, H5T_STD_I64BE);
+ status = H5Tinsert(filetype, "Location", 8, strtype);
+ status = H5Tinsert(filetype, "Temperature (F)", 8 + sizeof(hvl_t), H5T_IEEE_F64BE);
+ status = H5Tinsert(filetype, "Pressure (inHg)", 8 + sizeof(hvl_t) + 8, H5T_IEEE_F64BE);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the compound data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (sensor_t *)malloc(dims[0] * sizeof(sensor_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n", ATTRIBUTE, i);
+ printf("Serial number : %d\n", rdata[i].serial_no);
+ printf("Location : %s\n", rdata[i].location);
+ printf("Temperature (F) : %f\n", rdata[i].temperature);
+ printf("Pressure (inHg) : %f\n\n", rdata[i].pressure);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (strings in this
+ * case).
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Tclose(strtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_commit.c b/HDF5Examples/C/H5T/h5ex_t_commit.c
new file mode 100644
index 0000000..b120656
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_commit.c
@@ -0,0 +1,116 @@
+/************************************************************
+
+ This example shows how to commit a named datatype to a
+ file, and read back that datatype. The program first
+ defines a compound datatype, commits it to a file, then
+ closes the file. Next, it reopens the file, opens the
+ datatype, and outputs the names of its fields to the
+ screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_commit.h5"
+#define DATATYPE "Sensor_Type"
+
+int
+main(void)
+{
+ hid_t file, filetype, strtype;
+ /* Handles */
+ herr_t status;
+ H5T_class_t typeclass;
+ char *name;
+ int nmembs, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype. Because the standard types we are
+ * using may have different sizes than the corresponding native
+ * types, we must manually calculate the offset of each member.
+ */
+ filetype = H5Tcreate(H5T_COMPOUND, 8 + sizeof(char *) + 8 + 8);
+ status = H5Tinsert(filetype, "Serial number", 0, H5T_STD_I64BE);
+ status = H5Tinsert(filetype, "Location", 8, strtype);
+ status = H5Tinsert(filetype, "Temperature (F)", 8 + sizeof(char *), H5T_IEEE_F64BE);
+ status = H5Tinsert(filetype, "Pressure (inHg)", 8 + sizeof(char *) + 8, H5T_IEEE_F64BE);
+
+ /*
+ * Commit the compound datatype to the file, creating a named
+ * datatype.
+ */
+ status = H5Tcommit(file, DATATYPE, filetype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Tclose(filetype);
+ status = H5Tclose(strtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example.
+ */
+
+ /*
+ * Open file.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Open the named datatype.
+ */
+ filetype = H5Topen(file, DATATYPE, H5P_DEFAULT);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("Named datatype: %s:\n", DATATYPE);
+ /*
+ * Get datatype class. If it isn't compound, we won't print
+ * anything.
+ */
+ typeclass = H5Tget_class(filetype);
+ if (typeclass == H5T_COMPOUND) {
+ printf(" Class: H5T_COMPOUND\n");
+ nmembs = H5Tget_nmembers(filetype);
+ /*
+ * Iterate over compound datatype members.
+ */
+ for (i = 0; i < nmembs; i++) {
+ /*
+ * Get the member name and print it. Note that
+ * H5Tget_member_name allocates space for the string in
+ * name, so we must release it after use.
+ */
+ name = H5Tget_member_name(filetype, i);
+ printf(" %s\n", name);
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ H5free_memory(name);
+#else
+ free(name);
+#endif
+ }
+ }
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_convert.c b/HDF5Examples/C/H5T/h5ex_t_convert.c
new file mode 100644
index 0000000..b6f46b6
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_convert.c
@@ -0,0 +1,143 @@
+/************************************************************
+
+ This example shows how to convert between different
+ datatypes in memory. The program converts DIM0 elements
+ of compound type sourcetype to desttype, then outputs the
+ converted data to the screen. A background buffer is used
+ to fill in the elements of desttype that are not in
+ sourcetype.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define DIM0 4
+
+typedef struct {
+ double temperature;
+ double pressure;
+} reading_t; /* Source type */
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Destination type */
+
+int
+main(void)
+{
+ hid_t sourcetype, desttype, strtype, space;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ reading_t *reading; /* Conversion buffer */
+ sensor_t *sensor, /* Conversion buffer */
+ bkgrd[DIM0]; /* Background buffer */
+ hsize_t i;
+
+ /*
+ * Allocate memory for conversion buffer. We will allocate space
+ * for it to hold DIM0 elements of the destination type, as the
+ * type conversion is performed in place. Of course, if the
+ * destination type were smaller than the source type, we would
+ * allocate space to hold DIM0 elements of the source type.
+ */
+ reading = (reading_t *)malloc(DIM0 * sizeof(sensor_t));
+
+ /*
+ * Assign the allocated space to a pointer of the destination type,
+ * to allow the buffer to be accessed correctly after the
+ * conversion has taken place.
+ */
+ sensor = (sensor_t *)reading;
+
+ /*
+ * Initialize data.
+ */
+ bkgrd[0].serial_no = 1153;
+ bkgrd[0].location = "Exterior (static)";
+ bkgrd[0].temperature = 53.23;
+ bkgrd[0].pressure = 24.57;
+ bkgrd[1].serial_no = 1184;
+ bkgrd[1].location = "Intake";
+ bkgrd[1].temperature = 55.12;
+ bkgrd[1].pressure = 22.95;
+ bkgrd[2].serial_no = 1027;
+ bkgrd[2].location = "Intake manifold";
+ bkgrd[2].temperature = 103.55;
+ bkgrd[2].pressure = 31.23;
+ bkgrd[3].serial_no = 1313;
+ bkgrd[3].location = "Exhaust manifold";
+ bkgrd[3].temperature = 1252.89;
+ bkgrd[3].pressure = 84.11;
+
+ reading[0].temperature = 54.84;
+ reading[0].pressure = 24.76;
+ reading[1].temperature = 56.63;
+ reading[1].pressure = 23.10;
+ reading[2].temperature = 102.69;
+ reading[2].pressure = 30.97;
+ reading[3].temperature = 1238.27;
+ reading[3].pressure = 82.15;
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the compound datatype for memory.
+ */
+ sourcetype = H5Tcreate(H5T_COMPOUND, sizeof(reading_t));
+ status = H5Tinsert(sourcetype, "Temperature (F)", HOFFSET(reading_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(sourcetype, "Pressure (inHg)", HOFFSET(reading_t, pressure), H5T_NATIVE_DOUBLE);
+
+ desttype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(desttype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(desttype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(desttype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(desttype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Convert the buffer in reading from sourcetype to desttype.
+ * After this conversion we will use sensor to access the buffer,
+ * as the buffer now matches its type.
+ */
+ status = H5Tconvert(sourcetype, desttype, DIM0, reading, bkgrd, H5P_DEFAULT);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < DIM0; i++) {
+ printf("sensor[%d]:\n", i);
+ printf("Serial number : %d\n", sensor[i].serial_no);
+ printf("Location : %s\n", sensor[i].location);
+ printf("Temperature (F) : %f\n", sensor[i].temperature);
+ printf("Pressure (inHg) : %f\n\n", sensor[i].pressure);
+ }
+
+ /*
+ * Close and release resources. In this case H5Tconvert preserves
+ * the memory locations of the variable-length strings in
+ * "location", so we do not need to free those strings as they were
+ * initialized as string constants.
+ */
+ free(sensor);
+ status = H5Sclose(space);
+ status = H5Tclose(sourcetype);
+ status = H5Tclose(desttype);
+ status = H5Tclose(strtype);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c b/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c
new file mode 100644
index 0000000..8506c08
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c
@@ -0,0 +1,319 @@
+/************************************************************
+
+ This example shows how to read and write a complex
+ compound datatype to a dataset. The program first writes
+ complex compound structures to a dataset with a dataspace
+ of DIM0, then closes the file. Next, it reopens the file,
+ reads back selected fields in the structure, and outputs
+ them to the screen.
+
+ Unlike the other datatype examples, in this example we
+ save to the file using native datatypes to simplify the
+ type definitions here. To save using standard types you
+ must manually calculate the sizes and offsets of compound
+ types as shown in h5ex_t_cmpd.c, and convert enumerated
+ values as shown in h5ex_t_enum.c.
+
+ The datatype defined here consists of a compound
+ containing a variable-length list of compound types, as
+ well as a variable-length string, enumeration, double
+ array, object reference and region reference. The nested
+ compound type contains an int, variable-length string and
+ two doubles.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cpxcmpd.h5"
+#define DATASET "DS1"
+#define DIM0 2
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Nested compound type */
+
+typedef enum { RED, GREEN, BLUE } color_t; /* Enumerated type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+ color_t color;
+ double location[3];
+ hobj_ref_t group;
+ hdset_reg_ref_t surveyed_areas;
+} vehicle_t; /* Main compound type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+} rvehicle_t; /* Read type */
+
+int
+main(void)
+{
+ hid_t file, vehicletype, colortype, sensortype, sensorstype, loctype, strtype, rvehicletype, rsensortype,
+ rsensorstype, space, dset, group;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, adims[1] = {3}, adims2[2] = {32, 32}, start[2] = {8, 26}, count[2] = {4, 3},
+ coords[3][2] = {{3, 2}, {3, 3}, {4, 4}};
+ vehicle_t wdata[2]; /* Write buffer */
+ rvehicle_t *rdata; /* Read buffer */
+ color_t val;
+ sensor_t *ptr;
+ double wdata2[32][32];
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset to use for region references.
+ */
+ for (i = 0; i < 32; i++)
+ for (j = 0; j < 32; j++)
+ wdata2[i][j] = 70. + 0.1 * (i - 16.) + 0.1 * (j - 16.);
+ space = H5Screate_simple(2, adims2, NULL);
+ dset = H5Dcreate(file, "Ambient_Temperature", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2[0]);
+ status = H5Dclose(dset);
+
+ /*
+ * Create groups to use for object references.
+ */
+ group = H5Gcreate(file, "Land_Vehicles", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(group);
+ group = H5Gcreate(file, "Air_Vehicles", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(group);
+
+ /*
+ * Initialize variable-length compound in the first data element.
+ */
+ wdata[0].sensors.len = 4;
+ ptr = (sensor_t *)malloc(wdata[0].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 1153;
+ ptr[0].location = "Exterior (static)";
+ ptr[0].temperature = 53.23;
+ ptr[0].pressure = 24.57;
+ ptr[1].serial_no = 1184;
+ ptr[1].location = "Intake";
+ ptr[1].temperature = 55.12;
+ ptr[1].pressure = 22.95;
+ ptr[2].serial_no = 1027;
+ ptr[2].location = "Intake manifold";
+ ptr[2].temperature = 103.55;
+ ptr[2].pressure = 31.23;
+ ptr[3].serial_no = 1313;
+ ptr[3].location = "Exhaust manifold";
+ ptr[3].temperature = 1252.89;
+ ptr[3].pressure = 84.11;
+ wdata[0].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the first data element.
+ */
+ wdata[0].name = "Airplane";
+ wdata[0].color = GREEN;
+ wdata[0].location[0] = -103234.21;
+ wdata[0].location[1] = 422638.78;
+ wdata[0].location[2] = 5996.43;
+ status = H5Rcreate(&wdata[0].group, file, "Air_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 3, coords[0]);
+ status = H5Rcreate(&wdata[0].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ /*
+ * Initialize variable-length compound in the second data element.
+ */
+ wdata[1].sensors.len = 1;
+ ptr = (sensor_t *)malloc(wdata[1].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 3244;
+ ptr[0].location = "Roof";
+ ptr[0].temperature = 83.82;
+ ptr[0].pressure = 29.92;
+ wdata[1].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the second data element.
+ */
+ wdata[1].name = "Automobile";
+ wdata[1].color = RED;
+ wdata[1].location[0] = 326734.36;
+ wdata[1].location[1] = 221568.23;
+ wdata[1].location[2] = 432.36;
+ status = H5Rcreate(&wdata[1].group, file, "Land_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Rcreate(&wdata[1].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ status = H5Sclose(space);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype.
+ */
+ sensortype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(sensortype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(sensortype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(sensortype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(sensortype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the variable-length datatype.
+ */
+ sensorstype = H5Tvlen_create(sensortype);
+
+ /*
+ * Create the enumerated datatype.
+ */
+ colortype = H5Tenum_create(H5T_NATIVE_INT);
+ val = (color_t)RED;
+ status = H5Tenum_insert(colortype, "Red", &val);
+ val = (color_t)GREEN;
+ status = H5Tenum_insert(colortype, "Green", &val);
+ val = (color_t)BLUE;
+ status = H5Tenum_insert(colortype, "Blue", &val);
+
+ /*
+ * Create the array datatype.
+ */
+ loctype = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, adims);
+
+ /*
+ * Create the main compound datatype.
+ */
+ vehicletype = H5Tcreate(H5T_COMPOUND, sizeof(vehicle_t));
+ status = H5Tinsert(vehicletype, "Sensors", HOFFSET(vehicle_t, sensors), sensorstype);
+ status = H5Tinsert(vehicletype, "Name", HOFFSET(vehicle_t, name), strtype);
+ status = H5Tinsert(vehicletype, "Color", HOFFSET(vehicle_t, color), colortype);
+ status = H5Tinsert(vehicletype, "Location", HOFFSET(vehicle_t, location), loctype);
+ status = H5Tinsert(vehicletype, "Group", HOFFSET(vehicle_t, group), H5T_STD_REF_OBJ);
+ status =
+ H5Tinsert(vehicletype, "Surveyed areas", HOFFSET(vehicle_t, surveyed_areas), H5T_STD_REF_DSETREG);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the compound data to it.
+ */
+ dset = H5Dcreate(file, DATASET, vehicletype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, vehicletype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources. Note that we cannot use
+ * H5Dvlen_reclaim as it would attempt to free() the string
+ * constants used to initialize the name fields in wdata. We must
+ * therefore manually free() only the data previously allocated
+ * through malloc().
+ */
+ for (i = 0; i < dims[0]; i++)
+ free(wdata[i].sensors.p);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(sensortype);
+ status = H5Tclose(sensorstype);
+ status = H5Tclose(colortype);
+ status = H5Tclose(loctype);
+ status = H5Tclose(vehicletype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). We will only read back the variable length strings.
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype for reading. Even though it
+ * has only one field, it must still be defined as a compound type
+ * so the library can match the correct field in the file type.
+ * This matching is done by name. However, we do not need to
+ * define a structure for the read buffer as we can simply treat it
+ * as a char *.
+ */
+ rsensortype = H5Tcreate(H5T_COMPOUND, sizeof(char *));
+ status = H5Tinsert(rsensortype, "Location", 0, strtype);
+
+ /*
+ * Create the variable-length datatype for reading.
+ */
+ rsensorstype = H5Tvlen_create(rsensortype);
+
+ /*
+ * Create the main compound datatype for reading.
+ */
+ rvehicletype = H5Tcreate(H5T_COMPOUND, sizeof(rvehicle_t));
+ status = H5Tinsert(rvehicletype, "Sensors", HOFFSET(rvehicle_t, sensors), rsensorstype);
+ status = H5Tinsert(rvehicletype, "Name", HOFFSET(rvehicle_t, name), strtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (rvehicle_t *)malloc(dims[0] * sizeof(rvehicle_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, rvehicletype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n", DATASET, i);
+ printf(" Vehicle name :\n %s\n", rdata[i].name);
+ printf(" Sensor locations :\n");
+ for (j = 0; j < rdata[i].sensors.len; j++)
+ printf(" %s\n", ((char **)rdata[i].sensors.p)[j]);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (including
+ * strings).
+ */
+ status = H5Dvlen_reclaim(rvehicletype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(rsensortype);
+ status = H5Tclose(rsensorstype);
+ status = H5Tclose(rvehicletype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c b/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c
new file mode 100644
index 0000000..c7efbce
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c
@@ -0,0 +1,331 @@
+/************************************************************
+
+ This example shows how to read and write a complex
+ compound datatype to an attribute. The program first
+ writes complex compound structures to an attribute with a
+ dataspace of DIM0, then closes the file. Next, it reopens
+ the file, reads back selected fields in the structure, and
+ outputs them to the screen.
+
+ Unlike the other datatype examples, in this example we
+ save to the file using native datatypes to simplify the
+ type definitions here. To save using standard types you
+ must manually calculate the sizes and offsets of compound
+ types as shown in h5ex_t_cmpd.c, and convert enumerated
+ values as shown in h5ex_t_enum.c.
+
+ The datatype defined here consists of a compound
+ containing a variable-length list of compound types, as
+ well as a variable-length string, enumeration, double
+ array, object reference and region reference. The nested
+ compound type contains an int, variable-length string and
+ two doubles.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_cpxcmpdatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 2
+
+typedef struct {
+ int serial_no;
+ char *location;
+ double temperature;
+ double pressure;
+} sensor_t; /* Nested compound type */
+
+typedef enum { RED, GREEN, BLUE } color_t; /* Enumerated type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+ color_t color;
+ double location[3];
+ hobj_ref_t group;
+ hdset_reg_ref_t surveyed_areas;
+} vehicle_t; /* Main compound type */
+
+typedef struct {
+ hvl_t sensors;
+ char *name;
+} rvehicle_t; /* Read type */
+
+int
+main(void)
+{
+ hid_t file, vehicletype, colortype, sensortype, sensorstype, loctype, strtype, rvehicletype, rsensortype,
+ rsensorstype, space, dset, group, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0}, adims[1] = {3}, adims2[2] = {32, 32}, start[2] = {8, 26}, count[2] = {4, 3},
+ coords[3][2] = {{3, 2}, {3, 3}, {4, 4}};
+ vehicle_t wdata[2]; /* Write buffer */
+ rvehicle_t *rdata; /* Read buffer */
+ color_t val;
+ sensor_t *ptr;
+ double wdata2[32][32];
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset to use for region references.
+ */
+ for (i = 0; i < 32; i++)
+ for (j = 0; j < 32; j++)
+ wdata2[i][j] = 70. + 0.1 * (i - 16.) + 0.1 * (j - 16.);
+ space = H5Screate_simple(2, adims2, NULL);
+ dset = H5Dcreate(file, "Ambient_Temperature", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2[0]);
+ status = H5Dclose(dset);
+
+ /*
+ * Create groups to use for object references.
+ */
+ group = H5Gcreate(file, "Land_Vehicles", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(group);
+ group = H5Gcreate(file, "Air_Vehicles", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(group);
+
+ /*
+ * Initialize variable-length compound in the first data element.
+ */
+ wdata[0].sensors.len = 4;
+ ptr = (sensor_t *)malloc(wdata[0].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 1153;
+ ptr[0].location = "Exterior (static)";
+ ptr[0].temperature = 53.23;
+ ptr[0].pressure = 24.57;
+ ptr[1].serial_no = 1184;
+ ptr[1].location = "Intake";
+ ptr[1].temperature = 55.12;
+ ptr[1].pressure = 22.95;
+ ptr[2].serial_no = 1027;
+ ptr[2].location = "Intake manifold";
+ ptr[2].temperature = 103.55;
+ ptr[2].pressure = 31.23;
+ ptr[3].serial_no = 1313;
+ ptr[3].location = "Exhaust manifold";
+ ptr[3].temperature = 1252.89;
+ ptr[3].pressure = 84.11;
+ wdata[0].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the first data element.
+ */
+ wdata[0].name = "Airplane";
+ wdata[0].color = GREEN;
+ wdata[0].location[0] = -103234.21;
+ wdata[0].location[1] = 422638.78;
+ wdata[0].location[2] = 5996.43;
+ status = H5Rcreate(&wdata[0].group, file, "Air_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 3, coords[0]);
+ status = H5Rcreate(&wdata[0].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ /*
+ * Initialize variable-length compound in the second data element.
+ */
+ wdata[1].sensors.len = 1;
+ ptr = (sensor_t *)malloc(wdata[1].sensors.len * sizeof(sensor_t));
+ ptr[0].serial_no = 3244;
+ ptr[0].location = "Roof";
+ ptr[0].temperature = 83.82;
+ ptr[0].pressure = 29.92;
+ wdata[1].sensors.p = (void *)ptr;
+
+ /*
+ * Initialize other fields in the second data element.
+ */
+ wdata[1].name = "Automobile";
+ wdata[1].color = RED;
+ wdata[1].location[0] = 326734.36;
+ wdata[1].location[1] = 221568.23;
+ wdata[1].location[2] = 432.36;
+ status = H5Rcreate(&wdata[1].group, file, "Land_Vehicles", H5R_OBJECT, -1);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Rcreate(&wdata[1].surveyed_areas, file, "Ambient_Temperature", H5R_DATASET_REGION, space);
+
+ status = H5Sclose(space);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype.
+ */
+ sensortype = H5Tcreate(H5T_COMPOUND, sizeof(sensor_t));
+ status = H5Tinsert(sensortype, "Serial number", HOFFSET(sensor_t, serial_no), H5T_NATIVE_INT);
+ status = H5Tinsert(sensortype, "Location", HOFFSET(sensor_t, location), strtype);
+ status = H5Tinsert(sensortype, "Temperature (F)", HOFFSET(sensor_t, temperature), H5T_NATIVE_DOUBLE);
+ status = H5Tinsert(sensortype, "Pressure (inHg)", HOFFSET(sensor_t, pressure), H5T_NATIVE_DOUBLE);
+
+ /*
+ * Create the variable-length datatype.
+ */
+ sensorstype = H5Tvlen_create(sensortype);
+
+ /*
+ * Create the enumerated datatype.
+ */
+ colortype = H5Tenum_create(H5T_NATIVE_INT);
+ val = (color_t)RED;
+ status = H5Tenum_insert(colortype, "Red", &val);
+ val = (color_t)GREEN;
+ status = H5Tenum_insert(colortype, "Green", &val);
+ val = (color_t)BLUE;
+ status = H5Tenum_insert(colortype, "Blue", &val);
+
+ /*
+ * Create the array datatype.
+ */
+ loctype = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, adims);
+
+ /*
+ * Create the main compound datatype.
+ */
+ vehicletype = H5Tcreate(H5T_COMPOUND, sizeof(vehicle_t));
+ status = H5Tinsert(vehicletype, "Sensors", HOFFSET(vehicle_t, sensors), sensorstype);
+ status = H5Tinsert(vehicletype, "Name", HOFFSET(vehicle_t, name), strtype);
+ status = H5Tinsert(vehicletype, "Color", HOFFSET(vehicle_t, color), colortype);
+ status = H5Tinsert(vehicletype, "Location", HOFFSET(vehicle_t, location), loctype);
+ status = H5Tinsert(vehicletype, "Group", HOFFSET(vehicle_t, group), H5T_STD_REF_OBJ);
+ status =
+ H5Tinsert(vehicletype, "Surveyed areas", HOFFSET(vehicle_t, surveyed_areas), H5T_STD_REF_DSETREG);
+
+ /*
+ * Create dataset with a null dataspace. to serve as the parent for
+ * the attribute.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the compound data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, vehicletype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, vehicletype, wdata);
+
+ /*
+ * Close and release resources. Note that we cannot use
+ * H5Dvlen_reclaim as it would attempt to free() the string
+ * constants used to initialize the name fields in wdata. We must
+ * therefore manually free() only the data previously allocated
+ * through malloc().
+ */
+ for (i = 0; i < dims[0]; i++)
+ free(wdata[i].sensors.p);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(sensortype);
+ status = H5Tclose(sensorstype);
+ status = H5Tclose(colortype);
+ status = H5Tclose(loctype);
+ status = H5Tclose(vehicletype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). We will only read back the variable length strings.
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Create variable-length string datatype.
+ */
+ strtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(strtype, H5T_VARIABLE);
+
+ /*
+ * Create the nested compound datatype for reading. Even though it
+ * has only one field, it must still be defined as a compound type
+ * so the library can match the correct field in the file type.
+ * This matching is done by name. However, we do not need to
+ * define a structure for the read buffer as we can simply treat it
+ * as a char *.
+ */
+ rsensortype = H5Tcreate(H5T_COMPOUND, sizeof(char *));
+ status = H5Tinsert(rsensortype, "Location", 0, strtype);
+
+ /*
+ * Create the variable-length datatype for reading.
+ */
+ rsensorstype = H5Tvlen_create(rsensortype);
+
+ /*
+ * Create the main compound datatype for reading.
+ */
+ rvehicletype = H5Tcreate(H5T_COMPOUND, sizeof(rvehicle_t));
+ status = H5Tinsert(rvehicletype, "Sensors", HOFFSET(rvehicle_t, sensors), rsensorstype);
+ status = H5Tinsert(rvehicletype, "Name", HOFFSET(rvehicle_t, name), strtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (rvehicle_t *)malloc(dims[0] * sizeof(rvehicle_t));
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, rvehicletype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n", ATTRIBUTE, i);
+ printf(" Vehicle name :\n %s\n", rdata[i].name);
+ printf(" Sensor locations :\n");
+ for (j = 0; j < rdata[i].sensors.len; j++)
+ printf(" %s\n", ((char **)rdata[i].sensors.p)[j]);
+ }
+
+ /*
+ * Close and release resources. H5Dvlen_reclaim will automatically
+ * traverse the structure and free any vlen data (including
+ * strings).
+ */
+ status = H5Dvlen_reclaim(rvehicletype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(strtype);
+ status = H5Tclose(rsensortype);
+ status = H5Tclose(rsensorstype);
+ status = H5Tclose(rvehicletype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_enum.c b/HDF5Examples/C/H5T/h5ex_t_enum.c
new file mode 100644
index 0000000..d7da67c
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_enum.c
@@ -0,0 +1,163 @@
+/************************************************************
+
+ This example shows how to read and write enumerated
+ datatypes to a dataset. The program first writes
+ enumerated values to a dataset with a dataspace of
+ DIM0xDIM1, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_enum.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+#define F_BASET H5T_STD_I16BE /* File base type */
+#define M_BASET H5T_NATIVE_INT /* Memory base type */
+#define NAME_BUF_SIZE 16
+
+typedef enum { SOLID, LIQUID, GAS, PLASMA } phase_t; /* Enumerated type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ phase_t wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ val;
+ char *names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}, name[NAME_BUF_SIZE];
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (phase_t)((i + 1) * j - j) % (int)(PLASMA + 1);
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the enumerated datatypes for file and memory. This
+ * process is simplified if native types are used for the file,
+ * as only one type must be defined.
+ */
+ filetype = H5Tenum_create(F_BASET);
+ memtype = H5Tenum_create(M_BASET);
+
+ for (i = (int)SOLID; i <= (int)PLASMA; i++) {
+ /*
+ * Insert enumerated value for memtype.
+ */
+ val = (phase_t)i;
+ status = H5Tenum_insert(memtype, names[i], &val);
+ /*
+ * Insert enumerated value for filetype. We must first convert
+ * the numerical value val to the base type of the destination.
+ */
+ status = H5Tconvert(M_BASET, F_BASET, 1, &val, NULL, H5P_DEFAULT);
+ status = H5Tenum_insert(filetype, names[i], &val);
+ }
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the enumerated data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (phase_t **)malloc(dims[0] * sizeof(phase_t *));
+
+ /*
+ * Allocate space for enumerated data.
+ */
+ rdata[0] = (phase_t *)malloc(dims[0] * dims[1] * sizeof(phase_t));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+
+ /*
+ * Get the name of the enumeration member.
+ */
+ status = H5Tenum_nameof(memtype, &rdata[i][j], name, NAME_BUF_SIZE);
+ printf(" %-6s", name);
+ }
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_enumatt.c b/HDF5Examples/C/H5T/h5ex_t_enumatt.c
new file mode 100644
index 0000000..0da07d2
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_enumatt.c
@@ -0,0 +1,174 @@
+/************************************************************
+
+ This example shows how to read and write enumerated
+ datatypes to an attribute. The program first writes
+ enumerated values to an attribute with a dataspace of
+ DIM0xDIM1, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_enumatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+#define F_BASET H5T_STD_I16BE /* File base type */
+#define M_BASET H5T_NATIVE_INT /* Memory base type */
+#define NAME_BUF_SIZE 16
+
+typedef enum { SOLID, LIQUID, GAS, PLASMA } phase_t; /* Enumerated type */
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ phase_t wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ val;
+ char *names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}, name[NAME_BUF_SIZE];
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (phase_t)((i + 1) * j - j) % (int)(PLASMA + 1);
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the enumerated datatypes for file and memory. This
+ * process is simplified if native types are used for the file,
+ * as only one type must be defined.
+ */
+ filetype = H5Tenum_create(F_BASET);
+ memtype = H5Tenum_create(M_BASET);
+
+ for (i = (int)SOLID; i <= (int)PLASMA; i++) {
+ /*
+ * Insert enumerated value for memtype.
+ */
+ val = (phase_t)i;
+ status = H5Tenum_insert(memtype, names[i], &val);
+ /*
+ * Insert enumerated value for filetype. We must first convert
+ * the numerical value val to the base type of the destination.
+ */
+ status = H5Tconvert(M_BASET, F_BASET, 1, &val, NULL, H5P_DEFAULT);
+ status = H5Tenum_insert(filetype, names[i], &val);
+ }
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the enumerated data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc(). For simplicity, we do not rebuild memtype.
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (phase_t **)malloc(dims[0] * sizeof(phase_t *));
+
+ /*
+ * Allocate space for enumerated data.
+ */
+ rdata[0] = (phase_t *)malloc(dims[0] * dims[1] * sizeof(phase_t));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++) {
+
+ /*
+ * Get the name of the enumeration member.
+ */
+ status = H5Tenum_nameof(memtype, &rdata[i][j], name, NAME_BUF_SIZE);
+ printf(" %-6s", name);
+ }
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_float.c b/HDF5Examples/C/H5T/h5ex_t_float.c
new file mode 100644
index 0000000..1295448
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_float.c
@@ -0,0 +1,129 @@
+/************************************************************
+
+ This example shows how to read and write float datatypes
+ to a dataset. The program first writes floats to a
+ dataset with a dataspace of DIM0xDIM1, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_float.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ double wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (double)i / (j + 0.5) + j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the floating point data to it. In
+ * this example we will save the data as 64 bit little endian IEEE
+ * floating point numbers, regardless of the native type. The HDF5
+ * library automatically converts between different floating point
+ * types.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (double **)malloc(dims[0] * sizeof(double *));
+
+ /*
+ * Allocate space for floating point data.
+ */
+ rdata[0] = (double *)malloc(dims[0] * dims[1] * sizeof(double));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %6.4f", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_floatatt.c b/HDF5Examples/C/H5T/h5ex_t_floatatt.c
new file mode 100644
index 0000000..d8f9f7c
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_floatatt.c
@@ -0,0 +1,141 @@
+/************************************************************
+
+ This example shows how to read and write floating point
+ datatypes to an attribute. The program first writes
+ floating point numbers to an attribute with a dataspace of
+ DIM0xDIM1, then closes the file. Next, it reopens the
+ file, reads back the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_floatatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ double wdata[DIM0][DIM1], /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = (double)i / (j + 0.5) + j;
+ ;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the floating point data to it.
+ * In this example we will save the data as 64 bit little endian
+ * IEEE floating point numbers, regardless of the native type. The
+ * HDF5 library automatically converts between different floating
+ * point types.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_NATIVE_DOUBLE, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (double **)malloc(dims[0] * sizeof(double *));
+
+ /*
+ * Allocate space for floating point data.
+ */
+ rdata[0] = (double *)malloc(dims[0] * dims[1] * sizeof(double));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_NATIVE_DOUBLE, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %6.4f", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_int.c b/HDF5Examples/C/H5T/h5ex_t_int.c
new file mode 100644
index 0000000..b572830
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_int.c
@@ -0,0 +1,128 @@
+/************************************************************
+
+ This example shows how to read and write integer datatypes
+ to a dataset. The program first writes integers to a
+ dataset with a dataspace of DIM0xDIM1, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_int.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ int wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = i * j - j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the dataset and write the integer data to it. In this
+ * example we will save the data as 64 bit big endian integers,
+ * regardless of the native integer type. The HDF5 library
+ * automatically converts between different integer types.
+ */
+ dset = H5Dcreate(file, DATASET, H5T_STD_I64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (int **)malloc(dims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (int *)malloc(dims[0] * dims[1] * sizeof(int));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", DATASET);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %3d", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_intatt.c b/HDF5Examples/C/H5T/h5ex_t_intatt.c
new file mode 100644
index 0000000..a7cc418
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_intatt.c
@@ -0,0 +1,139 @@
+/************************************************************
+
+ This example shows how to read and write integer datatypes
+ to an attribute. The program first writes integers to an
+ attribute with a dataspace of DIM0xDIM1, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_intatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define DIM1 7
+
+int
+main(void)
+{
+ hid_t file, space, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[2] = {DIM0, DIM1};
+ int wdata[DIM0][DIM1], /* Write buffer */
+ **rdata, /* Read buffer */
+ ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = i * j - j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(2, dims, NULL);
+
+ /*
+ * Create the attribute and write the integer data to it. In this
+ * example we will save the data as 64 bit big endian integers,
+ * regardless of the native integer type. The HDF5 library
+ * automatically converts between different integer types.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, H5T_STD_I64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, H5T_NATIVE_INT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (int **)malloc(dims[0] * sizeof(int *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (int *)malloc(dims[0] * dims[1] * sizeof(int));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * dims[1];
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, H5T_NATIVE_INT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("%s:\n", ATTRIBUTE);
+ for (i = 0; i < dims[0]; i++) {
+ printf(" [");
+ for (j = 0; j < dims[1]; j++)
+ printf(" %3d", rdata[i][j]);
+ printf("]\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_objref.c b/HDF5Examples/C/H5T/h5ex_t_objref.c
new file mode 100644
index 0000000..1109720
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_objref.c
@@ -0,0 +1,203 @@
+/************************************************************
+
+ This example shows how to read and write object references
+ to a dataset. The program first creates objects in the
+ file and writes references to those objects to a dataset
+ with a dataspace of DIM0, then closes the file. Next, it
+ reopens the file, dereferences the references, and outputs
+ the names of their targets to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_objref.h5"
+#define DATASET "DS1"
+#define DIM0 2
+#define RANK 1
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID; /* File Handle */
+ hid_t space = H5I_INVALID_HID; /* Dataspace Handle */
+ hid_t dset = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t obj = H5I_INVALID_HID; /* Object Handle */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ ssize_t size;
+ char *name = NULL;
+ int ndims;
+ hsize_t i;
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ hid_t ref_type = H5T_STD_REF; /* Reference datatype */
+ H5R_ref_t wdata[DIM0]; /* buffer to write to disk */
+ H5R_ref_t *rdata = NULL; /* buffer to read into*/
+ H5R_type_t objtype; /* Reference type */
+#else
+ hid_t ref_type = H5T_STD_REF_OBJ; /* Reference datatype */
+ hobj_ref_t wdata[DIM0]; /* Write buffer */
+ hobj_ref_t *rdata = NULL; /* Read buffer */
+ H5O_type_t objtype;
+#endif
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ obj = H5Dcreate(file, "DS2", H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dclose(obj);
+ status = H5Sclose(space);
+
+ /*
+ * Create a group.
+ */
+ obj = H5Gcreate(file, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(obj);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(RANK, dims, NULL);
+
+ /*
+ * Create references to the previously created objects.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rcreate_object(file, "G1", H5R_OBJECT, &wdata[0]);
+ status = H5Rcreate_object(file, "DS2", H5R_OBJECT, &wdata[1]);
+#else
+ /*
+ * Passing -1
+ * as space_id causes this parameter to be ignored. Other values
+ * besides valid dataspaces result in an error.
+ */
+ status = H5Rcreate(&wdata[0], file, "G1", H5R_OBJECT, -1);
+ status = H5Rcreate(&wdata[1], file, "DS2", H5R_OBJECT, -1);
+#endif
+
+ /*
+ * Create the dataset and write the object references to it.
+ */
+ dset = H5Dcreate(file, DATASET, ref_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, ref_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&wdata[0]);
+ status = H5Rdestroy(&wdata[1]);
+#endif
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ rdata = (H5R_ref_t *)malloc(dims[0] * sizeof(H5R_ref_t));
+#else
+ rdata = (hobj_ref_t *)malloc(dims[0] * sizeof(hobj_ref_t));
+#endif
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, ref_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n ->", DATASET, i);
+
+ /*
+ * Open the referenced object, get its name and type.
+ */
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ obj = H5Ropen_object(&rdata[i], H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Rget_obj_type3(&rdata[i], H5P_DEFAULT, &objtype);
+#else
+ obj = H5Rdereference(dset, H5P_DEFAULT, H5R_OBJECT, &rdata[i]);
+ status = H5Rget_obj_type(dset, H5R_OBJECT, &rdata[i], &objtype);
+#endif
+#else
+ obj = H5Rdereference(dset, H5R_OBJECT, &rdata[i]);
+ status = H5Rget_obj_type(dset, H5R_OBJECT, &rdata[i], &objtype);
+#endif
+
+ /*
+ * Get the length of the name, allocate space, then retrieve
+ * the name.
+ */
+ size = 1 + H5Iget_name(obj, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(obj, name, size);
+
+ /*
+ * Print the object type and close the object.
+ */
+ switch (objtype) {
+ case H5O_TYPE_GROUP:
+ printf("Group");
+ break;
+ case H5O_TYPE_DATASET:
+ printf("Dataset");
+ break;
+ case H5O_TYPE_NAMED_DATATYPE:
+ printf("Named Datatype");
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ printf("Unknown");
+ }
+ status = H5Oclose(obj);
+
+ /*
+ * Print the name and deallocate space for the name.
+ */
+ printf(": %s\n", name);
+ free(name);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&rdata[i]);
+#endif
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_objrefatt.c b/HDF5Examples/C/H5T/h5ex_t_objrefatt.c
new file mode 100644
index 0000000..a464e9e
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_objrefatt.c
@@ -0,0 +1,216 @@
+/************************************************************
+
+ This example shows how to read and write object references
+ to an attribute. The program first creates objects in the
+ file and writes references to those objects to an
+ attribute with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, dereferences the references,
+ and outputs the names of their targets to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_objrefatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 2
+#define RANK 1
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID; /* File Handle */
+ hid_t space = H5I_INVALID_HID; /* Dataspace Handle */
+ hid_t dset = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t obj = H5I_INVALID_HID; /* Object Handle */
+ hid_t attr = H5I_INVALID_HID; /* Attribute Handle */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ ssize_t size;
+ char *name = NULL;
+ int ndims;
+ hsize_t i;
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ hid_t ref_type = H5T_STD_REF; /* Reference datatype */
+ H5R_ref_t wdata[DIM0]; /* buffer to write to disk */
+ H5R_ref_t *rdata = NULL; /* buffer to read into*/
+ H5R_type_t objtype; /* Reference type */
+#else
+ hid_t ref_type = H5T_STD_REF_OBJ; /* Reference datatype */
+ hobj_ref_t wdata[DIM0]; /* Write buffer */
+ hobj_ref_t *rdata = NULL; /* Read buffer */
+ H5O_type_t objtype;
+#endif
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ obj = H5Dcreate(file, "DS2", H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dclose(obj);
+ status = H5Sclose(space);
+
+ /*
+ * Create a group.
+ */
+ obj = H5Gcreate(file, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(obj);
+
+ /*
+ * Create dataset with a null dataspace to serve as the parent for
+ * the attribute.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(RANK, dims, NULL);
+
+ /*
+ * Create references to the previously created objects.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rcreate_object(file, "G1", H5R_OBJECT, &wdata[0]);
+ status = H5Rcreate_object(file, "DS2", H5R_OBJECT, &wdata[1]);
+#else
+ /*
+ * Passing -1
+ * as space_id causes this parameter to be ignored. Other values
+ * besides valid dataspaces result in an error.
+ */
+ status = H5Rcreate(&wdata[0], file, "G1", H5R_OBJECT, -1);
+ status = H5Rcreate(&wdata[1], file, "DS2", H5R_OBJECT, -1);
+#endif
+
+ /*
+ * Create the attribute and write the object references to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, ref_type, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, ref_type, wdata);
+
+ /*
+ * Close and release resources.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&wdata[0]);
+ status = H5Rdestroy(&wdata[1]);
+#endif
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ rdata = (H5R_ref_t *)malloc(dims[0] * sizeof(H5R_ref_t));
+#else
+ rdata = (hobj_ref_t *)malloc(dims[0] * sizeof(hobj_ref_t));
+#endif
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, ref_type, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n ->", ATTRIBUTE, i);
+
+ /*
+ * Open the referenced object, get its name and type.
+ */
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ obj = H5Ropen_object(&rdata[i], H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Rget_obj_type3(&rdata[i], H5P_DEFAULT, &objtype);
+#else
+ obj = H5Rdereference(dset, H5P_DEFAULT, H5R_OBJECT, &rdata[i]);
+ status = H5Rget_obj_type(dset, H5R_OBJECT, &rdata[i], &objtype);
+#endif
+#else
+ obj = H5Rdereference(dset, H5R_OBJECT, &rdata[i]);
+ status = H5Rget_obj_type(dset, H5R_OBJECT, &rdata[i], &objtype);
+#endif
+
+ /*
+ * Get the length of the name, allocate space, then retrieve
+ * the name.
+ */
+ size = 1 + H5Iget_name(obj, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(obj, name, size);
+
+ /*
+ * Print the object type and close the object.
+ */
+ switch (objtype) {
+ case H5O_TYPE_GROUP:
+ printf("Group");
+ break;
+ case H5O_TYPE_DATASET:
+ printf("Dataset");
+ break;
+ case H5O_TYPE_NAMED_DATATYPE:
+ printf("Named Datatype");
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ printf("Unknown");
+ }
+ status = H5Oclose(obj);
+
+ /*
+ * Print the name and deallocate space for the name.
+ */
+ printf(": %s\n", name);
+ free(name);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&rdata[i]);
+#endif
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_opaque.c b/HDF5Examples/C/H5T/h5ex_t_opaque.c
new file mode 100644
index 0000000..085183a
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_opaque.c
@@ -0,0 +1,135 @@
+/************************************************************
+
+ This example shows how to read and write opaque datatypes
+ to a dataset. The program first writes opaque data to a
+ dataset with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_opaque.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define LEN 7
+
+int
+main(void)
+{
+ hid_t file, space, dtype, dset; /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t len;
+ char wdata[DIM0 * LEN], /* Write buffer */
+ *rdata, /* Read buffer */
+ str[LEN] = "OPAQUE", *tag;
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < LEN - 1; j++)
+ wdata[j + i * LEN] = str[j];
+ wdata[LEN - 1 + i * LEN] = (char)i + '0';
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create opaque datatype and set the tag to something appropriate.
+ * For this example we will write and view the data as a character
+ * array.
+ */
+ dtype = H5Tcreate(H5T_OPAQUE, LEN);
+ status = H5Tset_tag(dtype, "Character array");
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the opaque data to it.
+ */
+ dset = H5Dcreate(file, DATASET, dtype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get datatype and properties for the datatype. Note that H5Tget_tag
+ * allocates space for the string in tag, so we must remember to release it
+ * later.
+ */
+ dtype = H5Dget_type(dset);
+ len = H5Tget_size(dtype);
+ tag = H5Tget_tag(dtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char *)malloc(dims[0] * len);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("Datatype tag for %s is: \"%s\"\n", DATASET, tag);
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%u]: ", DATASET, i);
+ for (j = 0; j < len; j++)
+ printf("%c", rdata[j + i * len]);
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ H5free_memory(tag);
+#else
+ free(tag);
+#endif
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c b/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c
new file mode 100644
index 0000000..e88031a
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c
@@ -0,0 +1,146 @@
+/************************************************************
+
+ This example shows how to read and write opaque datatypes
+ to an attribute. The program first writes opaque data to
+ an attribute with a dataspace of DIM0, then closes the
+ file. Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_opaqueatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define LEN 7
+
+int
+main(void)
+{
+ hid_t file, space, dtype, dset, attr; /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t len;
+ char wdata[DIM0 * LEN], /* Write buffer */
+ *rdata, /* Read buffer */
+ str[LEN] = "OPAQUE", *tag;
+ int ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize data.
+ */
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < LEN - 1; j++)
+ wdata[j + i * LEN] = str[j];
+ wdata[LEN - 1 + i * LEN] = (char)i + '0';
+ }
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create opaque datatype and set the tag to something appropriate.
+ * For this example we will write and view the data as a character
+ * array.
+ */
+ dtype = H5Tcreate(H5T_OPAQUE, LEN);
+ status = H5Tset_tag(dtype, "Character array");
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the opaque data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, dtype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, dtype, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get datatype and properties for the datatype. Note that H5Tget_tag
+ * allocates space for the string in tag, so we must remember to release it
+ * later.
+ */
+ dtype = H5Aget_type(attr);
+ len = H5Tget_size(dtype);
+ tag = H5Tget_tag(dtype);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char *)malloc(dims[0] * len);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, dtype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ printf("Datatype tag for %s is: \"%s\"\n", ATTRIBUTE, tag);
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]: ", ATTRIBUTE, i);
+ for (j = 0; j < len; j++)
+ printf("%c", rdata[j + i * len]);
+ printf("\n");
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ H5free_memory(tag);
+#else
+ free(tag);
+#endif
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(dtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_regref.c b/HDF5Examples/C/H5T/h5ex_t_regref.c
new file mode 100644
index 0000000..3922725
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_regref.c
@@ -0,0 +1,243 @@
+/************************************************************
+
+ This example shows how to read and write region references
+ to a dataset. The program first creates a dataset
+ containing characters and writes references to region of
+ the dataset to a new dataset with a dataspace of DIM0,
+ then closes the file. Next, it reopens the file,
+ dereferences the references, and outputs the referenced
+ regions to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_regref.h5"
+#define DATASET "DS1"
+#define DATASET2 "DS2"
+#define DIM0 2
+#define DS2DIM0 3
+#define DS2DIM1 16
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID; /* File Handle */
+ hid_t space = H5I_INVALID_HID; /* Dataspace Handle */
+ hid_t dset = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t dset2 = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t memspace = H5I_INVALID_HID; /* Mem dataspace */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ hsize_t dims2[2] = {DS2DIM0, DS2DIM1};
+ hsize_t coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}};
+ hsize_t start[2] = {0, 0};
+ hsize_t stride[2] = {2, 11};
+ hsize_t count[2] = {2, 2};
+ hsize_t block[2] = {1, 3};
+ hssize_t npoints;
+ ssize_t size;
+ char *name = NULL;
+ int ndims;
+ hsize_t i;
+ char wdata2[DS2DIM0][DS2DIM1] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ char *rdata2 = NULL;
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ hid_t ref_type = H5T_STD_REF; /* Reference datatype */
+ H5R_ref_t wdata[DIM0]; /* buffer to write to disk */
+ H5R_ref_t *rdata = NULL; /* buffer to read into*/
+ H5R_type_t objtype; /* Reference type */
+#else
+ hid_t ref_type = H5T_STD_REF_DSETREG; /* Reference datatype */
+ hdset_reg_ref_t wdata[DIM0]; /* Write buffer */
+ hdset_reg_ref_t *rdata = NULL; /* Read buffer */
+ H5O_type_t objtype;
+#endif
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (file < 0)
+ goto done;
+
+ /*
+ * Create a dataset with character data.
+ */
+ space = H5Screate_simple(2, dims2, NULL);
+ dset2 = H5Dcreate(file, DATASET2, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset2 < 0)
+ goto done;
+ status = H5Dwrite(dset2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
+
+ /*
+ * Create reference to a list of elements in dset2.
+ */
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 4, coords[0]);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rcreate_region(file, DATASET2, space, H5P_DEFAULT, &wdata[0]);
+#else
+ status = H5Rcreate(&wdata[0], file, DATASET2, H5R_DATASET_REGION, space);
+#endif
+ if (status < 0)
+ goto done;
+
+ /*
+ * Create reference to a hyperslab in dset2, close dataspace.
+ */
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, stride, count, block);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rcreate_region(file, DATASET2, space, H5P_DEFAULT, &wdata[1]);
+#else
+ status = H5Rcreate(&wdata[1], file, DATASET2, H5R_DATASET_REGION, space);
+#endif
+ if (status < 0)
+ goto done;
+
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the region references to it.
+ */
+ dset = H5Dcreate(file, DATASET, ref_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset < 0)
+ goto done;
+ status = H5Dwrite(dset, ref_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&wdata[0]);
+ status = H5Rdestroy(&wdata[1]);
+#endif
+ status = H5Dclose(dset);
+ status = H5Dclose(dset2);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ if (file < 0)
+ goto done;
+
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ if (dset < 0)
+ goto done;
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ rdata = (H5R_ref_t *)malloc(dims[0] * sizeof(H5R_ref_t));
+#else
+ rdata = (hdset_reg_ref_t *)malloc(dims[0] * sizeof(hdset_reg_ref_t));
+#endif
+
+ status = H5Sclose(space);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, ref_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n ->", DATASET, i);
+
+ /*
+ * Open the referenced object, retrieve its region as a
+ * dataspace selection.
+ */
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ dset2 = H5Ropen_object(&rdata[i], H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Ropen_region(&rdata[i], H5P_DEFAULT, H5P_DEFAULT);
+#else
+ dset2 = H5Rdereference(dset, H5P_DEFAULT, H5R_DATASET_REGION, &rdata[i]);
+ space = H5Rget_region(dset, H5R_DATASET_REGION, &rdata[i]);
+#endif
+#else
+ dset2 = H5Rdereference(dset, H5R_DATASET_REGION, &rdata[i]);
+ space = H5Rget_region(dset, H5R_DATASET_REGION, &rdata[i]);
+#endif
+ if (dset2 < 0)
+ goto done;
+
+ /*
+ * Get the length of the object's name, allocate space, then
+ * retrieve the name.
+ */
+ size = 1 + H5Iget_name(dset2, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(dset2, name, size);
+
+ /*
+ * Allocate space for the read buffer. We will only allocate
+ * enough space for the selection, plus a null terminator. The
+ * read buffer will be 1-dimensional.
+ */
+ npoints = H5Sget_select_npoints(space);
+ rdata2 = (char *)malloc(npoints + 1);
+
+ /*
+ * Read the dataset region, and add a null terminator so we can
+ * print it as a string.
+ */
+ memspace = H5Screate_simple(1, (hsize_t *)&npoints, NULL);
+ status = H5Dread(dset2, H5T_NATIVE_CHAR, memspace, space, H5P_DEFAULT, rdata2);
+ rdata2[npoints] = '\0';
+
+ /*
+ * Print the name and region data, close and release resources.
+ */
+ printf(" %s: %s\n", name, rdata2);
+ free(rdata2);
+ free(name);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&rdata[i]);
+#endif
+
+ status = H5Sclose(space);
+ status = H5Sclose(memspace);
+ status = H5Dclose(dset2);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
+
+ return 0;
+
+done:
+ return 1;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_regrefatt.c b/HDF5Examples/C/H5T/h5ex_t_regrefatt.c
new file mode 100644
index 0000000..5ed745d
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_regrefatt.c
@@ -0,0 +1,263 @@
+/************************************************************
+
+ This example shows how to read and write region references
+ to an attribute. The program first creates a dataset
+ containing characters and writes references to region of
+ the dataset to a new attribute with a dataspace of DIM0,
+ then closes the file. Next, it reopens the file,
+ dereferences the references, and outputs the referenced
+ regions to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_regrefatt.h5"
+#define DATASET "DS1"
+#define DATASET2 "DS2"
+#define ATTRIBUTE "A1"
+#define DIM0 2
+#define DS2DIM0 3
+#define DS2DIM1 16
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID; /* File Handle */
+ hid_t space = H5I_INVALID_HID; /* Dataspace Handle */
+ hid_t dset = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t dset2 = H5I_INVALID_HID; /* Dataset Handle */
+ hid_t memspace = H5I_INVALID_HID; /* Mem dataspace */
+ hid_t attr = H5I_INVALID_HID; /* Attribute dataspace */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ hsize_t dims2[2] = {DS2DIM0, DS2DIM1};
+ hsize_t coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}};
+ hsize_t start[2] = {0, 0};
+ hsize_t stride[2] = {2, 11};
+ hsize_t count[2] = {2, 2};
+ hsize_t block[2] = {1, 3};
+ hssize_t npoints;
+ ssize_t size;
+ char *name = NULL;
+ int ndims;
+ hsize_t i;
+ char wdata2[DS2DIM0][DS2DIM1] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ char *rdata2 = NULL;
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ hid_t ref_type = H5T_STD_REF; /* Reference datatype */
+ H5R_ref_t wdata[DIM0]; /* buffer to write to disk */
+ H5R_ref_t *rdata = NULL; /* buffer to read into*/
+ H5R_type_t objtype; /* Reference type */
+#else
+ hid_t ref_type = H5T_STD_REF_DSETREG; /* Reference datatype */
+ hdset_reg_ref_t wdata[DIM0]; /* Write buffer */
+ hdset_reg_ref_t *rdata = NULL; /* Read buffer */
+ H5O_type_t objtype;
+#endif
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (file < 0)
+ goto done;
+
+ /*
+ * Create a dataset with character data.
+ */
+ space = H5Screate_simple(2, dims2, NULL);
+ dset2 = H5Dcreate(file, DATASET2, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset2 < 0)
+ goto done;
+ status = H5Dwrite(dset2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
+
+ /*
+ * Create reference to a list of elements in dset2.
+ */
+ status = H5Sselect_elements(space, H5S_SELECT_SET, 4, coords[0]);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rcreate_region(file, DATASET2, space, H5P_DEFAULT, &wdata[0]);
+#else
+ status = H5Rcreate(&wdata[0], file, DATASET2, H5R_DATASET_REGION, space);
+#endif
+ if (status < 0)
+ goto done;
+
+ /*
+ * Create reference to a hyperslab in dset2, close dataspace.
+ */
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, stride, count, block);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rcreate_region(file, DATASET2, space, H5P_DEFAULT, &wdata[1]);
+#else
+ status = H5Rcreate(&wdata[1], file, DATASET2, H5R_DATASET_REGION, space);
+#endif
+ if (status < 0)
+ goto done;
+
+ status = H5Sclose(space);
+
+ /*
+ * Create dataset with a null dataspace to serve as the parent for
+ * the attribute.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the region references to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, ref_type, space, H5P_DEFAULT, H5P_DEFAULT);
+ if (attr < 0)
+ goto done;
+ status = H5Awrite(attr, ref_type, wdata);
+
+ /*
+ * Close and release resources.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&wdata[0]);
+ status = H5Rdestroy(&wdata[1]);
+#endif
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Dclose(dset2);
+ status = H5Sclose(space);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ if (file < 0)
+ goto done;
+
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ if (dset < 0)
+ goto done;
+
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+ if (attr < 0)
+ goto done;
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ rdata = (H5R_ref_t *)malloc(dims[0] * sizeof(H5R_ref_t));
+#else
+ rdata = (hdset_reg_ref_t *)malloc(dims[0] * sizeof(hdset_reg_ref_t));
+#endif
+
+ status = H5Sclose(space);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, ref_type, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n ->", ATTRIBUTE, i);
+
+ /*
+ * Open the referenced object, retrieve its region as a
+ * dataspace selection.
+ */
+#if H5_VERSION_GE(1, 10, 0) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ dset2 = H5Ropen_object(&rdata[i], H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Ropen_region(&rdata[i], H5P_DEFAULT, H5P_DEFAULT);
+#else
+ dset2 = H5Rdereference(dset, H5P_DEFAULT, H5R_DATASET_REGION, &rdata[i]);
+ space = H5Rget_region(dset, H5R_DATASET_REGION, &rdata[i]);
+#endif
+#else
+ dset2 = H5Rdereference(dset, H5R_DATASET_REGION, &rdata[i]);
+ space = H5Rget_region(dset, H5R_DATASET_REGION, &rdata[i]);
+#endif
+ if (dset2 < 0)
+ goto done;
+
+ /*
+ * Get the length of the object's name, allocate space, then
+ * retrieve the name.
+ */
+ size = 1 + H5Iget_name(dset2, NULL, 0);
+ name = (char *)malloc(size);
+ size = H5Iget_name(dset2, name, size);
+
+ /*
+ * Allocate space for the read buffer. We will only allocate
+ * enough space for the selection, plus a null terminator. The
+ * read buffer will be 1-dimensional.
+ */
+ npoints = H5Sget_select_npoints(space);
+ rdata2 = (char *)malloc(npoints + 1);
+
+ /*
+ * Read the dataset region, and add a null terminator so we can
+ * print it as a string.
+ */
+ memspace = H5Screate_simple(1, (hsize_t *)&npoints, NULL);
+ status = H5Dread(dset2, H5T_NATIVE_CHAR, memspace, space, H5P_DEFAULT, rdata2);
+ rdata2[npoints] = '\0';
+
+ /*
+ * Print the name and region data, close and release resources.
+ */
+ printf(" %s: %s\n", name, rdata2);
+ free(rdata2);
+ free(name);
+
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Rdestroy(&rdata[i]);
+#endif
+
+ status = H5Sclose(space);
+ status = H5Sclose(memspace);
+ status = H5Dclose(dset2);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata);
+ status = H5Aclose(attr);
+
+#if H5_VERSION_LE(1, 11, 0)
+ status = H5Dclose(dset);
+#endif
+
+ status = H5Fclose(file);
+
+ return 0;
+
+done:
+ return 1;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_string.c b/HDF5Examples/C/H5T/h5ex_t_string.c
new file mode 100644
index 0000000..33a5438
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_string.c
@@ -0,0 +1,144 @@
+/************************************************************
+
+ This example shows how to read and write string datatypes
+ to a dataset. The program first writes strings to a
+ dataset with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_string.h5"
+#define DATASET "DS1"
+#define DIM0 4
+#define SDIM 8
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t sdim;
+ char wdata[DIM0][SDIM] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings, therefore they do not need space
+ * for the null terminator in the file.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, SDIM - 1);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, SDIM);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the string data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset and string have the same name and rank, but can have
+ * any size. Therefore we must allocate a new array to read in
+ * data using malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get the datatype and its size.
+ */
+ filetype = H5Dget_type(dset);
+ sdim = H5Tget_size(filetype);
+ sdim++; /* Make room for null terminator */
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional dataset so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (char *)malloc(dims[0] * sdim * sizeof(char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * sdim;
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, sdim);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", DATASET, i, rdata[i]);
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_stringatt.c b/HDF5Examples/C/H5T/h5ex_t_stringatt.c
new file mode 100644
index 0000000..26e86d2
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_stringatt.c
@@ -0,0 +1,155 @@
+/************************************************************
+
+ This example shows how to read and write string datatypes
+ to an attribute. The program first writes strings to an
+ attribute with a dataspace of DIM0, then closes the file.
+ Next, it reopens the file, reads back the data, and
+ outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_stringatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+#define SDIM 8
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ size_t sdim;
+ char wdata[DIM0][SDIM] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings, therefore they do not need space
+ * for the null terminator in the file.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, SDIM - 1);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, SDIM);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the string data to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata[0]);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute and string have the same name and rank, but can
+ * have any size. Therefore we must allocate a new array to read
+ * in data using malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get the datatype and its size.
+ */
+ filetype = H5Aget_type(attr);
+ sdim = H5Tget_size(filetype);
+ sdim++; /* Make room for null terminator */
+
+ /*
+ * Get dataspace and allocate memory for read buffer. This is a
+ * two dimensional attribute so the dynamic allocation must be done
+ * in steps.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+
+ /*
+ * Allocate array of pointers to rows.
+ */
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Allocate space for integer data.
+ */
+ rdata[0] = (char *)malloc(dims[0] * sdim * sizeof(char));
+
+ /*
+ * Set the rest of the pointers to rows to the correct addresses.
+ */
+ for (i = 1; i < dims[0]; i++)
+ rdata[i] = rdata[0] + i * sdim;
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, sdim);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata[0]);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", ATTRIBUTE, i, rdata[i]);
+
+ /*
+ * Close and release resources.
+ */
+ free(rdata[0]);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_vlen.c b/HDF5Examples/C/H5T/h5ex_t_vlen.c
new file mode 100644
index 0000000..7111a34
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_vlen.c
@@ -0,0 +1,144 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ datatypes to a dataset. The program first writes two
+ variable-length integer arrays to a dataset then closes
+ the file. Next, it reopens the file, reads back the data,
+ and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlen.h5"
+#define DATASET "DS1"
+#define LEN0 3
+#define LEN1 12
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hvl_t wdata[2], /* Array of vlen structures */
+ *rdata; /* Pointer to vlen structures */
+ hsize_t dims[1] = {2};
+ int *ptr, ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize variable-length data. wdata[0] is a countdown of
+ * length LEN0, wdata[1] is a Fibonacci sequence of length LEN1.
+ */
+ wdata[0].len = LEN0;
+ ptr = (int *)malloc(wdata[0].len * sizeof(int));
+ for (i = 0; i < wdata[0].len; i++)
+ ptr[i] = wdata[0].len - (size_t)i; /* 3 2 1 */
+ wdata[0].p = (void *)ptr;
+
+ wdata[1].len = LEN1;
+ ptr = (int *)malloc(wdata[1].len * sizeof(int));
+ ptr[0] = 1;
+ ptr[1] = 1;
+ for (i = 2; i < wdata[1].len; i++)
+ ptr[i] = ptr[i - 1] + ptr[i - 2]; /* 1 1 2 3 5 8 etc. */
+ wdata[1].p = (void *)ptr;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length datatype for file and memory.
+ */
+ filetype = H5Tvlen_create(H5T_STD_I32LE);
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the variable-length data to it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources. Note the use of H5Dvlen_reclaim
+ * removes the need to manually free() the previously malloc'ed
+ * data.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, wdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for array of vlen structures.
+ * This does not actually allocate memory for the vlen data, that
+ * will be done by the library.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hvl_t *)malloc(dims[0] * sizeof(hvl_t));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the variable-length data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n {", DATASET, i);
+ ptr = rdata[i].p;
+ for (j = 0; j < rdata[i].len; j++) {
+ printf(" %d", ptr[j]);
+ if ((j + 1) < rdata[i].len)
+ printf(",");
+ }
+ printf(" }\n");
+ }
+
+ /*
+ * Close and release resources. Note we must still free the
+ * top-level pointer "rdata", as H5Dvlen_reclaim only frees the
+ * actual variable-length data, and not the structures themselves.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_vlenatt.c b/HDF5Examples/C/H5T/h5ex_t_vlenatt.c
new file mode 100644
index 0000000..db69aea
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_vlenatt.c
@@ -0,0 +1,155 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ datatypes to an attribute. The program first writes two
+ variable-length integer arrays to the attribute then
+ closes the file. Next, it reopens the file, reads back
+ the data, and outputs it to the screen.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlenatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define LEN0 3
+#define LEN1 12
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hvl_t wdata[2], /* Array of vlen structures */
+ *rdata; /* Pointer to vlen structures */
+ hsize_t dims[1] = {2};
+ int *ptr, ndims;
+ hsize_t i, j;
+
+ /*
+ * Initialize variable-length data. wdata[0] is a countdown of
+ * length LEN0, wdata[1] is a Fibonacci sequence of length LEN1.
+ */
+ wdata[0].len = LEN0;
+ ptr = (int *)malloc(wdata[0].len * sizeof(int));
+ for (i = 0; i < wdata[0].len; i++)
+ ptr[i] = wdata[0].len - (size_t)i; /* 3 2 1 */
+ wdata[0].p = (void *)ptr;
+
+ wdata[1].len = LEN1;
+ ptr = (int *)malloc(wdata[1].len * sizeof(int));
+ ptr[0] = 1;
+ ptr[1] = 1;
+ for (i = 2; i < wdata[1].len; i++)
+ ptr[i] = ptr[i - 1] + ptr[i - 2]; /* 1 1 2 3 5 8 etc. */
+ wdata[1].p = (void *)ptr;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create variable-length datatype for file and memory.
+ */
+ filetype = H5Tvlen_create(H5T_STD_I32LE);
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the variable-length data to it
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata);
+
+ /*
+ * Close and release resources. Note the use of H5Dvlen_reclaim
+ * removes the need to manually free() the previously malloc'ed
+ * data.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, wdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get dataspace and allocate memory for array of vlen structures.
+ * This does not actually allocate memory for the vlen data, that
+ * will be done by the library.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (hvl_t *)malloc(dims[0] * sizeof(hvl_t));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata);
+
+ /*
+ * Output the variable-length data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++) {
+ printf("%s[%llu]:\n {", ATTRIBUTE, i);
+ ptr = rdata[i].p;
+ for (j = 0; j < rdata[i].len; j++) {
+ printf(" %d", ptr[j]);
+ if ((j + 1) < rdata[i].len)
+ printf(",");
+ }
+ printf(" }\n");
+ }
+
+ /*
+ * Close and release resources. Note we must still free the
+ * top-level pointer "rdata", as H5Dvlen_reclaim only frees the
+ * actual variable-length data, and not the structures themselves.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_vlstring.c b/HDF5Examples/C/H5T/h5ex_t_vlstring.c
new file mode 100644
index 0000000..48647c1
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_vlstring.c
@@ -0,0 +1,126 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ string datatypes to a dataset. The program first writes
+ variable-length strings to a dataset with a dataspace of
+ DIM0, then closes the file. Next, it reopens the file,
+ reads back the data, and outputs it to the screen.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlstring.h5"
+#define DATASET "DS1"
+#define DIM0 4
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ char *wdata[DIM0] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, H5T_VARIABLE);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the dataset and write the variable-length string data to
+ * it.
+ */
+ dset = H5Dcreate(file, DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the dataset has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file and dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+
+ /*
+ * Get the datatype.
+ */
+ filetype = H5Dget_type(dset);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Dget_space(dset);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Read the data.
+ */
+ status = H5Dread(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", DATASET, i, rdata[i]);
+
+ /*
+ * Close and release resources. Note that H5Dvlen_reclaim works
+ * for variable-length strings as well as variable-length arrays.
+ * Also note that we must still free the array of pointers stored
+ * in rdata, as H5Tvlen_reclaim only frees the data these point to.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/h5ex_t_vlstringatt.c b/HDF5Examples/C/H5T/h5ex_t_vlstringatt.c
new file mode 100644
index 0000000..443c0a2
--- /dev/null
+++ b/HDF5Examples/C/H5T/h5ex_t_vlstringatt.c
@@ -0,0 +1,138 @@
+/************************************************************
+
+ This example shows how to read and write variable-length
+ string datatypes to an attribute. The program first
+ writes variable-length strings to an attribute with a
+ dataspace of DIM0, then closes the file. Next, it reopens
+ the file, reads back the data, and outputs it to the
+ screen.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_t_vlstringatt.h5"
+#define DATASET "DS1"
+#define ATTRIBUTE "A1"
+#define DIM0 4
+
+int
+main(void)
+{
+ hid_t file, filetype, memtype, space, dset, attr;
+ /* Handles */
+ herr_t status;
+ hsize_t dims[1] = {DIM0};
+ char *wdata[DIM0] = {"Parting", "is such", "sweet", "sorrow."},
+ /* Write buffer */
+ **rdata; /* Read buffer */
+ int ndims, i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create file and memory datatypes. For this example we will save
+ * the strings as FORTRAN strings.
+ */
+ filetype = H5Tcopy(H5T_FORTRAN_S1);
+ status = H5Tset_size(filetype, H5T_VARIABLE);
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Create dataset with a null dataspace.
+ */
+ space = H5Screate(H5S_NULL);
+ dset = H5Dcreate(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(space);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple(1, dims, NULL);
+
+ /*
+ * Create the attribute and write the variable-length string data
+ * to it.
+ */
+ attr = H5Acreate(dset, ATTRIBUTE, filetype, space, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(attr, memtype, wdata);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ /*
+ * Now we begin the read section of this example. Here we assume
+ * the attribute has the same name and rank, but can have any size.
+ * Therefore we must allocate a new array to read in data using
+ * malloc().
+ */
+
+ /*
+ * Open file, dataset, and attribute.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen(file, DATASET, H5P_DEFAULT);
+ attr = H5Aopen(dset, ATTRIBUTE, H5P_DEFAULT);
+
+ /*
+ * Get the datatype.
+ */
+ filetype = H5Aget_type(attr);
+
+ /*
+ * Get dataspace and allocate memory for read buffer.
+ */
+ space = H5Aget_space(attr);
+ ndims = H5Sget_simple_extent_dims(space, dims, NULL);
+ rdata = (char **)malloc(dims[0] * sizeof(char *));
+
+ /*
+ * Create the memory datatype.
+ */
+ memtype = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(memtype, H5T_VARIABLE);
+
+ /*
+ * Read the data.
+ */
+ status = H5Aread(attr, memtype, rdata);
+
+ /*
+ * Output the data to the screen.
+ */
+ for (i = 0; i < dims[0]; i++)
+ printf("%s[%d]: %s\n", ATTRIBUTE, i, rdata[i]);
+
+ /*
+ * Close and release resources. Note that H5Dvlen_reclaim works
+ * for variable-length strings as well as variable-length arrays.
+ * Also note that we must still free the array of pointers stored
+ * in rdata, as H5Tvlen_reclaim only frees the data these point to.
+ */
+ status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
+ free(rdata);
+ status = H5Aclose(attr);
+ status = H5Dclose(dset);
+ status = H5Sclose(space);
+ status = H5Tclose(filetype);
+ status = H5Tclose(memtype);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5T/test.sh.in b/HDF5Examples/C/H5T/test.sh.in
new file mode 100755
index 0000000..dc48ac9
--- /dev/null
+++ b/HDF5Examples/C/H5T/test.sh.in
@@ -0,0 +1,203 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+
+srcdir=@srcdir@
+
+
+case $CC in
+*/*) H5DUMP=`echo $CC | sed -e 's/\/[^/]*$/\/h5dump/'`;
+ test -x $H5DUMP || H5DUMP=h5dump;;
+*) H5DUMP=h5dump;;
+esac
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ;;
+ *) ECHO_N= ECHO_C='\c' ;;
+esac
+ECHO_N="echo $ECHO_N"
+
+
+exout() {
+ $*
+}
+
+dumpout() {
+ $H5DUMP $*
+}
+
+# compare current version, required version.
+# returns if cur_ver < req_ver is true.
+version_compare() {
+ version_lt=0
+ if [ ! "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]; then
+ version_lt=1
+ fi
+}
+
+H5_LIBVER=@H5_LIBVER@
+H5_LIBVER_DIR=@H5_LIBVER_DIR@
+
+topics="array arrayatt bit bitatt cmpd cmpdatt cpxcmpd cpxcmpdatt enum enumatt float floatatt \
+int intatt opaque opaqueatt string stringatt vlstring vlstringatt \
+commit"
+
+return_val=0
+
+for topic in $topics
+do
+ fname=h5ex_t_$topic
+ $ECHO_N "Testing C/H5T/$fname...$ECHO_C"
+ exout ./$fname >tmp.test
+ cmp -s tmp.test $srcdir/tfiles/16/$fname.tst
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ if [[ $fname == "h5ex_t_cpxcmpd" || $fname == "h5ex_t_cpxcmpdatt" ]]
+ then
+ targ="-n"
+ else
+ targ=""
+ fi
+ dumpout $targ $fname.h5 >tmp.test
+ rm -f $fname.h5
+ cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ echo " Passed"
+ fi
+ fi
+ return_val=`expr $status + $return_val`
+done
+
+
+#######Non-standard tests#######
+
+USE_ALT=""
+if [ "$H5_LIBVER_DIR" = "110" ]; then
+ # check if HDF5 version is < 1.10.7
+ version_compare "$H5_LIBVER" "1.10.7"
+ if [ "$version_lt" = 1 ]; then
+ USE_ALT="06"
+ fi
+else
+ if [ "$H5_LIBVER_DIR" = "18" ]; then
+ # check if HDF5 version is < 1.8.22
+ version_compare "$H5_LIBVER" "1.8.22"
+ if [ "$version_lt" = 1 ]; then
+ USE_ALT="21"
+ fi
+ fi
+fi
+
+topics="objref objrefatt regref regrefatt"
+
+for topic in $topics
+do
+ fname=h5ex_t_$topic
+ $ECHO_N "Testing C/H5T/$fname...$ECHO_C"
+ exout ./$fname >tmp.test
+ cmp -s tmp.test $srcdir/tfiles/16/$fname.tst
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ dumpout $fname.h5 >tmp.test
+ rm -f $fname.h5
+ version_compare "$H5_LIBVER" "1.10.0"
+ if [ "$version_lt" = 1 ]; then
+ cmp -s tmp.test $srcdir/tfiles/18/$fname$USE_ALT.ddl
+ else
+ version_compare "$H5_LIBVER" "1.12.0"
+ if [ "$version_lt" = 1 ]; then
+ version_compare "$H5_LIBVER" "1.10.7"
+ if [ "$version_lt" = 1 ]; then
+ cmp -s tmp.test $srcdir/tfiles/110/$fname$USE_ALT.ddl
+ else
+ cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl
+ fi
+ else
+ cmp -s tmp.test $srcdir/tfiles/112/$fname.ddl
+ fi
+ fi
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ echo " Passed"
+ fi
+ fi
+ return_val=`expr $status + $return_val`
+done
+
+topics="vlen vlenatt"
+
+for topic in $topics
+do
+ fname=h5ex_t_$topic
+ $ECHO_N "Testing C/H5T/$fname...$ECHO_C"
+ exout ./$fname >tmp.test
+ cmp -s tmp.test $srcdir/tfiles/16/$fname.tst
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ dumpout $fname.h5 >tmp.test
+ rm -f $fname.h5
+ version_compare "$H5_LIBVER" "1.14.3"
+ if [ "$version_lt" = 1 ]; then
+ cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl
+ else
+ cmp -s tmp.test $srcdir/tfiles/114/$fname.ddl
+ fi
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ echo " Passed"
+ fi
+ fi
+ return_val=`expr $status + $return_val`
+done
+
+
+fname=h5ex_t_convert
+$ECHO_N "Testing C/H5T/$fname...$ECHO_C"
+exout ./$fname >tmp.test
+cmp -s tmp.test $srcdir/tfiles/16/$fname.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+
+
+rm -f tmp.test
+echo "$return_val tests failed in C/H5T/"
+exit $return_val
diff --git a/HDF5Examples/C/H5T/tfiles/110/h5ex_t_objref06.ddl b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_objref06.ddl
new file mode 100644
index 0000000..6ca96c7
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_objref06.ddl
@@ -0,0 +1,19 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): GROUP 1400 /G1 , DATASET 800 /DS2
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/110/h5ex_t_objrefatt06.ddl b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_objrefatt06.ddl
new file mode 100644
index 0000000..7bf57d4
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_objrefatt06.ddl
@@ -0,0 +1,25 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): GROUP 1400 /G1 , DATASET 800 /DS2
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/110/h5ex_t_regref06.ddl b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_regref06.ddl
new file mode 100644
index 0000000..bbfe511
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_regref06.ddl
@@ -0,0 +1,24 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET /DS2 {(0,1), (2,11), (1,0), (2,4)},
+ DATASET /DS2 {(0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2), (2,11)-(2,13)}
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/110/h5ex_t_regrefatt06.ddl b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_regrefatt06.ddl
new file mode 100644
index 0000000..24811ae
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/110/h5ex_t_regrefatt06.ddl
@@ -0,0 +1,31 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): DATASET /DS2 {(0,1), (2,11), (1,0), (2,4)},
+ (1): DATASET /DS2 {(0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (1): (2,11)-(2,13)}
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/112/h5ex_t_objref.ddl b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_objref.ddl
new file mode 100644
index 0000000..46595b2
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_objref.ddl
@@ -0,0 +1,22 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objref.h5/G1"
+ DATASET "h5ex_t_objref.h5/DS2"
+ DATA {
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/112/h5ex_t_objrefatt.ddl b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_objrefatt.ddl
new file mode 100644
index 0000000..ad5c9c0
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_objrefatt.ddl
@@ -0,0 +1,28 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objrefatt.h5/G1"
+ DATASET "h5ex_t_objrefatt.h5/DS2"
+ DATA {
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/112/h5ex_t_regref.ddl b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_regref.ddl
new file mode 100644
index 0000000..d4975b1
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_regref.ddl
@@ -0,0 +1,33 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regref.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regref.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/112/h5ex_t_regrefatt.ddl b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_regrefatt.ddl
new file mode 100644
index 0000000..a3bda29
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/112/h5ex_t_regrefatt.ddl
@@ -0,0 +1,39 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regrefatt.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regrefatt.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlen.ddl b/HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlen.ddl
new file mode 100644
index 0000000..95b9c5a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlen.ddl
@@ -0,0 +1,11 @@
+HDF5 "h5ex_t_vlen.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlenatt.ddl b/HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlenatt.ddl
new file mode 100644
index 0000000..80005df
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/114/h5ex_t_vlenatt.ddl
@@ -0,0 +1,17 @@
+HDF5 "h5ex_t_vlenatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objref.ddl b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objref.ddl
new file mode 100644
index 0000000..1b06c02
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objref.ddl
@@ -0,0 +1,24 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objref.h5/G1"
+ DATASET "h5ex_t_objref.h5/DS2"
+ DATA {
+ (0): 0
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objrefatt.ddl b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objrefatt.ddl
new file mode 100644
index 0000000..72ea7d3
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_objrefatt.ddl
@@ -0,0 +1,31 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objrefatt.h5/G1"
+ DATASET "h5ex_t_objrefatt.h5/DS2"
+ DATA {
+ (0): 0
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regref.ddl b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regref.ddl
new file mode 100644
index 0000000..14e1887
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regref.ddl
@@ -0,0 +1,33 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regref.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regref.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regrefatt.ddl b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regrefatt.ddl
new file mode 100644
index 0000000..db2d67d
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/112/h5ex_t_regrefatt.ddl
@@ -0,0 +1,40 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regrefatt.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regrefatt.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.ddl
new file mode 100644
index 0000000..44d8233
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.ddl
@@ -0,0 +1,22 @@
+HDF5 "h5ex_t_array.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_ARRAY { [3][5] H5T_STD_I64LE }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): [ 0, 0, 0, 0, 0,
+ 0, -1, -2, -3, -4,
+ 0, -2, -4, -6, -8 ],
+ (1): [ 0, 1, 2, 3, 4,
+ 1, 1, 1, 1, 1,
+ 2, 1, 0, -1, -2 ],
+ (2): [ 0, 2, 4, 6, 8,
+ 2, 3, 4, 5, 6,
+ 4, 4, 4, 4, 4 ],
+ (3): [ 0, 3, 6, 9, 12,
+ 3, 5, 7, 9, 11,
+ 6, 7, 8, 9, 10 ]
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.tst
new file mode 100644
index 0000000..339bd16
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_array.tst
@@ -0,0 +1,20 @@
+DS1[0]:
+ [ 0 0 0 0 0]
+ [ 0 -1 -2 -3 -4]
+ [ 0 -2 -4 -6 -8]
+
+DS1[1]:
+ [ 0 1 2 3 4]
+ [ 1 1 1 1 1]
+ [ 2 1 0 -1 -2]
+
+DS1[2]:
+ [ 0 2 4 6 8]
+ [ 2 3 4 5 6]
+ [ 4 4 4 4 4]
+
+DS1[3]:
+ [ 0 3 6 9 12]
+ [ 3 5 7 9 11]
+ [ 6 7 8 9 10]
+
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.ddl
new file mode 100644
index 0000000..9d3950a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.ddl
@@ -0,0 +1,29 @@
+HDF5 "h5ex_t_arrayatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_ARRAY { [3][5] H5T_STD_I64LE }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): [ 0, 0, 0, 0, 0,
+ 0, -1, -2, -3, -4,
+ 0, -2, -4, -6, -8 ],
+ (1): [ 0, 1, 2, 3, 4,
+ 1, 1, 1, 1, 1,
+ 2, 1, 0, -1, -2 ],
+ (2): [ 0, 2, 4, 6, 8,
+ 2, 3, 4, 5, 6,
+ 4, 4, 4, 4, 4 ],
+ (3): [ 0, 3, 6, 9, 12,
+ 3, 5, 7, 9, 11,
+ 6, 7, 8, 9, 10 ]
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.tst
new file mode 100644
index 0000000..a42a358
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_arrayatt.tst
@@ -0,0 +1,20 @@
+A1[0]:
+ [ 0 0 0 0 0]
+ [ 0 -1 -2 -3 -4]
+ [ 0 -2 -4 -6 -8]
+
+A1[1]:
+ [ 0 1 2 3 4]
+ [ 1 1 1 1 1]
+ [ 2 1 0 -1 -2]
+
+A1[2]:
+ [ 0 2 4 6 8]
+ [ 2 3 4 5 6]
+ [ 4 4 4 4 4]
+
+A1[3]:
+ [ 0 3 6 9 12]
+ [ 3 5 7 9 11]
+ [ 6 7 8 9 10]
+
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.ddl
new file mode 100644
index 0000000..0d88583
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_bit.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_B8BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0x00, 0x53, 0xa2, 0xf1, 0x00, 0x53, 0xa2,
+ (1,0): 0x44, 0x94, 0xe4, 0x34, 0x44, 0x94, 0xe4,
+ (2,0): 0x88, 0xd9, 0x2a, 0x7b, 0x88, 0xd9, 0x2a,
+ (3,0): 0xcc, 0x1e, 0x6c, 0xbe, 0xcc, 0x1e, 0x6c
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.tst
new file mode 100644
index 0000000..4c37071
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bit.tst
@@ -0,0 +1,5 @@
+DS1:
+ [ {0, 0, 0, 0} {3, 0, 1, 1} {2, 0, 2, 2} {1, 0, 3, 3} {0, 0, 0, 0} {3, 0, 1, 1} {2, 0, 2, 2} ]
+ [ {0, 1, 0, 1} {0, 1, 1, 2} {0, 1, 2, 3} {0, 1, 3, 0} {0, 1, 0, 1} {0, 1, 1, 2} {0, 1, 2, 3} ]
+ [ {0, 2, 0, 2} {1, 2, 1, 3} {2, 2, 2, 0} {3, 2, 3, 1} {0, 2, 0, 2} {1, 2, 1, 3} {2, 2, 2, 0} ]
+ [ {0, 3, 0, 3} {2, 3, 1, 0} {0, 3, 2, 1} {2, 3, 3, 2} {0, 3, 0, 3} {2, 3, 1, 0} {0, 3, 2, 1} ]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.ddl
new file mode 100644
index 0000000..c85374a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.ddl
@@ -0,0 +1,21 @@
+HDF5 "h5ex_t_bitatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STD_B8BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0x00, 0x53, 0xa2, 0xf1, 0x00, 0x53, 0xa2,
+ (1,0): 0x44, 0x94, 0xe4, 0x34, 0x44, 0x94, 0xe4,
+ (2,0): 0x88, 0xd9, 0x2a, 0x7b, 0x88, 0xd9, 0x2a,
+ (3,0): 0xcc, 0x1e, 0x6c, 0xbe, 0xcc, 0x1e, 0x6c
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.tst
new file mode 100644
index 0000000..544acda
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_bitatt.tst
@@ -0,0 +1,5 @@
+A1:
+ [ {0, 0, 0, 0} {3, 0, 1, 1} {2, 0, 2, 2} {1, 0, 3, 3} {0, 0, 0, 0} {3, 0, 1, 1} {2, 0, 2, 2} ]
+ [ {0, 1, 0, 1} {0, 1, 1, 2} {0, 1, 2, 3} {0, 1, 3, 0} {0, 1, 0, 1} {0, 1, 1, 2} {0, 1, 2, 3} ]
+ [ {0, 2, 0, 2} {1, 2, 1, 3} {2, 2, 2, 0} {3, 2, 3, 1} {0, 2, 0, 2} {1, 2, 1, 3} {2, 2, 2, 0} ]
+ [ {0, 3, 0, 3} {2, 3, 1, 0} {0, 3, 2, 1} {2, 3, 3, 2} {0, 3, 0, 3} {2, 3, 1, 0} {0, 3, 2, 1} ]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.ddl
new file mode 100644
index 0000000..7a06ae1
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.ddl
@@ -0,0 +1,44 @@
+HDF5 "h5ex_t_cmpd.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_I64BE "Serial number";
+ H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "Location";
+ H5T_IEEE_F64BE "Temperature (F)";
+ H5T_IEEE_F64BE "Pressure (inHg)";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): {
+ 1153,
+ "Exterior (static)",
+ 53.23,
+ 24.57
+ },
+ (1): {
+ 1184,
+ "Intake",
+ 55.12,
+ 22.95
+ },
+ (2): {
+ 1027,
+ "Intake manifold",
+ 103.55,
+ 31.23
+ },
+ (3): {
+ 1313,
+ "Exhaust manifold",
+ 1252.89,
+ 84.11
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.tst
new file mode 100644
index 0000000..70dfad5
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpd.tst
@@ -0,0 +1,24 @@
+DS1[0]:
+Serial number : 1153
+Location : Exterior (static)
+Temperature (F) : 53.230000
+Pressure (inHg) : 24.570000
+
+DS1[1]:
+Serial number : 1184
+Location : Intake
+Temperature (F) : 55.120000
+Pressure (inHg) : 22.950000
+
+DS1[2]:
+Serial number : 1027
+Location : Intake manifold
+Temperature (F) : 103.550000
+Pressure (inHg) : 31.230000
+
+DS1[3]:
+Serial number : 1313
+Location : Exhaust manifold
+Temperature (F) : 1252.890000
+Pressure (inHg) : 84.110000
+
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.ddl
new file mode 100644
index 0000000..f1983b3
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.ddl
@@ -0,0 +1,51 @@
+HDF5 "h5ex_t_cmpdatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_I64BE "Serial number";
+ H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "Location";
+ H5T_IEEE_F64BE "Temperature (F)";
+ H5T_IEEE_F64BE "Pressure (inHg)";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): {
+ 1153,
+ "Exterior (static)",
+ 53.23,
+ 24.57
+ },
+ (1): {
+ 1184,
+ "Intake",
+ 55.12,
+ 22.95
+ },
+ (2): {
+ 1027,
+ "Intake manifold",
+ 103.55,
+ 31.23
+ },
+ (3): {
+ 1313,
+ "Exhaust manifold",
+ 1252.89,
+ 84.11
+ }
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.tst
new file mode 100644
index 0000000..424c6f6
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cmpdatt.tst
@@ -0,0 +1,24 @@
+A1[0]:
+Serial number : 1153
+Location : Exterior (static)
+Temperature (F) : 53.230000
+Pressure (inHg) : 24.570000
+
+A1[1]:
+Serial number : 1184
+Location : Intake
+Temperature (F) : 55.120000
+Pressure (inHg) : 22.950000
+
+A1[2]:
+Serial number : 1027
+Location : Intake manifold
+Temperature (F) : 103.550000
+Pressure (inHg) : 31.230000
+
+A1[3]:
+Serial number : 1313
+Location : Exhaust manifold
+Temperature (F) : 1252.890000
+Pressure (inHg) : 84.110000
+
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.ddl
new file mode 100644
index 0000000..fd0495d
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.ddl
@@ -0,0 +1,15 @@
+HDF5 "h5ex_t_commit.h5" {
+GROUP "/" {
+ DATATYPE "Sensor_Type" H5T_COMPOUND {
+ H5T_STD_I64BE "Serial number";
+ H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "Location";
+ H5T_IEEE_F64BE "Temperature (F)";
+ H5T_IEEE_F64BE "Pressure (inHg)";
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.tst
new file mode 100644
index 0000000..7d65d14
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_commit.tst
@@ -0,0 +1,6 @@
+Named datatype: Sensor_Type:
+ Class: H5T_COMPOUND
+ Serial number
+ Location
+ Temperature (F)
+ Pressure (inHg)
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_convert.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_convert.tst
new file mode 100644
index 0000000..b70906a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_convert.tst
@@ -0,0 +1,24 @@
+sensor[0]:
+Serial number : 1153
+Location : Exterior (static)
+Temperature (F) : 54.840000
+Pressure (inHg) : 24.760000
+
+sensor[1]:
+Serial number : 1184
+Location : Intake
+Temperature (F) : 56.630000
+Pressure (inHg) : 23.100000
+
+sensor[2]:
+Serial number : 1027
+Location : Intake manifold
+Temperature (F) : 102.690000
+Pressure (inHg) : 30.970000
+
+sensor[3]:
+Serial number : 1313
+Location : Exhaust manifold
+Temperature (F) : 1238.270000
+Pressure (inHg) : 82.150000
+
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.ddl
new file mode 100644
index 0000000..3c5c8c8
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.ddl
@@ -0,0 +1,9 @@
+HDF5 "h5ex_t_cpxcmpd.h5" {
+FILE_CONTENTS {
+ group /
+ group /Air_Vehicles
+ dataset /Ambient_Temperature
+ dataset /DS1
+ group /Land_Vehicles
+ }
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.tst
new file mode 100644
index 0000000..1b191d1
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpd.tst
@@ -0,0 +1,13 @@
+DS1[0]:
+ Vehicle name :
+ Airplane
+ Sensor locations :
+ Exterior (static)
+ Intake
+ Intake manifold
+ Exhaust manifold
+DS1[1]:
+ Vehicle name :
+ Automobile
+ Sensor locations :
+ Roof
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.ddl
new file mode 100644
index 0000000..fcdfcff
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.ddl
@@ -0,0 +1,9 @@
+HDF5 "h5ex_t_cpxcmpdatt.h5" {
+FILE_CONTENTS {
+ group /
+ group /Air_Vehicles
+ dataset /Ambient_Temperature
+ dataset /DS1
+ group /Land_Vehicles
+ }
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.tst
new file mode 100644
index 0000000..b22eca9
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_cpxcmpdatt.tst
@@ -0,0 +1,13 @@
+A1[0]:
+ Vehicle name :
+ Airplane
+ Sensor locations :
+ Exterior (static)
+ Intake
+ Intake manifold
+ Exhaust manifold
+A1[1]:
+ Vehicle name :
+ Automobile
+ Sensor locations :
+ Roof
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.ddl
new file mode 100644
index 0000000..c7f303d
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.ddl
@@ -0,0 +1,20 @@
+HDF5 "h5ex_t_enum.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_ENUM {
+ H5T_STD_I16BE;
+ "SOLID" 0;
+ "LIQUID" 1;
+ "GAS" 2;
+ "PLASMA" 3;
+ }
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): SOLID, SOLID, SOLID, SOLID, SOLID, SOLID, SOLID,
+ (1,0): SOLID, LIQUID, GAS, PLASMA, SOLID, LIQUID, GAS,
+ (2,0): SOLID, GAS, SOLID, GAS, SOLID, GAS, SOLID,
+ (3,0): SOLID, PLASMA, GAS, LIQUID, SOLID, PLASMA, GAS
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.tst
new file mode 100644
index 0000000..ee94ae6
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enum.tst
@@ -0,0 +1,5 @@
+DS1:
+ [ SOLID SOLID SOLID SOLID SOLID SOLID SOLID ]
+ [ SOLID LIQUID GAS PLASMA SOLID LIQUID GAS ]
+ [ SOLID GAS SOLID GAS SOLID GAS SOLID ]
+ [ SOLID PLASMA GAS LIQUID SOLID PLASMA GAS ]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.ddl
new file mode 100644
index 0000000..d37d083
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.ddl
@@ -0,0 +1,27 @@
+HDF5 "h5ex_t_enumatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_ENUM {
+ H5T_STD_I16BE;
+ "SOLID" 0;
+ "LIQUID" 1;
+ "GAS" 2;
+ "PLASMA" 3;
+ }
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): SOLID, SOLID, SOLID, SOLID, SOLID, SOLID, SOLID,
+ (1,0): SOLID, LIQUID, GAS, PLASMA, SOLID, LIQUID, GAS,
+ (2,0): SOLID, GAS, SOLID, GAS, SOLID, GAS, SOLID,
+ (3,0): SOLID, PLASMA, GAS, LIQUID, SOLID, PLASMA, GAS
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.tst
new file mode 100644
index 0000000..73a22f5
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_enumatt.tst
@@ -0,0 +1,5 @@
+A1:
+ [ SOLID SOLID SOLID SOLID SOLID SOLID SOLID ]
+ [ SOLID LIQUID GAS PLASMA SOLID LIQUID GAS ]
+ [ SOLID GAS SOLID GAS SOLID GAS SOLID ]
+ [ SOLID PLASMA GAS LIQUID SOLID PLASMA GAS ]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.ddl
new file mode 100644
index 0000000..0f9c9da
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_float.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6,
+ (1,0): 2, 1.66667, 2.4, 3.28571, 4.22222, 5.18182, 6.15385,
+ (2,0): 4, 2.33333, 2.8, 3.57143, 4.44444, 5.36364, 6.30769,
+ (3,0): 6, 3, 3.2, 3.85714, 4.66667, 5.54545, 6.46154
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.tst
new file mode 100644
index 0000000..89b963c
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_float.tst
@@ -0,0 +1,5 @@
+DS1:
+ [ 0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000]
+ [ 2.0000 1.6667 2.4000 3.2857 4.2222 5.1818 6.1538]
+ [ 4.0000 2.3333 2.8000 3.5714 4.4444 5.3636 6.3077]
+ [ 6.0000 3.0000 3.2000 3.8571 4.6667 5.5455 6.4615]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.ddl
new file mode 100644
index 0000000..b875f44
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.ddl
@@ -0,0 +1,21 @@
+HDF5 "h5ex_t_floatatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6,
+ (1,0): 2, 1.66667, 2.4, 3.28571, 4.22222, 5.18182, 6.15385,
+ (2,0): 4, 2.33333, 2.8, 3.57143, 4.44444, 5.36364, 6.30769,
+ (3,0): 6, 3, 3.2, 3.85714, 4.66667, 5.54545, 6.46154
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.tst
new file mode 100644
index 0000000..ee96460
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_floatatt.tst
@@ -0,0 +1,5 @@
+A1:
+ [ 0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000]
+ [ 2.0000 1.6667 2.4000 3.2857 4.2222 5.1818 6.1538]
+ [ 4.0000 2.3333 2.8000 3.5714 4.4444 5.3636 6.3077]
+ [ 6.0000 3.0000 3.2000 3.8571 4.6667 5.5455 6.4615]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.ddl
new file mode 100644
index 0000000..ad45d9e
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_int.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I64BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, -1, -2, -3, -4, -5, -6,
+ (1,0): 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 1, 2, 3, 4, 5, 6,
+ (3,0): 0, 2, 4, 6, 8, 10, 12
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.tst
new file mode 100644
index 0000000..7d867d5
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_int.tst
@@ -0,0 +1,5 @@
+DS1:
+ [ 0 -1 -2 -3 -4 -5 -6]
+ [ 0 0 0 0 0 0 0]
+ [ 0 1 2 3 4 5 6]
+ [ 0 2 4 6 8 10 12]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.ddl
new file mode 100644
index 0000000..1aba9bb
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.ddl
@@ -0,0 +1,21 @@
+HDF5 "h5ex_t_intatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STD_I64BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, -1, -2, -3, -4, -5, -6,
+ (1,0): 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 1, 2, 3, 4, 5, 6,
+ (3,0): 0, 2, 4, 6, 8, 10, 12
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.tst
new file mode 100644
index 0000000..8959a48
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_intatt.tst
@@ -0,0 +1,5 @@
+A1:
+ [ 0 -1 -2 -3 -4 -5 -6]
+ [ 0 0 0 0 0 0 0]
+ [ 0 1 2 3 4 5 6]
+ [ 0 2 4 6 8 10 12]
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.ddl
new file mode 100644
index 0000000..2b4afb2
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.ddl
@@ -0,0 +1,26 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP 1400 "/G1"
+ DATA {
+ }
+ DATASET 800 "/DS2"
+ DATA {
+ (0): 0
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.tst
new file mode 100644
index 0000000..ba11ebb
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objref.tst
@@ -0,0 +1,4 @@
+DS1[0]:
+ ->Group: /G1
+DS1[1]:
+ ->Dataset: /DS2
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.ddl
new file mode 100644
index 0000000..1d73a6a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.ddl
@@ -0,0 +1,33 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP 1400 "/G1"
+ DATA {
+ }
+ DATASET 800 "/DS2"
+ DATA {
+ (0): 0
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.tst
new file mode 100644
index 0000000..7ea98e3
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_objrefatt.tst
@@ -0,0 +1,4 @@
+A1[0]:
+ ->Group: /G1
+A1[1]:
+ ->Dataset: /DS2
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.ddl
new file mode 100644
index 0000000..124d1aa
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_opaque.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_OPAQUE {
+ OPAQUE_TAG "Character array";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 4f:50:41:51:55:45:30, 4f:50:41:51:55:45:31, 4f:50:41:51:55:45:32,
+ (3): 4f:50:41:51:55:45:33
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.tst
new file mode 100644
index 0000000..9c3ad12
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaque.tst
@@ -0,0 +1,5 @@
+Datatype tag for DS1 is: "Character array"
+DS1[0]: OPAQUE0
+DS1[1]: OPAQUE1
+DS1[2]: OPAQUE2
+DS1[3]: OPAQUE3
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.ddl
new file mode 100644
index 0000000..8f8de10
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.ddl
@@ -0,0 +1,21 @@
+HDF5 "h5ex_t_opaqueatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_OPAQUE {
+ OPAQUE_TAG "Character array";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 4f:50:41:51:55:45:30, 4f:50:41:51:55:45:31,
+ (2): 4f:50:41:51:55:45:32, 4f:50:41:51:55:45:33
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.tst
new file mode 100644
index 0000000..2acf16a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_opaqueatt.tst
@@ -0,0 +1,5 @@
+Datatype tag for A1 is: "Character array"
+A1[0]: OPAQUE0
+A1[1]: OPAQUE1
+A1[2]: OPAQUE2
+A1[3]: OPAQUE3
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.ddl
new file mode 100644
index 0000000..7a69f72
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.ddl
@@ -0,0 +1,33 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.tst
new file mode 100644
index 0000000..63c1f9e
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regref.tst
@@ -0,0 +1,4 @@
+DS1[0]:
+ -> /DS2: hdf5
+DS1[1]:
+ -> /DS2: Therowthedog
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.ddl
new file mode 100644
index 0000000..b161fe2
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.ddl
@@ -0,0 +1,40 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.tst
new file mode 100644
index 0000000..d50fc76
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_regrefatt.tst
@@ -0,0 +1,4 @@
+A1[0]:
+ -> /DS2: hdf5
+A1[1]:
+ -> /DS2: Therowthedog
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.ddl
new file mode 100644
index 0000000..6a1262a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.ddl
@@ -0,0 +1,16 @@
+HDF5 "h5ex_t_string.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STRING {
+ STRSIZE 7;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet ", "sorrow."
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.tst
new file mode 100644
index 0000000..9516b1a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_string.tst
@@ -0,0 +1,4 @@
+DS1[0]: Parting
+DS1[1]: is such
+DS1[2]: sweet
+DS1[3]: sorrow.
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.ddl
new file mode 100644
index 0000000..eb651fb
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.ddl
@@ -0,0 +1,23 @@
+HDF5 "h5ex_t_stringatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STRING {
+ STRSIZE 7;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet ", "sorrow."
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.tst
new file mode 100644
index 0000000..1365c6a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_stringatt.tst
@@ -0,0 +1,4 @@
+A1[0]: Parting
+A1[1]: is such
+A1[2]: sweet
+A1[3]: sorrow.
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.ddl
new file mode 100644
index 0000000..53f4863
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.ddl
@@ -0,0 +1,11 @@
+HDF5 "h5ex_t_vlen.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE}
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.tst
new file mode 100644
index 0000000..f11bf93
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlen.tst
@@ -0,0 +1,4 @@
+DS1[0]:
+ { 3, 2, 1 }
+DS1[1]:
+ { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 }
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.ddl
new file mode 100644
index 0000000..cd6aa69
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.ddl
@@ -0,0 +1,18 @@
+HDF5 "h5ex_t_vlenatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE}
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.tst
new file mode 100644
index 0000000..4709eda
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlenatt.tst
@@ -0,0 +1,4 @@
+A1[0]:
+ { 3, 2, 1 }
+A1[1]:
+ { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 }
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.ddl
new file mode 100644
index 0000000..dc79af1
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.ddl
@@ -0,0 +1,16 @@
+HDF5 "h5ex_t_vlstring.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet", "sorrow."
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.tst
new file mode 100644
index 0000000..9516b1a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstring.tst
@@ -0,0 +1,4 @@
+DS1[0]: Parting
+DS1[1]: is such
+DS1[2]: sweet
+DS1[3]: sorrow.
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.ddl b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.ddl
new file mode 100644
index 0000000..5f99d21
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.ddl
@@ -0,0 +1,23 @@
+HDF5 "h5ex_t_vlstringatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SCALAR
+ DATA {
+ (0): 0
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet", "sorrow."
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.tst b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.tst
new file mode 100644
index 0000000..1365c6a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/16/h5ex_t_vlstringatt.tst
@@ -0,0 +1,4 @@
+A1[0]: Parting
+A1[1]: is such
+A1[2]: sweet
+A1[3]: sorrow.
diff --git a/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objref.ddl b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objref.ddl
new file mode 100644
index 0000000..03d74d8
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objref.ddl
@@ -0,0 +1,22 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objref.h5/G1"
+ DATASET "h5ex_t_objref.h5/DS2"
+ DATA {
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objrefatt.ddl b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objrefatt.ddl
new file mode 100644
index 0000000..dd9db18
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_objrefatt.ddl
@@ -0,0 +1,28 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objrefatt.h5/G1"
+ DATASET "h5ex_t_objrefatt.h5/DS2"
+ DATA {
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regref.ddl b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regref.ddl
new file mode 100644
index 0000000..14e1887
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regref.ddl
@@ -0,0 +1,33 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regref.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regref.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regrefatt.ddl b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regrefatt.ddl
new file mode 100644
index 0000000..1bf51b0
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/112/h5ex_t_regrefatt.ddl
@@ -0,0 +1,39 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regrefatt.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regrefatt.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_array.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_array.ddl
new file mode 100644
index 0000000..44d8233
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_array.ddl
@@ -0,0 +1,22 @@
+HDF5 "h5ex_t_array.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_ARRAY { [3][5] H5T_STD_I64LE }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): [ 0, 0, 0, 0, 0,
+ 0, -1, -2, -3, -4,
+ 0, -2, -4, -6, -8 ],
+ (1): [ 0, 1, 2, 3, 4,
+ 1, 1, 1, 1, 1,
+ 2, 1, 0, -1, -2 ],
+ (2): [ 0, 2, 4, 6, 8,
+ 2, 3, 4, 5, 6,
+ 4, 4, 4, 4, 4 ],
+ (3): [ 0, 3, 6, 9, 12,
+ 3, 5, 7, 9, 11,
+ 6, 7, 8, 9, 10 ]
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_arrayatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_arrayatt.ddl
new file mode 100644
index 0000000..9b6a209
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_arrayatt.ddl
@@ -0,0 +1,28 @@
+HDF5 "h5ex_t_arrayatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_ARRAY { [3][5] H5T_STD_I64LE }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): [ 0, 0, 0, 0, 0,
+ 0, -1, -2, -3, -4,
+ 0, -2, -4, -6, -8 ],
+ (1): [ 0, 1, 2, 3, 4,
+ 1, 1, 1, 1, 1,
+ 2, 1, 0, -1, -2 ],
+ (2): [ 0, 2, 4, 6, 8,
+ 2, 3, 4, 5, 6,
+ 4, 4, 4, 4, 4 ],
+ (3): [ 0, 3, 6, 9, 12,
+ 3, 5, 7, 9, 11,
+ 6, 7, 8, 9, 10 ]
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_bit.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_bit.ddl
new file mode 100644
index 0000000..0d88583
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_bit.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_bit.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_B8BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0x00, 0x53, 0xa2, 0xf1, 0x00, 0x53, 0xa2,
+ (1,0): 0x44, 0x94, 0xe4, 0x34, 0x44, 0x94, 0xe4,
+ (2,0): 0x88, 0xd9, 0x2a, 0x7b, 0x88, 0xd9, 0x2a,
+ (3,0): 0xcc, 0x1e, 0x6c, 0xbe, 0xcc, 0x1e, 0x6c
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_bitatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_bitatt.ddl
new file mode 100644
index 0000000..f56e12d
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_bitatt.ddl
@@ -0,0 +1,20 @@
+HDF5 "h5ex_t_bitatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STD_B8BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0x00, 0x53, 0xa2, 0xf1, 0x00, 0x53, 0xa2,
+ (1,0): 0x44, 0x94, 0xe4, 0x34, 0x44, 0x94, 0xe4,
+ (2,0): 0x88, 0xd9, 0x2a, 0x7b, 0x88, 0xd9, 0x2a,
+ (3,0): 0xcc, 0x1e, 0x6c, 0xbe, 0xcc, 0x1e, 0x6c
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpd.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpd.ddl
new file mode 100644
index 0000000..7a06ae1
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpd.ddl
@@ -0,0 +1,44 @@
+HDF5 "h5ex_t_cmpd.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_I64BE "Serial number";
+ H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "Location";
+ H5T_IEEE_F64BE "Temperature (F)";
+ H5T_IEEE_F64BE "Pressure (inHg)";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): {
+ 1153,
+ "Exterior (static)",
+ 53.23,
+ 24.57
+ },
+ (1): {
+ 1184,
+ "Intake",
+ 55.12,
+ 22.95
+ },
+ (2): {
+ 1027,
+ "Intake manifold",
+ 103.55,
+ 31.23
+ },
+ (3): {
+ 1313,
+ "Exhaust manifold",
+ 1252.89,
+ 84.11
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpdatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpdatt.ddl
new file mode 100644
index 0000000..2c0ff93
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cmpdatt.ddl
@@ -0,0 +1,50 @@
+HDF5 "h5ex_t_cmpdatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_I64BE "Serial number";
+ H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "Location";
+ H5T_IEEE_F64BE "Temperature (F)";
+ H5T_IEEE_F64BE "Pressure (inHg)";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): {
+ 1153,
+ "Exterior (static)",
+ 53.23,
+ 24.57
+ },
+ (1): {
+ 1184,
+ "Intake",
+ 55.12,
+ 22.95
+ },
+ (2): {
+ 1027,
+ "Intake manifold",
+ 103.55,
+ 31.23
+ },
+ (3): {
+ 1313,
+ "Exhaust manifold",
+ 1252.89,
+ 84.11
+ }
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_commit.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_commit.ddl
new file mode 100644
index 0000000..fd0495d
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_commit.ddl
@@ -0,0 +1,15 @@
+HDF5 "h5ex_t_commit.h5" {
+GROUP "/" {
+ DATATYPE "Sensor_Type" H5T_COMPOUND {
+ H5T_STD_I64BE "Serial number";
+ H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "Location";
+ H5T_IEEE_F64BE "Temperature (F)";
+ H5T_IEEE_F64BE "Pressure (inHg)";
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpd.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpd.ddl
new file mode 100644
index 0000000..3c5c8c8
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpd.ddl
@@ -0,0 +1,9 @@
+HDF5 "h5ex_t_cpxcmpd.h5" {
+FILE_CONTENTS {
+ group /
+ group /Air_Vehicles
+ dataset /Ambient_Temperature
+ dataset /DS1
+ group /Land_Vehicles
+ }
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpdatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpdatt.ddl
new file mode 100644
index 0000000..fcdfcff
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_cpxcmpdatt.ddl
@@ -0,0 +1,9 @@
+HDF5 "h5ex_t_cpxcmpdatt.h5" {
+FILE_CONTENTS {
+ group /
+ group /Air_Vehicles
+ dataset /Ambient_Temperature
+ dataset /DS1
+ group /Land_Vehicles
+ }
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_enum.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_enum.ddl
new file mode 100644
index 0000000..c7f303d
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_enum.ddl
@@ -0,0 +1,20 @@
+HDF5 "h5ex_t_enum.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_ENUM {
+ H5T_STD_I16BE;
+ "SOLID" 0;
+ "LIQUID" 1;
+ "GAS" 2;
+ "PLASMA" 3;
+ }
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): SOLID, SOLID, SOLID, SOLID, SOLID, SOLID, SOLID,
+ (1,0): SOLID, LIQUID, GAS, PLASMA, SOLID, LIQUID, GAS,
+ (2,0): SOLID, GAS, SOLID, GAS, SOLID, GAS, SOLID,
+ (3,0): SOLID, PLASMA, GAS, LIQUID, SOLID, PLASMA, GAS
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_enumatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_enumatt.ddl
new file mode 100644
index 0000000..c463cdf
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_enumatt.ddl
@@ -0,0 +1,26 @@
+HDF5 "h5ex_t_enumatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_ENUM {
+ H5T_STD_I16BE;
+ "SOLID" 0;
+ "LIQUID" 1;
+ "GAS" 2;
+ "PLASMA" 3;
+ }
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): SOLID, SOLID, SOLID, SOLID, SOLID, SOLID, SOLID,
+ (1,0): SOLID, LIQUID, GAS, PLASMA, SOLID, LIQUID, GAS,
+ (2,0): SOLID, GAS, SOLID, GAS, SOLID, GAS, SOLID,
+ (3,0): SOLID, PLASMA, GAS, LIQUID, SOLID, PLASMA, GAS
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_float.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_float.ddl
new file mode 100644
index 0000000..0f9c9da
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_float.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_float.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6,
+ (1,0): 2, 1.66667, 2.4, 3.28571, 4.22222, 5.18182, 6.15385,
+ (2,0): 4, 2.33333, 2.8, 3.57143, 4.44444, 5.36364, 6.30769,
+ (3,0): 6, 3, 3.2, 3.85714, 4.66667, 5.54545, 6.46154
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_floatatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_floatatt.ddl
new file mode 100644
index 0000000..ec110e9
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_floatatt.ddl
@@ -0,0 +1,20 @@
+HDF5 "h5ex_t_floatatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6,
+ (1,0): 2, 1.66667, 2.4, 3.28571, 4.22222, 5.18182, 6.15385,
+ (2,0): 4, 2.33333, 2.8, 3.57143, 4.44444, 5.36364, 6.30769,
+ (3,0): 6, 3, 3.2, 3.85714, 4.66667, 5.54545, 6.46154
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_int.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_int.ddl
new file mode 100644
index 0000000..ad45d9e
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_int.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_int.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I64BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, -1, -2, -3, -4, -5, -6,
+ (1,0): 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 1, 2, 3, 4, 5, 6,
+ (3,0): 0, 2, 4, 6, 8, 10, 12
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_intatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_intatt.ddl
new file mode 100644
index 0000000..42cdd72
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_intatt.ddl
@@ -0,0 +1,20 @@
+HDF5 "h5ex_t_intatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STD_I64BE
+ DATASPACE SIMPLE { ( 4, 7 ) / ( 4, 7 ) }
+ DATA {
+ (0,0): 0, -1, -2, -3, -4, -5, -6,
+ (1,0): 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 1, 2, 3, 4, 5, 6,
+ (3,0): 0, 2, 4, 6, 8, 10, 12
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref.ddl
new file mode 100644
index 0000000..6b1e32c
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref.ddl
@@ -0,0 +1,24 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP 1400 "/G1"
+ DATA {
+ }
+ DATASET 800 "/DS2"
+ DATA {
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref21.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref21.ddl
new file mode 100644
index 0000000..6ca96c7
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objref21.ddl
@@ -0,0 +1,19 @@
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): GROUP 1400 /G1 , DATASET 800 /DS2
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt.ddl
new file mode 100644
index 0000000..ad9c4bf
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt.ddl
@@ -0,0 +1,30 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP 1400 "/G1"
+ DATA {
+ }
+ DATASET 800 "/DS2"
+ DATA {
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt21.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt21.ddl
new file mode 100644
index 0000000..7bf57d4
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_objrefatt21.ddl
@@ -0,0 +1,25 @@
+HDF5 "h5ex_t_objrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): GROUP 1400 /G1 , DATASET 800 /DS2
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaque.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaque.ddl
new file mode 100644
index 0000000..124d1aa
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaque.ddl
@@ -0,0 +1,14 @@
+HDF5 "h5ex_t_opaque.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_OPAQUE {
+ OPAQUE_TAG "Character array";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 4f:50:41:51:55:45:30, 4f:50:41:51:55:45:31, 4f:50:41:51:55:45:32,
+ (3): 4f:50:41:51:55:45:33
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaqueatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaqueatt.ddl
new file mode 100644
index 0000000..97d6f5a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_opaqueatt.ddl
@@ -0,0 +1,20 @@
+HDF5 "h5ex_t_opaqueatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_OPAQUE {
+ OPAQUE_TAG "Character array";
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 4f:50:41:51:55:45:30, 4f:50:41:51:55:45:31,
+ (2): 4f:50:41:51:55:45:32, 4f:50:41:51:55:45:33
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref.ddl
new file mode 100644
index 0000000..7a69f72
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref.ddl
@@ -0,0 +1,33 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref21.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref21.ddl
new file mode 100644
index 0000000..bbfe511
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regref21.ddl
@@ -0,0 +1,24 @@
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET /DS2 {(0,1), (2,11), (1,0), (2,4)},
+ DATASET /DS2 {(0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2), (2,11)-(2,13)}
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt.ddl
new file mode 100644
index 0000000..d12a164
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt.ddl
@@ -0,0 +1,39 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt21.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt21.ddl
new file mode 100644
index 0000000..24811ae
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_regrefatt21.ddl
@@ -0,0 +1,31 @@
+HDF5 "h5ex_t_regrefatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): DATASET /DS2 {(0,1), (2,11), (1,0), (2,4)},
+ (1): DATASET /DS2 {(0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (1): (2,11)-(2,13)}
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_string.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_string.ddl
new file mode 100644
index 0000000..6a1262a
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_string.ddl
@@ -0,0 +1,16 @@
+HDF5 "h5ex_t_string.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STRING {
+ STRSIZE 7;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet ", "sorrow."
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_stringatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_stringatt.ddl
new file mode 100644
index 0000000..0e0c7f4
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_stringatt.ddl
@@ -0,0 +1,22 @@
+HDF5 "h5ex_t_stringatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STRING {
+ STRSIZE 7;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet ", "sorrow."
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlen.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlen.ddl
new file mode 100644
index 0000000..53f4863
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlen.ddl
@@ -0,0 +1,11 @@
+HDF5 "h5ex_t_vlen.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE}
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlenatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlenatt.ddl
new file mode 100644
index 0000000..a2b32e8
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlenatt.ddl
@@ -0,0 +1,17 @@
+HDF5 "h5ex_t_vlenatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE}
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ (0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
+ }
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstring.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstring.ddl
new file mode 100644
index 0000000..dc79af1
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstring.ddl
@@ -0,0 +1,16 @@
+HDF5 "h5ex_t_vlstring.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet", "sorrow."
+ }
+ }
+}
+}
diff --git a/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstringatt.ddl b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstringatt.ddl
new file mode 100644
index 0000000..08e298b
--- /dev/null
+++ b/HDF5Examples/C/H5T/tfiles/18/h5ex_t_vlstringatt.ddl
@@ -0,0 +1,22 @@
+HDF5 "h5ex_t_vlstringatt.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ ATTRIBUTE "A1" {
+ DATATYPE H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_SPACEPAD;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): "Parting", "is such", "sweet", "sorrow."
+ }
+ }
+ }
+}
+}