summaryrefslogtreecommitdiffstats
path: root/HDF5Examples/C/H5G
diff options
context:
space:
mode:
Diffstat (limited to 'HDF5Examples/C/H5G')
-rw-r--r--HDF5Examples/C/H5G/16/h5ex_g_create.c44
-rw-r--r--HDF5Examples/C/H5G/16/h5ex_g_iterate.c78
-rw-r--r--HDF5Examples/C/H5G/16/h5ex_g_iterate.h5bin0 -> 2928 bytes
-rw-r--r--HDF5Examples/C/H5G/16/h5ex_g_traverse.c165
-rw-r--r--HDF5Examples/C/H5G/16/h5ex_g_traverse.h5bin0 -> 6312 bytes
-rw-r--r--HDF5Examples/C/H5G/CMakeLists.txt380
-rw-r--r--HDF5Examples/C/H5G/C_sourcefiles.cmake18
-rw-r--r--HDF5Examples/C/H5G/Makefile.am30
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_compact.c127
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_corder.c130
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_create.c45
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_intermediate.c99
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_iterate.c80
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_iterate.h5bin0 -> 2928 bytes
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_phase.c128
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_traverse.c202
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_traverse.h5bin0 -> 6312 bytes
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_visit.c121
-rw-r--r--HDF5Examples/C/H5G/h5ex_g_visit.h5bin0 -> 6312 bytes
-rwxr-xr-xHDF5Examples/C/H5G/test.sh.in199
-rw-r--r--HDF5Examples/C/H5G/tfiles/16/h5ex_g_create.ddl6
-rw-r--r--HDF5Examples/C/H5G/tfiles/16/h5ex_g_iterate.tst5
-rw-r--r--HDF5Examples/C/H5G/tfiles/16/h5ex_g_traverse.tst32
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact.tst6
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact1.ddl6
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact2.ddl6
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_corder.tst13
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_intermediate.tst5
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_phase.tst15
-rw-r--r--HDF5Examples/C/H5G/tfiles/18/h5ex_g_visit.tst19
30 files changed, 1959 insertions, 0 deletions
diff --git a/HDF5Examples/C/H5G/16/h5ex_g_create.c b/HDF5Examples/C/H5G/16/h5ex_g_create.c
new file mode 100644
index 0000000..901a0ce
--- /dev/null
+++ b/HDF5Examples/C/H5G/16/h5ex_g_create.c
@@ -0,0 +1,44 @@
+/************************************************************
+
+ This example shows how to create, open, and close a group.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+
+#define FILE "h5ex_g_create.h5"
+
+int
+main(void)
+{
+ hid_t file, group; /* Handles */
+ herr_t status;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a group named "G1" in the file.
+ */
+ group = H5Gcreate(file, "/G1", 0);
+
+ /*
+ * Close the group. The handle "group" can no longer be used.
+ */
+ status = H5Gclose(group);
+
+ /*
+ * Re-open the group, obtaining a new handle.
+ */
+ group = H5Gopen(file, "/G1");
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+}
diff --git a/HDF5Examples/C/H5G/16/h5ex_g_iterate.c b/HDF5Examples/C/H5G/16/h5ex_g_iterate.c
new file mode 100644
index 0000000..be4c45f
--- /dev/null
+++ b/HDF5Examples/C/H5G/16/h5ex_g_iterate.c
@@ -0,0 +1,78 @@
+/************************************************************
+
+ This example shows how to iterate over group members using
+ H5Giterate.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE "h5ex_g_iterate.h5"
+
+/*
+ * Operator function to be called by H5Giterate.
+ */
+herr_t op_func(hid_t loc_id, const char *name, void *operator_data);
+
+int
+main(void)
+{
+ hid_t file; /* Handle */
+ herr_t status;
+
+ /*
+ * Open file.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Begin iteration.
+ */
+ printf("Objects in root group:\n");
+ status = H5Giterate(file, "/", NULL, op_func, NULL);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Fclose(file);
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function. Prints the name and type of the object
+ being examined.
+
+ ************************************************************/
+herr_t
+op_func(hid_t loc_id, const char *name, void *operator_data)
+{
+ herr_t status;
+ H5G_stat_t statbuf;
+
+ /*
+ * Get type of the object and display its name and type.
+ * The name of the object is passed to this function by
+ * the Library.
+ */
+ status = H5Gget_objinfo(loc_id, name, 0, &statbuf);
+ switch (statbuf.type) {
+ case H5G_GROUP:
+ printf(" Group: %s\n", name);
+ break;
+ case H5G_DATASET:
+ printf(" Dataset: %s\n", name);
+ break;
+ case H5G_TYPE:
+ printf(" Datatype: %s\n", name);
+ break;
+ default:
+ printf(" Unknown: %s\n", name);
+ }
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5G/16/h5ex_g_iterate.h5 b/HDF5Examples/C/H5G/16/h5ex_g_iterate.h5
new file mode 100644
index 0000000..e462703
--- /dev/null
+++ b/HDF5Examples/C/H5G/16/h5ex_g_iterate.h5
Binary files differ
diff --git a/HDF5Examples/C/H5G/16/h5ex_g_traverse.c b/HDF5Examples/C/H5G/16/h5ex_g_traverse.c
new file mode 100644
index 0000000..2be47e0
--- /dev/null
+++ b/HDF5Examples/C/H5G/16/h5ex_g_traverse.c
@@ -0,0 +1,165 @@
+/************************************************************
+
+ This example shows a way to recursively traverse the file
+ using H5Giterate. The method shown here guarantees that
+ the recursion will not enter an infinite loop, but does
+ not prevent objects from being visited more than once.
+ The program prints the directory structure of the file
+ specified in FILE. The default file used by this example
+ implements the structure described in the User's Guide,
+ chapter 4, figure 26.
+
+ This file is intended for use with HDF5 Library version 1.6
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE "h5ex_g_traverse.h5"
+
+/*
+ * Define operator data structure type for H5Giterate callback.
+ * During recursive iteration, these structures will form a
+ * linked list that can be searched for duplicate groups,
+ * preventing infinite recursion.
+ */
+struct opdata {
+ unsigned recurs; /* recursion level. 0=root */
+ struct opdata *prev; /* pointer to previous opdata */
+ unsigned long groupno[2]; /* unique group number */
+};
+
+/*
+ * Operator function to be called by H5Giterate.
+ */
+herr_t op_func(hid_t loc_id, const char *name, void *operator_data);
+
+/*
+ * Function to check for duplicate groups in a path.
+ */
+int group_check(struct opdata *od, unsigned long target_groupno[2]);
+
+int
+main(void)
+{
+ hid_t file; /* Handle */
+ herr_t status;
+ H5G_stat_t statbuf;
+ struct opdata od;
+
+ /*
+ * Open file and initialize the operator data structure.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ status = H5Gget_objinfo(file, "/", 0, &statbuf);
+ od.recurs = 0;
+ od.prev = NULL;
+ od.groupno[0] = statbuf.objno[0];
+ od.groupno[1] = statbuf.objno[1];
+
+ /*
+ * Print the root group and formatting, begin iteration.
+ */
+ printf("/ {\n");
+ status = H5Giterate(file, "/", NULL, op_func, (void *)&od);
+ printf("}\n");
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Fclose(file);
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function. This function prints the name and type
+ of the object passed to it. If the object is a group, it
+ is first checked against other groups in its path using
+ the group_check function, then if it is not a duplicate,
+ H5Giterate is called for that group. This guarantees that
+ the program will not enter infinite recursion due to a
+ circular path in the file.
+
+ ************************************************************/
+herr_t
+op_func(hid_t loc_id, const char *name, void *operator_data)
+{
+ herr_t status, return_val = 0;
+ H5G_stat_t statbuf;
+ struct opdata *od = (struct opdata *)operator_data;
+ /* Type conversion */
+ unsigned spaces = 2 * (od->recurs + 1);
+ /* Number of whitespaces to prepend
+ to output */
+
+ /*
+ * Get type of the object and display its name and type.
+ * The name of the object is passed to this function by
+ * the Library.
+ */
+ status = H5Gget_objinfo(loc_id, name, 0, &statbuf);
+ printf("%*s", spaces, ""); /* Format output */
+ switch (statbuf.type) {
+ case H5G_GROUP:
+ printf("Group: %s {\n", name);
+
+ /*
+ * Check group objno against linked list of operator
+ * data structures. Only necessary if there is more
+ * than 1 link to the group.
+ */
+ if ((statbuf.nlink > 1) && group_check(od, statbuf.objno)) {
+ printf("%*s Warning: Loop detected!\n", spaces, "");
+ }
+ else {
+
+ /*
+ * Initialize new operator data structure and
+ * begin recursive iteration on the discovered
+ * group. The new opdata structure is given a
+ * pointer to the current one.
+ */
+ struct opdata nextod;
+ nextod.recurs = od->recurs + 1;
+ nextod.prev = od;
+ nextod.groupno[0] = statbuf.objno[0];
+ nextod.groupno[1] = statbuf.objno[1];
+ return_val = H5Giterate(loc_id, name, NULL, op_func, (void *)&nextod);
+ }
+ printf("%*s}\n", spaces, "");
+ break;
+ case H5G_DATASET:
+ printf("Dataset: %s\n", name);
+ break;
+ case H5G_TYPE:
+ printf("Datatype: %s\n", name);
+ break;
+ default:
+ printf("Unknown: %s\n", name);
+ }
+
+ return return_val;
+}
+
+/************************************************************
+
+ This function recursively searches the linked list of
+ opdata structures for one whose groupno field matches
+ target_groupno. Returns 1 if a match is found, and 0
+ otherwise.
+
+ ************************************************************/
+int
+group_check(struct opdata *od, unsigned long target_groupno[2])
+{
+ if ((od->groupno[0] == target_groupno[0]) && (od->groupno[1] == target_groupno[1]))
+ return 1; /* Group numbers match */
+ else if (!od->recurs)
+ return 0; /* Root group reached with no matches */
+ else
+ return group_check(od->prev, target_groupno);
+ /* Recursively examine the next node */
+}
diff --git a/HDF5Examples/C/H5G/16/h5ex_g_traverse.h5 b/HDF5Examples/C/H5G/16/h5ex_g_traverse.h5
new file mode 100644
index 0000000..d8267b1
--- /dev/null
+++ b/HDF5Examples/C/H5G/16/h5ex_g_traverse.h5
Binary files differ
diff --git a/HDF5Examples/C/H5G/CMakeLists.txt b/HDF5Examples/C/H5G/CMakeLists.txt
new file mode 100644
index 0000000..9aca9e7
--- /dev/null
+++ b/HDF5Examples/C/H5G/CMakeLists.txt
@@ -0,0 +1,380 @@
+cmake_minimum_required (VERSION 3.12)
+project (HDF5Examples_C_H5G)
+
+#-----------------------------------------------------------------------------
+# 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)
+ if (NOT ${example_name} STREQUAL "h5ex_g_create")
+ 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 ()
+ 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})
+# 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/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 (${example_name} STREQUAL "h5ex_g_create")
+ 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
+ )
+ endif ()
+ endforeach ()
+
+ if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8")
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_h5ex_g_compact
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/h5ex_g_compact1.ddl ${PROJECT_BINARY_DIR}/h5ex_g_compact1.ddl
+ )
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_h5ex_g_compact
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/h5ex_g_compact2.ddl ${PROJECT_BINARY_DIR}/h5ex_g_compact2.ddl
+ )
+ endif ()
+
+# 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)
+ set (exfiles
+ h5ex_g_iterate
+ h5ex_g_traverse
+ )
+ if (NOT ${H5_LIBVER_DIR} EQUAL 16)
+ set (exfiles ${exfiles}
+ h5ex_g_visit
+ )
+ endif ()
+ foreach (example ${exfiles})
+ add_custom_command (
+ TARGET ${EXAMPLE_VARNAME}_${example}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${example}.h5 ${PROJECT_BINARY_DIR}/${example}.h5
+ )
+ endforeach ()
+
+ macro (ADD_DUMP_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_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=${testname}.out"
+ -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}.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_DUMP_TEST testname)
+ 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"
+ )
+ 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_DUMP2_TEST testname)
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_${testname}-clearall
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${testname}1.h5
+ ${testname}2.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}1
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=${H5EX_HDF5_DUMP_EXECUTABLE}"
+ -D "TEST_ARGS:STRING=${testname}1.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testname}1.ddl.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=${testname}1.ddl"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_LIB_DIRECTORY}"
+ -P "${${EXAMPLE_PACKAGE_NAME}_RESOURCES_DIR}/runTest.cmake"
+ )
+ set_tests_properties (${EXAMPLE_VARNAME}_H5DUMP-${testname}1 PROPERTIES DEPENDS ${EXAMPLE_VARNAME}_${testname})
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_H5DUMP-${testname}2
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=${H5EX_HDF5_DUMP_EXECUTABLE}"
+ -D "TEST_ARGS:STRING=${testname}2.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testname}2.ddl.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=${testname}2.ddl"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_LIB_DIRECTORY}"
+ -P "${${EXAMPLE_PACKAGE_NAME}_RESOURCES_DIR}/runTest.cmake"
+ )
+ set_tests_properties (${EXAMPLE_VARNAME}_H5DUMP-${testname}2 PROPERTIES DEPENDS ${EXAMPLE_VARNAME}_H5DUMP-${testname}1)
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_CMP_TEST testname)
+ add_test (
+ NAME ${EXAMPLE_VARNAME}_${testname}-clearall
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${testname}.out.tmp
+ )
+ 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 ()
+
+ ADD_DUMP_TEST (h5ex_g_create)
+ ADD_H5_CMP_TEST (h5ex_g_iterate)
+ ADD_H5_CMP_TEST (h5ex_g_traverse)
+ if (NOT ${H5_LIBVER_DIR} EQUAL 16)
+ ADD_H5_DUMP2_TEST (h5ex_g_compact)
+ ADD_H5_CMP_TEST (h5ex_g_corder)
+ ADD_H5_CMP_TEST (h5ex_g_phase)
+ ADD_H5_CMP_TEST (h5ex_g_intermediate)
+ ADD_H5_CMP_TEST (h5ex_g_visit)
+ endif ()
+
+endif ()
diff --git a/HDF5Examples/C/H5G/C_sourcefiles.cmake b/HDF5Examples/C/H5G/C_sourcefiles.cmake
new file mode 100644
index 0000000..155453c
--- /dev/null
+++ b/HDF5Examples/C/H5G/C_sourcefiles.cmake
@@ -0,0 +1,18 @@
+#-----------------------------------------------------------------------------
+# Define Sources, one file per application
+#-----------------------------------------------------------------------------
+set (examples)
+
+set (common_examples
+ h5ex_g_create
+ h5ex_g_iterate
+ h5ex_g_traverse
+ )
+
+set (1_8_examples
+ h5ex_g_compact
+ h5ex_g_corder
+ h5ex_g_phase
+ h5ex_g_intermediate
+ h5ex_g_visit
+)
diff --git a/HDF5Examples/C/H5G/Makefile.am b/HDF5Examples/C/H5G/Makefile.am
new file mode 100644
index 0000000..9dc4dcf
--- /dev/null
+++ b/HDF5Examples/C/H5G/Makefile.am
@@ -0,0 +1,30 @@
+#
+# 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_g_create h5ex_g_iterate h5ex_g_traverse \
+h5ex_g_compact h5ex_g_corder h5ex_g_intermediate h5ex_g_phase h5ex_g_visit
+
+EXTRA_DIST = tfiles/h5ex_g_create.ddl tfiles/h5ex_g_iterate.tst tfiles/h5ex_g_traverse.tst \
+tfiles/h5ex_g_compact1.ddl tfiles/h5ex_g_compact2.ddl tfiles/h5ex_g_corder.tst \
+tfiles/h5ex_g_intermediate.tst tfiles/h5ex_g_phase.tst tfiles/h5ex_g_visit.tst \
+h5ex_g_iterate.h5 h5ex_g_traverse.h5 h5ex_g_visit.h5 \
+test.sh
+
+TESTS = test.sh
+
+CLEANFILES = Makefile test.sh
diff --git a/HDF5Examples/C/H5G/h5ex_g_compact.c b/HDF5Examples/C/H5G/h5ex_g_compact.c
new file mode 100644
index 0000000..6733612
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_compact.c
@@ -0,0 +1,127 @@
+/************************************************************
+
+ This example shows how to create "compact-or-indexed"
+ format groups, new to 1.8. This example also illustrates
+ the space savings of compact groups by creating 2 files
+ which are identical except for the group format, and
+ displaying the file size of each. Both files have one
+ empty group in the root group.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE1 "h5ex_g_compact1.h5"
+#define FILE2 "h5ex_g_compact2.h5"
+#define GROUP "G1"
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID;
+ hid_t group = H5I_INVALID_HID;
+ hid_t fapl = H5I_INVALID_HID;
+ herr_t status;
+ H5G_info_t ginfo;
+ hsize_t size;
+
+ /*
+ * Create file 1. This file will use original format groups.
+ */
+ file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate(file, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Obtain the group info and print the group storage type.
+ */
+ status = H5Gget_info(group, &ginfo);
+ printf("Group storage type for %s is: ", FILE1);
+ switch (ginfo.storage_type) {
+ case H5G_STORAGE_TYPE_COMPACT:
+ printf("H5G_STORAGE_TYPE_COMPACT\n"); /* New compact format */
+ break;
+ case H5G_STORAGE_TYPE_DENSE:
+ printf("H5G_STORAGE_TYPE_DENSE\n"); /* New dense (indexed) format */
+ break;
+ case H5G_STORAGE_TYPE_SYMBOL_TABLE:
+ printf("H5G_STORAGE_TYPE_SYMBOL_TABLE\n"); /* Original format */
+ break;
+ case H5G_STORAGE_TYPE_UNKNOWN:
+ printf("H5G_STORAGE_TYPE_UNKNOWN\n"); /* Unknown format */
+ }
+
+ /*
+ * Close and re-open file. Needed to get the correct file size.
+ */
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+ file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Obtain and print the file size.
+ */
+ status = H5Fget_filesize(file, &size);
+ printf("File size for %s is: %d bytes\n\n", FILE1, (int)size);
+
+ /*
+ * Close FILE1.
+ */
+ status = H5Fclose(file);
+
+ /*
+ * Set file access property list to allow the latest file format.
+ * This will allow the library to create new compact format groups.
+ */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+
+ /*
+ * Create file 2 using the new file access property list.
+ */
+ file = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ group = H5Gcreate(file, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Obtain the group info and print the group storage type.
+ */
+ status = H5Gget_info(group, &ginfo);
+ printf("Group storage type for %s is: ", FILE2);
+ switch (ginfo.storage_type) {
+ case H5G_STORAGE_TYPE_COMPACT:
+ printf("H5G_STORAGE_TYPE_COMPACT\n"); /* New compact format */
+ break;
+ case H5G_STORAGE_TYPE_DENSE:
+ printf("H5G_STORAGE_TYPE_DENSE\n"); /* New dense (indexed) format */
+ break;
+ case H5G_STORAGE_TYPE_SYMBOL_TABLE:
+ printf("H5G_STORAGE_TYPE_SYMBOL_TABLE\n"); /* Original format */
+ break;
+ case H5G_STORAGE_TYPE_UNKNOWN:
+ printf("H5G_STORAGE_TYPE_UNKNOWN\n"); /* Unknown format */
+ }
+
+ /*
+ * Close and re-open file. Needed to get the correct file size.
+ */
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+ file = H5Fopen(FILE2, H5F_ACC_RDONLY, fapl);
+
+ /*
+ * Obtain and print the file size.
+ */
+ status = H5Fget_filesize(file, &size);
+ printf("File size for %s is: %d bytes\n", FILE2, (int)size);
+ printf("\n");
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Pclose(fapl);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_corder.c b/HDF5Examples/C/H5G/h5ex_g_corder.c
new file mode 100644
index 0000000..aa7a1af
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_corder.c
@@ -0,0 +1,130 @@
+/************************************************************
+
+ This example shows how to track links in a group by
+ creation order. The program creates a series of groups,
+ then reads back their names: first in alphabetical order,
+ then in creation order.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FILE "h5ex_g_corder.h5"
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID;
+ hid_t group = H5I_INVALID_HID;
+ hid_t subgroup = H5I_INVALID_HID;
+ hid_t gcpl = H5I_INVALID_HID;
+ herr_t status;
+ H5G_info_t ginfo;
+ ssize_t size; /* Size of name */
+ hsize_t i; /* Index */
+ char *name = NULL; /* Output buffer */
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create group creation property list and enable link creation
+ * order tracking. Attempting to track by creation order in a
+ * group that does not have this property set will result in an
+ * error.
+ */
+ gcpl = H5Pcreate(H5P_GROUP_CREATE);
+ status = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
+
+ /*
+ * Create primary group using the property list.
+ */
+ group = H5Gcreate(file, "index_group", H5P_DEFAULT, gcpl, H5P_DEFAULT);
+
+ /*
+ * Create subgroups in the primary group. These will be tracked
+ * by creation order. Note that these groups do not have to have
+ * the creation order tracking property set.
+ */
+ subgroup = H5Gcreate(group, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(subgroup);
+ subgroup = H5Gcreate(group, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(subgroup);
+ subgroup = H5Gcreate(group, "F", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(subgroup);
+ subgroup = H5Gcreate(group, "5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(subgroup);
+
+ /*
+ * Get group info.
+ */
+ status = H5Gget_info(group, &ginfo);
+
+ /*
+ * Traverse links in the primary group using alphabetical indices
+ * (H5_INDEX_NAME).
+ */
+ printf("Traversing group using alphabetical indices:\n\n");
+ for (i = 0; i < ginfo.nlinks; i++) {
+
+ /*
+ * Get size of name, add 1 for null terminator.
+ */
+ size = 1 + H5Lget_name_by_idx(group, ".", H5_INDEX_NAME, H5_ITER_INC, i, NULL, 0, H5P_DEFAULT);
+
+ /*
+ * Allocate storage for name.
+ */
+ name = (char *)malloc(size);
+
+ /*
+ * Retrieve name, print it, and free the previously allocated
+ * space.
+ */
+ size = H5Lget_name_by_idx(group, ".", H5_INDEX_NAME, H5_ITER_INC, i, name, (size_t)size, H5P_DEFAULT);
+ printf("Index %d: %s\n", (int)i, name);
+ free(name);
+ }
+
+ /*
+ * Traverse links in the primary group by creation order
+ * (H5_INDEX_CRT_ORDER).
+ */
+ printf("\nTraversing group using creation order indices:\n\n");
+ for (i = 0; i < ginfo.nlinks; i++) {
+
+ /*
+ * Get size of name, add 1 for null terminator.
+ */
+ size = 1 + H5Lget_name_by_idx(group, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i, NULL, 0, H5P_DEFAULT);
+
+ /*
+ * Allocate storage for name.
+ */
+ name = (char *)malloc(size);
+
+ /*
+ * Retrieve name, print it, and free the previously allocated
+ * space.
+ */
+ size = H5Lget_name_by_idx(group, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i, name, (size_t)size,
+ H5P_DEFAULT);
+ printf("Index %d: %s\n", (int)i, name);
+ free(name);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Pclose(gcpl);
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_create.c b/HDF5Examples/C/H5G/h5ex_g_create.c
new file mode 100644
index 0000000..d7bb156
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_create.c
@@ -0,0 +1,45 @@
+/************************************************************
+
+ This example shows how to create, open, and close a group.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+
+#define FILE "h5ex_g_create.h5"
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID;
+ hid_t group = H5I_INVALID_HID;
+ herr_t status;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a group named "G1" in the file.
+ */
+ group = H5Gcreate(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Close the group. The handle "group" can no longer be used.
+ */
+ status = H5Gclose(group);
+
+ /*
+ * Re-open the group, obtaining a new handle.
+ */
+ group = H5Gopen(file, "/G1", H5P_DEFAULT);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_intermediate.c b/HDF5Examples/C/H5G/h5ex_g_intermediate.c
new file mode 100644
index 0000000..55c8c64
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_intermediate.c
@@ -0,0 +1,99 @@
+/************************************************************
+
+ This example shows how to create intermediate groups with
+ a single call to H5Gcreate.
+
+ ************************************************************/
+
+#include "hdf5.h"
+
+#define FILE "h5ex_g_intermediate.h5"
+
+/*
+ * Operator function to be called by H5Ovisit.
+ */
+herr_t op_func(hid_t loc_id, const char *name, const H5O_info_t *info, void *operator_data);
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID;
+ hid_t group = H5I_INVALID_HID;
+ hid_t gcpl = H5I_INVALID_HID;
+ herr_t status;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create group creation property list and set it to allow creation
+ * of intermediate groups.
+ */
+ gcpl = H5Pcreate(H5P_LINK_CREATE);
+ status = H5Pset_create_intermediate_group(gcpl, 1);
+
+ /*
+ * Create the group /G1/G2/G3. Note that /G1 and /G1/G2 do not
+ * exist yet. This call would cause an error if we did not use the
+ * previously created property list.
+ */
+ group = H5Gcreate(file, "/G1/G2/G3", gcpl, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Print all the objects in the files to show that intermediate
+ * groups have been created. See h5ex_g_visit for more information
+ * on how to use H5Ovisit.
+ */
+ printf("Objects in the file:\n");
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, op_func, NULL, H5O_INFO_ALL);
+#else
+ status = H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, op_func, NULL);
+#endif
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Pclose(gcpl);
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function for H5Ovisit. This function prints the
+ name and type of the object passed to it.
+
+ ************************************************************/
+herr_t
+op_func(hid_t loc_id, const char *name, const H5O_info_t *info, void *operator_data)
+{
+ printf("/"); /* Print root group in object path */
+
+ /*
+ * Check if the current object is the root group, and if not print
+ * the full path name and type.
+ */
+ if (name[0] == '.') /* Root group, do not print '.' */
+ printf(" (Group)\n");
+ else
+ switch (info->type) {
+ case H5O_TYPE_GROUP:
+ printf("%s (Group)\n", name);
+ break;
+ case H5O_TYPE_DATASET:
+ printf("%s (Dataset)\n", name);
+ break;
+ case H5O_TYPE_NAMED_DATATYPE:
+ printf("%s (Datatype)\n", name);
+ break;
+ default:
+ printf("%s (Unknown)\n", name);
+ }
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_iterate.c b/HDF5Examples/C/H5G/h5ex_g_iterate.c
new file mode 100644
index 0000000..1d9d3d5
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_iterate.c
@@ -0,0 +1,80 @@
+/************************************************************
+
+ This example shows how to iterate over group members using
+ H5Literate.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE "h5ex_g_iterate.h5"
+
+/*
+ * Operator function to be called by H5Literate.
+ */
+herr_t op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data);
+
+int
+main(void)
+{
+ hid_t file; /* Handle */
+ herr_t status;
+
+ /*
+ * Open file.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Begin iteration.
+ */
+ printf("Objects in root group:\n");
+ status = H5Literate(file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, NULL);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Fclose(file);
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function. Prints the name and type of the object
+ being examined.
+
+ ************************************************************/
+herr_t
+op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data)
+{
+ herr_t status;
+ H5O_info_t infobuf;
+
+ /*
+ * Get type of the object and display its name and type.
+ * The name of the object is passed to this function by
+ * the Library.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Oget_info_by_name(loc_id, name, &infobuf, H5O_INFO_ALL, H5P_DEFAULT);
+#else
+ status = H5Oget_info_by_name(loc_id, name, &infobuf, H5P_DEFAULT);
+#endif
+ switch (infobuf.type) {
+ case H5O_TYPE_GROUP:
+ printf(" Group: %s\n", name);
+ break;
+ case H5O_TYPE_DATASET:
+ printf(" Dataset: %s\n", name);
+ break;
+ case H5O_TYPE_NAMED_DATATYPE:
+ printf(" Datatype: %s\n", name);
+ break;
+ default:
+ printf(" Unknown: %s\n", name);
+ }
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_iterate.h5 b/HDF5Examples/C/H5G/h5ex_g_iterate.h5
new file mode 100644
index 0000000..6576e8f
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_iterate.h5
Binary files differ
diff --git a/HDF5Examples/C/H5G/h5ex_g_phase.c b/HDF5Examples/C/H5G/h5ex_g_phase.c
new file mode 100644
index 0000000..b87c0a4
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_phase.c
@@ -0,0 +1,128 @@
+/************************************************************
+
+ This example shows how to set the conditions for
+ conversion between compact and dense (indexed) groups.
+
+ This file is intended for use with HDF5 Library version 1.8
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE "h5ex_g_phase.h5"
+#define MAX_GROUPS 7
+#define MAX_COMPACT 5
+#define MIN_DENSE 3
+
+int
+main(void)
+{
+ hid_t file, group, subgroup, fapl, gcpl; /* Handles */
+ herr_t status;
+ H5G_info_t ginfo;
+ char name[3] = "G0"; /* Name of subgroup */
+ unsigned i;
+
+ /*
+ * Set file access property list to allow the latest file format.
+ * This will allow the library to create new format groups.
+ */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+
+ /*
+ * Create group access property list and set the phase change
+ * conditions. In this example we lowered the conversion threshold
+ * to simplify the output, though this may not be optimal.
+ */
+ gcpl = H5Pcreate(H5P_GROUP_CREATE);
+ status = H5Pset_link_phase_change(gcpl, MAX_COMPACT, MIN_DENSE);
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+
+ /*
+ * Create primary group.
+ */
+ group = H5Gcreate(file, name, H5P_DEFAULT, gcpl, H5P_DEFAULT);
+
+ /*
+ * Add subgroups to "group" one at a time, print the storage type
+ * for "group" after each subgroup is created.
+ */
+ for (i = 1; i <= MAX_GROUPS; i++) {
+
+ /*
+ * Define the subgroup name and create the subgroup.
+ */
+ name[1] = ((char)i) + '0'; /* G1, G2, G3 etc. */
+ subgroup = H5Gcreate(group, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(subgroup);
+
+ /*
+ * Obtain the group info and print the group storage type
+ */
+ status = H5Gget_info(group, &ginfo);
+ printf("%d Group%s: Storage type is ", (int)ginfo.nlinks, ginfo.nlinks == 1 ? " " : "s");
+ switch (ginfo.storage_type) {
+ case H5G_STORAGE_TYPE_COMPACT:
+ printf("H5G_STORAGE_TYPE_COMPACT\n"); /* New compact format */
+ break;
+ case H5G_STORAGE_TYPE_DENSE:
+ printf("H5G_STORAGE_TYPE_DENSE\n"); /* New dense (indexed) format */
+ break;
+ case H5G_STORAGE_TYPE_SYMBOL_TABLE:
+ printf("H5G_STORAGE_TYPE_SYMBOL_TABLE\n"); /* Original format */
+ break;
+ case H5G_STORAGE_TYPE_UNKNOWN:
+ printf("H5G_STORAGE_TYPE_UNKNOWN\n"); /* Unknown format */
+ }
+ }
+
+ printf("\n");
+
+ /*
+ * Delete subgroups one at a time, print the storage type for
+ * "group" after each subgroup is deleted.
+ */
+ for (i = MAX_GROUPS; i >= 1; i--) {
+
+ /*
+ * Define the subgroup name and delete the subgroup.
+ */
+ name[1] = ((char)i) + '0'; /* G1, G2, G3 etc. */
+ status = H5Ldelete(group, name, H5P_DEFAULT);
+
+ /*
+ * Obtain the group info and print the group storage type
+ */
+ status = H5Gget_info(group, &ginfo);
+ printf("%d Group%s: Storage type is ", (int)ginfo.nlinks, ginfo.nlinks == 1 ? " " : "s");
+ switch (ginfo.storage_type) {
+ case H5G_STORAGE_TYPE_COMPACT:
+ printf("H5G_STORAGE_TYPE_COMPACT\n"); /* New compact format */
+ break;
+ case H5G_STORAGE_TYPE_DENSE:
+ printf("H5G_STORAGE_TYPE_DENSE\n"); /* New dense (indexed) format */
+ break;
+ case H5G_STORAGE_TYPE_SYMBOL_TABLE:
+ printf("H5G_STORAGE_TYPE_SYMBOL_TABLE\n"); /* Original format */
+ break;
+ case H5G_STORAGE_TYPE_UNKNOWN:
+ printf("H5G_STORAGE_TYPE_UNKNOWN\n"); /* Unknown format */
+ }
+ }
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Pclose(fapl);
+ status = H5Pclose(gcpl);
+ status = H5Gclose(group);
+ status = H5Fclose(file);
+
+ return 0;
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_traverse.c b/HDF5Examples/C/H5G/h5ex_g_traverse.c
new file mode 100644
index 0000000..e1099c8
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_traverse.c
@@ -0,0 +1,202 @@
+/************************************************************
+
+ This example shows a way to recursively traverse the file
+ using H5Literate. The method shown here guarantees that
+ the recursion will not enter an infinite loop, but does
+ not prevent objects from being visited more than once.
+ The program prints the directory structure of the file
+ specified in FILE. The default file used by this example
+ implements the structure described in the User's Guide,
+ chapter 4, figure 26.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE "h5ex_g_traverse.h5"
+
+/*
+ * Define operator data structure type for H5Literate callback.
+ * During recursive iteration, these structures will form a
+ * linked list that can be searched for duplicate groups,
+ * preventing infinite recursion.
+ */
+struct opdata {
+ unsigned recurs; /* Recursion level. 0=root */
+ struct opdata *prev; /* Pointer to previous opdata */
+ haddr_t addr; /* Group address */
+};
+
+/*
+ * Operator function to be called by H5Literate.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+herr_t op_func(hid_t loc_id, const char *name, const H5L_info1_t *info, void *operator_data);
+#else
+herr_t op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data);
+#endif
+
+/*
+ * Function to check for duplicate groups in a path.
+ */
+int group_check(struct opdata *od, haddr_t target_addr);
+
+int
+main(void)
+{
+ hid_t file; /* Handle */
+ herr_t status;
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ H5O_info1_t infobuf;
+#else
+ H5O_info_t infobuf;
+#endif
+ struct opdata od;
+
+ /*
+ * Open file and initialize the operator data structure.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Oget_info2(file, &infobuf, H5O_INFO_ALL);
+#else
+ status = H5Oget_info(file, &infobuf);
+#endif
+ od.recurs = 0;
+ od.prev = NULL;
+ od.addr = infobuf.addr;
+
+ /*
+ * Print the root group and formatting, begin iteration.
+ */
+ printf("/ {\n");
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Literate1(file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, (void *)&od);
+#else
+ status = H5Literate(file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, (void *)&od);
+#endif
+ printf("}\n");
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Fclose(file);
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function. This function prints the name and type
+ of the object passed to it. If the object is a group, it
+ is first checked against other groups in its path using
+ the group_check function, then if it is not a duplicate,
+ H5Literate is called for that group. This guarantees that
+ the program will not enter infinite recursion due to a
+ circular path in the file.
+
+ ************************************************************/
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+herr_t
+op_func(hid_t loc_id, const char *name, const H5L_info1_t *info, void *operator_data)
+#else
+herr_t
+op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data)
+#endif
+{
+ herr_t status, return_val = 0;
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ H5O_info1_t infobuf;
+#else
+ H5O_info_t infobuf;
+#endif
+ struct opdata *od = (struct opdata *)operator_data;
+ /* Type conversion */
+ unsigned spaces = 2 * (od->recurs + 1);
+ /* Number of whitespaces to prepend
+ to output */
+
+ /*
+ * Get type of the object and display its name and type.
+ * The name of the object is passed to this function by
+ * the Library.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Oget_info_by_name2(loc_id, name, &infobuf, H5O_INFO_ALL, H5P_DEFAULT);
+#else
+ status = H5Oget_info_by_name(loc_id, name, &infobuf, H5P_DEFAULT);
+#endif
+ printf("%*s", spaces, ""); /* Format output */
+ switch (infobuf.type) {
+ case H5O_TYPE_GROUP:
+ printf("Group: %s {\n", name);
+
+ /*
+ * Check group address against linked list of operator
+ * data structures. We will always run the check, as the
+ * reference count cannot be relied upon if there are
+ * symbolic links, and H5Oget_info_by_name always follows
+ * symbolic links. Alternatively we could use H5Lget_info
+ * and never recurse on groups discovered by symbolic
+ * links, however it could still fail if an object's
+ * reference count was manually manipulated with
+ * H5Odecr_refcount.
+ */
+ if (group_check(od, infobuf.addr)) {
+ printf("%*s Warning: Loop detected!\n", spaces, "");
+ }
+ else {
+
+ /*
+ * Initialize new operator data structure and
+ * begin recursive iteration on the discovered
+ * group. The new opdata structure is given a
+ * pointer to the current one.
+ */
+ struct opdata nextod;
+ nextod.recurs = od->recurs + 1;
+ nextod.prev = od;
+ nextod.addr = infobuf.addr;
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ return_val = H5Literate_by_name1(loc_id, name, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func,
+ (void *)&nextod, H5P_DEFAULT);
+#else
+ return_val = H5Literate_by_name(loc_id, name, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func,
+ (void *)&nextod, H5P_DEFAULT);
+#endif
+ }
+ printf("%*s}\n", spaces, "");
+ break;
+ case H5O_TYPE_DATASET:
+ printf("Dataset: %s\n", name);
+ break;
+ case H5O_TYPE_NAMED_DATATYPE:
+ printf("Datatype: %s\n", name);
+ break;
+ default:
+ printf("Unknown: %s\n", name);
+ }
+
+ return return_val;
+}
+
+/************************************************************
+
+ This function recursively searches the linked list of
+ opdata structures for one whose address matches
+ target_addr. Returns 1 if a match is found, and 0
+ otherwise.
+
+ ************************************************************/
+int
+group_check(struct opdata *od, haddr_t target_addr)
+{
+ if (od->addr == target_addr)
+ return 1; /* Addresses match */
+ else if (!od->recurs)
+ return 0; /* Root group reached with no matches */
+ else
+ return group_check(od->prev, target_addr);
+ /* Recursively examine the next node */
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_traverse.h5 b/HDF5Examples/C/H5G/h5ex_g_traverse.h5
new file mode 100644
index 0000000..3d5d301
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_traverse.h5
Binary files differ
diff --git a/HDF5Examples/C/H5G/h5ex_g_visit.c b/HDF5Examples/C/H5G/h5ex_g_visit.c
new file mode 100644
index 0000000..6f64520
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_visit.c
@@ -0,0 +1,121 @@
+/************************************************************
+
+ This example shows how to recursively traverse a file
+ using H5Ovisit and H5Lvisit. The program prints all of
+ the objects in the file specified in FILE, then prints all
+ of the links in that file. The default file used by this
+ example implements the structure described in the User's
+ Guide, chapter 4, figure 26.
+
+ ************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+
+#define FILE "h5ex_g_visit.h5"
+
+/*
+ * Operator function to be called by H5Ovisit.
+ */
+herr_t op_func(hid_t loc_id, const char *name, const H5O_info_t *info, void *operator_data);
+
+/*
+ * Operator function to be called by H5Lvisit.
+ */
+herr_t op_func_L(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data);
+
+int
+main(void)
+{
+ hid_t file = H5I_INVALID_HID;
+ herr_t status;
+
+ /*
+ * Open file
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Begin iteration using H5Ovisit
+ */
+ printf("Objects in the file:\n");
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, op_func, NULL, H5O_INFO_ALL);
+#else
+ status = H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, op_func, NULL);
+#endif
+
+ /*
+ * Repeat the same process using H5Lvisit
+ */
+ printf("\nLinks in the file:\n");
+ status = H5Lvisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, op_func_L, NULL);
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Fclose(file);
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function for H5Ovisit. This function prints the
+ name and type of the object passed to it.
+
+ ************************************************************/
+herr_t
+op_func(hid_t loc_id, const char *name, const H5O_info_t *info, void *operator_data)
+{
+ printf("/"); /* Print root group in object path */
+
+ /*
+ * Check if the current object is the root group, and if not print
+ * the full path name and type.
+ */
+ if (name[0] == '.') /* Root group, do not print '.' */
+ printf(" (Group)\n");
+ else
+ switch (info->type) {
+ case H5O_TYPE_GROUP:
+ printf("%s (Group)\n", name);
+ break;
+ case H5O_TYPE_DATASET:
+ printf("%s (Dataset)\n", name);
+ break;
+ case H5O_TYPE_NAMED_DATATYPE:
+ printf("%s (Datatype)\n", name);
+ break;
+ default:
+ printf("%s (Unknown)\n", name);
+ }
+
+ return 0;
+}
+
+/************************************************************
+
+ Operator function for H5Lvisit. This function simply
+ retrieves the info for the object the current link points
+ to, and calls the operator function for H5Ovisit.
+
+ ************************************************************/
+herr_t
+op_func_L(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data)
+{
+ herr_t status;
+ H5O_info_t infobuf;
+
+ /*
+ * Get type of the object and display its name and type.
+ * The name of the object is passed to this function by
+ * the Library.
+ */
+#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
+ status = H5Oget_info_by_name(loc_id, name, &infobuf, H5O_INFO_ALL, H5P_DEFAULT);
+#else
+ status = H5Oget_info_by_name(loc_id, name, &infobuf, H5P_DEFAULT);
+#endif
+ return op_func(loc_id, name, &infobuf, operator_data);
+}
diff --git a/HDF5Examples/C/H5G/h5ex_g_visit.h5 b/HDF5Examples/C/H5G/h5ex_g_visit.h5
new file mode 100644
index 0000000..3d5d301
--- /dev/null
+++ b/HDF5Examples/C/H5G/h5ex_g_visit.h5
Binary files differ
diff --git a/HDF5Examples/C/H5G/test.sh.in b/HDF5Examples/C/H5G/test.sh.in
new file mode 100755
index 0000000..f12c4a5
--- /dev/null
+++ b/HDF5Examples/C/H5G/test.sh.in
@@ -0,0 +1,199 @@
+#! /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 $*
+}
+
+H5_LIBVER=@H5_LIBVER@
+H5_LIBVER_DIR=@H5_LIBVER_DIR@
+
+return_val=0
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_create...$ECHO_C"
+./h5ex_g_create
+dumpout h5ex_g_create.h5 >tmp.test
+rm -f h5ex_g_create.h5
+cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_create.ddl
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_iterate...$ECHO_C"
+if test -f h5ex_g_iterate.h5
+then
+ exout ./h5ex_g_iterate >tmp.test
+else
+ cp $srcdir/h5ex_g_iterate.h5 h5ex_g_iterate.h5
+ exout ./h5ex_g_iterate >tmp.test
+ rm -f h5ex_g_iterate.h5
+fi
+cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_iterate.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_traverse...$ECHO_C"
+if test -f h5ex_g_traverse.h5
+then
+ exout ./h5ex_g_traverse >tmp.test
+else
+ cp $srcdir/h5ex_g_traverse.h5 h5ex_g_traverse.h5
+ exout ./h5ex_g_traverse >tmp.test
+ rm -f h5ex_g_traverse.h5
+fi
+cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_traverse.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_visit...$ECHO_C"
+if test -f h5ex_g_visit.h5
+then
+ exout ./h5ex_g_visit >tmp.test
+else
+ cp $srcdir/h5ex_g_visit.h5 h5ex_g_visit.h5
+ exout ./h5ex_g_visit >tmp.test
+ rm -f h5ex_g_visit.h5
+fi
+cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_visit.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_compact...$ECHO_C"
+exout ./h5ex_g_compact >tmp.test
+cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ dumpout h5ex_g_compact1.h5 >tmp.test
+ cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact1.ddl
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ dumpout h5ex_g_compact2.h5 >tmp.test
+ cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact2.ddl
+ status=$?
+ if test $status -ne 0
+ then
+ echo " FAILED!"
+ else
+ echo " Passed"
+ fi
+ fi
+fi
+return_val=`expr $status + $return_val`
+rm -f h5ex_g_compact1.h5
+rm -f h5ex_g_compact2.h5
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_phase...$ECHO_C"
+exout ./h5ex_g_phase >tmp.test
+cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_phase.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+rm -f h5ex_g_phase.h5
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_corder...$ECHO_C"
+exout ./h5ex_g_corder >tmp.test
+cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_corder.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+rm -f h5ex_g_corder.h5
+
+
+$ECHO_N "Testing C/H5G/h5ex_g_intermediate...$ECHO_C"
+exout ./h5ex_g_intermediate >tmp.test
+cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_intermediate.tst
+status=$?
+if test $status -ne 0
+then
+ echo " FAILED!"
+else
+ echo " Passed"
+fi
+return_val=`expr $status + $return_val`
+rm -f h5ex_g_intermediate.h5
+
+
+rm -f tmp.test
+echo "$return_val tests failed in C/H5G/"
+exit $return_val
diff --git a/HDF5Examples/C/H5G/tfiles/16/h5ex_g_create.ddl b/HDF5Examples/C/H5G/tfiles/16/h5ex_g_create.ddl
new file mode 100644
index 0000000..d180d82
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/16/h5ex_g_create.ddl
@@ -0,0 +1,6 @@
+HDF5 "h5ex_g_create.h5" {
+GROUP "/" {
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5G/tfiles/16/h5ex_g_iterate.tst b/HDF5Examples/C/H5G/tfiles/16/h5ex_g_iterate.tst
new file mode 100644
index 0000000..66a4ae9
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/16/h5ex_g_iterate.tst
@@ -0,0 +1,5 @@
+Objects in root group:
+ Dataset: DS1
+ Datatype: DT1
+ Group: G1
+ Dataset: L1
diff --git a/HDF5Examples/C/H5G/tfiles/16/h5ex_g_traverse.tst b/HDF5Examples/C/H5G/tfiles/16/h5ex_g_traverse.tst
new file mode 100644
index 0000000..9d44d2f
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/16/h5ex_g_traverse.tst
@@ -0,0 +1,32 @@
+/ {
+ Group: group1 {
+ Dataset: dset1
+ Group: group3 {
+ Dataset: dset2
+ Group: group4 {
+ Group: group1 {
+ Group: group5 {
+ Warning: Loop detected!
+ }
+ }
+ Group: group2 {
+ }
+ }
+ }
+ }
+ Group: group2 {
+ Dataset: dset2
+ Group: group4 {
+ Group: group1 {
+ Group: group5 {
+ Dataset: dset1
+ Group: group3 {
+ Warning: Loop detected!
+ }
+ }
+ }
+ Group: group2 {
+ }
+ }
+ }
+}
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact.tst b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact.tst
new file mode 100644
index 0000000..8ced62d
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact.tst
@@ -0,0 +1,6 @@
+Group storage type for h5ex_g_compact1.h5 is: H5G_STORAGE_TYPE_SYMBOL_TABLE
+File size for h5ex_g_compact1.h5 is: 1832 bytes
+
+Group storage type for h5ex_g_compact2.h5 is: H5G_STORAGE_TYPE_COMPACT
+File size for h5ex_g_compact2.h5 is: 342 bytes
+
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact1.ddl b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact1.ddl
new file mode 100644
index 0000000..9bcd0a0
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact1.ddl
@@ -0,0 +1,6 @@
+HDF5 "h5ex_g_compact1.h5" {
+GROUP "/" {
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact2.ddl b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact2.ddl
new file mode 100644
index 0000000..0016bb9
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_compact2.ddl
@@ -0,0 +1,6 @@
+HDF5 "h5ex_g_compact2.h5" {
+GROUP "/" {
+ GROUP "G1" {
+ }
+}
+}
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_corder.tst b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_corder.tst
new file mode 100644
index 0000000..9c07737
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_corder.tst
@@ -0,0 +1,13 @@
+Traversing group using alphabetical indices:
+
+Index 0: 5
+Index 1: D
+Index 2: F
+Index 3: H
+
+Traversing group using creation order indices:
+
+Index 0: H
+Index 1: D
+Index 2: F
+Index 3: 5
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_intermediate.tst b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_intermediate.tst
new file mode 100644
index 0000000..b524067
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_intermediate.tst
@@ -0,0 +1,5 @@
+Objects in the file:
+/ (Group)
+/G1 (Group)
+/G1/G2 (Group)
+/G1/G2/G3 (Group)
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_phase.tst b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_phase.tst
new file mode 100644
index 0000000..9e666d4
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_phase.tst
@@ -0,0 +1,15 @@
+1 Group : Storage type is H5G_STORAGE_TYPE_COMPACT
+2 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT
+3 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT
+4 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT
+5 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT
+6 Groups: Storage type is H5G_STORAGE_TYPE_DENSE
+7 Groups: Storage type is H5G_STORAGE_TYPE_DENSE
+
+6 Groups: Storage type is H5G_STORAGE_TYPE_DENSE
+5 Groups: Storage type is H5G_STORAGE_TYPE_DENSE
+4 Groups: Storage type is H5G_STORAGE_TYPE_DENSE
+3 Groups: Storage type is H5G_STORAGE_TYPE_DENSE
+2 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT
+1 Group : Storage type is H5G_STORAGE_TYPE_COMPACT
+0 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT
diff --git a/HDF5Examples/C/H5G/tfiles/18/h5ex_g_visit.tst b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_visit.tst
new file mode 100644
index 0000000..126a588
--- /dev/null
+++ b/HDF5Examples/C/H5G/tfiles/18/h5ex_g_visit.tst
@@ -0,0 +1,19 @@
+Objects in the file:
+/ (Group)
+/group1 (Group)
+/group1/dset1 (Dataset)
+/group1/group3 (Group)
+/group1/group3/group4 (Group)
+/group1/group3/group4/group1 (Group)
+/group1/group3/group4/group2 (Group)
+
+Links in the file:
+/group1 (Group)
+/group1/dset1 (Dataset)
+/group1/group3 (Group)
+/group1/group3/dset2 (Dataset)
+/group1/group3/group4 (Group)
+/group1/group3/group4/group1 (Group)
+/group1/group3/group4/group1/group5 (Group)
+/group1/group3/group4/group2 (Group)
+/group2 (Group)