diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-05-12 19:32:13 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-05-12 19:32:13 (GMT) |
commit | ed8882c52dbe406d81cd58cbcc980a883a094131 (patch) | |
tree | 09c4e035d54344c90a9d4b8072a5f1af316fcceb /tools/h5dump/h5dumpgentest.c | |
parent | 2fd80deb4d36491b4d007634dbae8fe32081e4ca (diff) | |
download | hdf5-ed8882c52dbe406d81cd58cbcc980a883a094131.zip hdf5-ed8882c52dbe406d81cd58cbcc980a883a094131.tar.gz hdf5-ed8882c52dbe406d81cd58cbcc980a883a094131.tar.bz2 |
[svn-r14976] 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.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 76a2b43..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" + @@ -6174,6 +6177,66 @@ gent_fpformat(void) H5Fclose(fid); } +/*------------------------------------------------------------------------- + * 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 @@ -6243,6 +6306,7 @@ int main(void) gent_group_creation_order(); gent_attr_creation_order(); gent_fpformat(); + gent_extlinks(); return 0; |