summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dumpgentest.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-05-12 20:20:00 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-05-12 20:20:00 (GMT)
commit20c6bdda65bb2e069701c759057d4535e53d4898 (patch)
treea0d786c1e8a4c52b716c5974599d57a1095b0350 /tools/h5dump/h5dumpgentest.c
parentf02082b56859a96ae591fe06c82e619dff4c35c2 (diff)
downloadhdf5-20c6bdda65bb2e069701c759057d4535e53d4898.zip
hdf5-20c6bdda65bb2e069701c759057d4535e53d4898.tar.gz
hdf5-20c6bdda65bb2e069701c759057d4535e53d4898.tar.bz2
[svn-r14978] Support for external links follow up. The format is to print the target object as part of TARGETPATH, noted with some extra indentation
The previous printing of LINKCLASS 64 was removed HDF5 "textlinksrc.h5" { GROUP "/" { EXTERNAL_LINK "ext_link1" { TARGETFILE "textlinktar.h5" TARGETPATH "dset" DATASET "dset" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { (0): 1, 2, 3, 4, 5, 6 } } } } } There is no script test for this behavior so far, because test script uses complete paths that vary from test to test, making not possible to define a valid TARGETFILE in the file tested: windows, linux, solaris
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r--tools/h5dump/h5dumpgentest.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 270f2ee..63cb1e8 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -88,6 +88,9 @@
#define FILE58 "tordergr.h5"
#define FILE59 "torderattr.h5"
#define FILE60 "tfpformat.h5"
+#define FILE61 "textlinksrc.h5"
+#define FILE62 "textlinktar.h5"
+
@@ -5544,14 +5547,14 @@ error:
* Contains:
* 1) an integer dataset
* 2) a float dataset
- * 4) a double dataset
+ * 3) a double dataset
*
*-------------------------------------------------------------------------
*/
static void
gent_binary(void)
{
- hid_t fid, sid, did, tid;
+ hid_t fid, sid, did;
hsize_t dims[1] = {6};
int ibuf[6] = {1,2,3,4,5,6};
float fbuf[6] = {1,2,3,4,5,6};
@@ -6175,6 +6178,67 @@ gent_fpformat(void)
}
/*-------------------------------------------------------------------------
+ * Function: gent_extlinks
+ *
+ * Purpose: Generate 2 files to be used in the external links test
+ * External links point from one HDF5 file to an object (Group, Dataset, or
+ * committed Datatype) in another file.
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_extlinks(void)
+{
+ hid_t source_fid, target_fid, sid, did, gid, tid;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
+
+ /* create two files, a source and a target */
+ source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+
+/*-------------------------------------------------------------------------
+ * create a Group, a Dataset, and a committed Datatype in the target
+ *-------------------------------------------------------------------------
+ */
+
+ gid = H5Gcreate2(target_fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(gid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Gclose(gid);
+
+
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(target_fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(did);
+ H5Sclose(sid);
+
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ H5Tcommit2(target_fid, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Tclose(tid);
+
+/*-------------------------------------------------------------------------
+ * create external links in the source file pointing to the target objects
+ *-------------------------------------------------------------------------
+ */
+
+ H5Lcreate_external(FILE62, "group", source_fid, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE62, "dset", source_fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE62, "type", source_fid, "ext_link3", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* close */
+ H5Fclose(source_fid);
+ H5Fclose(target_fid);
+}
+
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
@@ -6242,6 +6306,7 @@ int main(void)
gent_group_creation_order();
gent_attr_creation_order();
gent_fpformat();
+ gent_extlinks();
return 0;