diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/h5_attribute.c | 2 | ||||
-rw-r--r-- | examples/h5_elink_unix2win.c | 4 | ||||
-rw-r--r-- | examples/h5_extlink.c | 2 | ||||
-rw-r--r-- | examples/h5_interm_group.c | 22 | ||||
-rw-r--r-- | examples/h5_ref2reg.c | 58 | ||||
-rw-r--r-- | examples/h5_shared_mesg.c | 10 |
6 files changed, 49 insertions, 49 deletions
diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 033aec1..646b395 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -202,7 +202,7 @@ main (void) ret = H5Aread(attr, atype_mem, string_out); printf("Found string attribute; its index is %d , value = %s \n", i, string_out); ret = H5Tclose(atype_mem); - } + } ret = H5Aclose(attr); ret = H5Tclose(atype); } diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c index a82e23d..bcbb65f 100644 --- a/examples/h5_elink_unix2win.c +++ b/examples/h5_elink_unix2win.c @@ -39,7 +39,7 @@ * Note that this may not be necessary on your system; many Windows systems can * understand Unix paths. */ -static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, +static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id) { hid_t fid; @@ -148,7 +148,7 @@ unix2win_example(void) if((fid=H5Fcreate("u2w/u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error; #endif if(H5Fclose(fid) < 0) goto error; - + /* Create the source file with an external link in Windows format */ if((fid=H5Fcreate("unix2win.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error; diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index a728bb2..7886aeb 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -160,7 +160,7 @@ static void extlink_prefix_example(void) /* Close both groups. */ H5Gclose(group2_id); H5Gclose(group_id); - + /* If we change the prefix, the same external link can find a file in the blue * directory. */ diff --git a/examples/h5_interm_group.c b/examples/h5_interm_group.c index 3d04d2e..bd9c7c4 100644 --- a/examples/h5_interm_group.c +++ b/examples/h5_interm_group.c @@ -61,47 +61,47 @@ main(void) /* * Check if group /G1 exists in the file. */ - if(H5Lexists(file, "/G1", H5P_DEFAULT) !=FALSE) + if(H5Lexists(file, "/G1", H5P_DEFAULT) !=FALSE) printf("Group /G1 exists in the file\n"); - + /* - * Check that group G2/G3 exists in /G1 and if not create it using + * Check that group G2/G3 exists in /G1 and if not create it using * intermediate group creation property. */ g1_id = H5Gopen2(file, "/G1", H5P_DEFAULT); /* Next commented call causes error stack to be printed out; the next one - * works fine; is it a bug or a feature? EIP 04-25-07 + * works fine; is it a bug or a feature? EIP 04-25-07 */ -/* if (H5Lexists(g1_id, "G2/G3", H5P_DEFAULT) !=TRUE) { */ - if (H5Lexists(g1_id, "G2", H5P_DEFAULT) !=TRUE) { - +/* if (H5Lexists(g1_id, "G2/G3", H5P_DEFAULT) !=TRUE) { */ + if (H5Lexists(g1_id, "G2", H5P_DEFAULT) !=TRUE) { + grp_crt_plist = H5Pcreate(H5P_LINK_CREATE); /* Set flag for intermediate group creation */ status = H5Pset_create_intermediate_group(grp_crt_plist, TRUE); g3_id = H5Gcreate2(g1_id, "G2/G3", grp_crt_plist, H5P_DEFAULT, H5P_DEFAULT); H5Gclose(g3_id); - } + } H5Gclose(g1_id); /* Now check if group /G1/G2 exists in the file, then open it and print * its members names */ - if (H5Lexists(file, "/G1/G2", H5P_DEFAULT)) { + if (H5Lexists(file, "/G1/G2", H5P_DEFAULT)) { g2_id = H5Gopen2(file, "/G1/G2", H5P_DEFAULT); status = H5Gget_info(g2_id, &g2_info); printf("Group /G1/G2 has %d member(s)\n", (int)g2_info.nlinks); for (i=0; i < (int)g2_info.nlinks; i++) { - H5Lget_name_by_idx(g2_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)i, + H5Lget_name_by_idx(g2_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)i, name, 3, H5P_DEFAULT); printf("Object's name is %s\n", name); } H5Gclose(g2_id); - } + } H5Fclose(file); return 0; } diff --git a/examples/h5_ref2reg.c b/examples/h5_ref2reg.c index 9c75d91..d6df438 100644 --- a/examples/h5_ref2reg.c +++ b/examples/h5_ref2reg.c @@ -13,16 +13,16 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - This program shows how to create, store and dereference references + This program shows how to create, store and dereference references to the dataset regions. It creates a file and writes a two dimensional integer dataset - to it. Then it creates a dataset to store region references in. It + to it. Then it creates a dataset to store region references in. It stores references to a hyperslab and 3 points selected (for the - integer dataset previously created). + integer dataset previously created). - It then reopens the references dataset, reads and dereferences the - region references, and then reads and displays the selected hyperslab + It then reopens the references dataset, reads and dereferences the + region references, and then reads and displays the selected hyperslab and selected elements data from the integer dataset. */ @@ -36,9 +36,9 @@ int main(void) { hid_t file_id; /* file identifier */ hid_t space_id; /* dataspace identifiers */ - hid_t spacer_id; + hid_t spacer_id; hid_t dsetv_id; /*dataset identifiers*/ - hid_t dsetr_id; + hid_t dsetr_id; hsize_t dims[2] = {2,9}; hsize_t dimsr[1] = {2}; int rank = 2; @@ -56,29 +56,29 @@ int main(void) size_t name_size1, name_size2; char buf1[10], buf2[10]; - /* + /* * Create file with default file access and file creation properties. */ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /* + /* * Create dataspace for datasets. */ space_id = H5Screate_simple(rank, dims, NULL); spacer_id = H5Screate_simple(rankr, dimsr, NULL); - /* - * Create integer dataset. + /* + * Create integer dataset. */ dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - /* + /* * Write data to the dataset. */ status = H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data); status = H5Dclose(dsetv_id); - /* + /* * Dataset with references. */ dsetr_id = H5Dcreate2(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -86,8 +86,8 @@ int main(void) /* * Create a reference to the hyperslab. */ - start[0] = 0; - start[1] = 3; + start[0] = 0; + start[1] = 3; count[0] = 2; count[1] = 3; status = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL); @@ -119,42 +119,42 @@ int main(void) file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); /* - * Reopen the dataset with object references and read references + * Reopen the dataset with object references and read references * to the buffer. */ dsetr_id = H5Dopen2(file_id, dsetnamer, H5P_DEFAULT); - status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, + status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out); - /* + /* * Dereference the first reference. */ dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[0]); /* * Get name of the dataset the first region reference points to - * using H5Rget_name + * using H5Rget_name */ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, 10); - printf(" Dataset's name (returned by H5Rget_name) the reference points to is %s, name length is %d\n", buf1, (int)name_size1); + printf(" Dataset's name (returned by H5Rget_name) the reference points to is %s, name length is %d\n", buf1, (int)name_size1); /* * Get name of the dataset the first region reference points to - * using H5Iget_name + * using H5Iget_name */ - name_size2 = H5Iget_name(dsetv_id, (char*)buf2, 10); - printf(" Dataset's name (returned by H5Iget_name) the reference points to is %s, name length is %d\n", buf2, (int)name_size2); + name_size2 = H5Iget_name(dsetv_id, (char*)buf2, 10); + printf(" Dataset's name (returned by H5Iget_name) the reference points to is %s, name length is %d\n", buf2, (int)name_size2); space_id = H5Rget_region(dsetr_id, H5R_DATASET_REGION,&ref_out[0]); - /* + /* * Read and display hyperslab selection from the dataset. */ - status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, + status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, H5P_DEFAULT, data_out); printf("Selected hyperslab: "); for (i = 0; i <= 1; i++) - { + { printf("\n"); for (j = 0; j <= 8; j++) printf("%d ", data_out[i][j]); @@ -184,11 +184,11 @@ int main(void) * Read selected data from the dataset. */ - status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, + status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, H5P_DEFAULT, data_out); printf("Selected points: "); for (i = 0; i <= 1; i++) - { + { printf("\n"); for (j = 0; j <= 8; j++) printf("%d ", data_out[i][j]); @@ -205,6 +205,6 @@ int main(void) return 0; } - + diff --git a/examples/h5_shared_mesg.c b/examples/h5_shared_mesg.c index 68340e0..a2edb38 100644 --- a/examples/h5_shared_mesg.c +++ b/examples/h5_shared_mesg.c @@ -17,7 +17,7 @@ * This program illustrates the usage of HDF5's implicit message sharing * feature, which can be used to save space when the same messages are * used many times in a file. - * + * * This example creates a standard file using file creation property lists * to control which messages are shared. Messages that can be shared are * datatypes, dataspaces, attributes, fill values, and filter pipelines. @@ -153,7 +153,7 @@ int main(void) ret = create_standard_file("only_huge_mesgs_file.h5", fcpl_id); if(ret < 0) goto error; - + /* Or, suppose we only wanted to shared dataspaces and * attributes (which might make sense if we were going to use committed @@ -176,7 +176,7 @@ int main(void) if(ret < 0) goto error; ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 40); if(ret < 0) goto error; - + ret = create_standard_file("separate_indexes_file.h5", fcpl_id); if(ret < 0) goto error; @@ -242,7 +242,7 @@ create_standard_file(const char *filename, hid_t fcpl_id) { hid_t file_id=-1; hid_t type_id=-1, temp_type_id=-1; - hsize_t dims[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; + hsize_t dims[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; hid_t space_id=-1; hid_t attr_type_id = -1; hid_t attr_space_id = -1; @@ -252,7 +252,7 @@ create_standard_file(const char *filename, hid_t fcpl_id) int x; herr_t ret; - /* Create the file */ + /* Create the file */ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); if(file_id < 0) goto error; |