Skip to content

Commit

Permalink
Fix 1.6 API C examples
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF committed Dec 22, 2023
1 parent ec7e660 commit a6f337a
Show file tree
Hide file tree
Showing 17 changed files with 157 additions and 82 deletions.
13 changes: 9 additions & 4 deletions C/H5D/16/h5ex_d_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@
int
main(void)
{
hid_t file, space, dset1, dset2, dcpl;
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset1 = H5I_INVALID_HID;
hid_t dset2 = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
/* Handles */
herr_t status;
H5D_space_status_t space_status;
hsize_t dims[2] = {DIM0, DIM1}, storage_size;
int wdata[DIM0][DIM1], /* Write buffer */
i, j;
hsize_t dims[2] = {DIM0, DIM1};
hsize_t storage_size;
int wdata[DIM0][DIM1]; /* Write buffer */
hsize_t i, j;

/*
* Initialize data.
Expand Down
12 changes: 8 additions & 4 deletions C/H5D/16/h5ex_d_checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@
int
main(void)
{
hid_t file, space, dset, dcpl;
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
/* Handles */
herr_t status;
htri_t avail;
H5Z_filter_t filter_type;
hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1};
size_t nelmts;
unsigned int flags, filter_info;
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
max, i, j;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int max;
hsize_t i, j;

/*
* Check if the Fletcher32 filter is available and can be used for
Expand Down
18 changes: 13 additions & 5 deletions C/H5D/16/h5ex_d_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
H5D_layout_t layout;
hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}, start[2], stride[2], count[2], block[2];
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
i, j;
hsize_t dims[2] = {DIM0, DIM1};
hsize_t chunk[2] = {CHUNK0, CHUNK1};
hsize_t start[2];
hsize_t stride[2];
hsize_t count[2];
hsize_t block[2];
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
hsize_t i, j;

/*
* Initialize data to "1", to make it easier to see the selections.
Expand Down
11 changes: 7 additions & 4 deletions C/H5D/16/h5ex_d_compact.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
H5D_layout_t layout;
hsize_t dims[2] = {DIM0, DIM1};
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
i, j;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
hsize_t i, j;

/*
* Initialize data.
Expand Down
11 changes: 7 additions & 4 deletions C/H5D/16/h5ex_d_extern.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
hsize_t dims[2] = {DIM0, DIM1};
char name[NAME_BUF_SIZE];
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
i, j;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
hsize_t i, j;

/*
* Initialize data.
Expand Down
21 changes: 13 additions & 8 deletions C/H5D/16/h5ex_d_fillval.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED},
chunk[2] = {CHUNK0, CHUNK1};
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
rdata2[EDIM0][EDIM1], /* Read buffer for
extension */
fillval, i, j;
hsize_t dims[2] = {DIM0, DIM1};
hsize_t extdims[2] = {EDIM0, EDIM1};
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk[2] = {CHUNK0, CHUNK1};
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int rdata2[EDIM0][EDIM1]; /* Read buffer for extension */
int fillval;
hsize_t i, j;

/*
* Initialize data.
Expand Down
18 changes: 12 additions & 6 deletions C/H5D/16/h5ex_d_gzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
htri_t avail;
H5Z_filter_t filter_type;
hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1};
hsize_t dims[2] = {DIM0, DIM1};
hsize_t chunk[2] = {CHUNK0, CHUNK1};
size_t nelmts;
unsigned int flags, filter_info;
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
max, i, j;
unsigned int flags;
unsigned int filter_info;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int max;
hsize_t i, j;

/*
* Check if gzip compression is available and can be used for both
Expand Down
16 changes: 11 additions & 5 deletions C/H5D/16/h5ex_d_hyper.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@
int
main(void)
{
hid_t file, space, dset; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
herr_t status;
hsize_t dims[2] = {DIM0, DIM1}, start[2], stride[2], count[2], block[2];
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
i, j;
hsize_t dims[2] = {DIM0, DIM1};
hsize_t start[2];
hsize_t stride[2];
hsize_t count[2];
hsize_t block[2];
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
hsize_t i, j;

/*
* Initialize data to "1", to make it easier to see the selections.
Expand Down
10 changes: 6 additions & 4 deletions C/H5D/16/h5ex_d_rdwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
int
main(void)
{
hid_t file, space, dset; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
herr_t status;
hsize_t dims[2] = {DIM0, DIM1};
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
i, j;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
hsize_t i, j;

/*
* Initialize data.
Expand Down
18 changes: 12 additions & 6 deletions C/H5D/16/h5ex_d_shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
htri_t avail;
H5Z_filter_t filter_type;
hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1};
hsize_t dims[2] = {DIM0, DIM1};
hsize_t chunk[2] = {CHUNK0, CHUNK1};
size_t nelmts;
unsigned int flags, filter_info;
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
max, nfilters, i, j;
unsigned int flags;
unsigned int filter_info;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int max, nfilters;
int i, j;

/*
* Check if gzip compression is available and can be used for both
Expand Down
19 changes: 13 additions & 6 deletions C/H5D/16/h5ex_d_szip.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,23 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;

herr_t status;
htri_t avail;
H5Z_filter_t filter_type;
hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1};
hsize_t dims[2] = {DIM0, DIM1};
hsize_t chunk[2] = {CHUNK0, CHUNK1};
size_t nelmts;
unsigned int flags, filter_info;
int wdata[DIM0][DIM1], /* Write buffer */
rdata[DIM0][DIM1], /* Read buffer */
max, i, j;
unsigned int flags;
unsigned int filter_info;
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int max;
hsize_t i, j;

/*
* Check if szip compression is available and can be used for both
Expand Down
23 changes: 15 additions & 8 deletions C/H5D/16/h5ex_d_unlimadd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,22 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2], chunk[2] = {CHUNK0, CHUNK1},
start[2], count[2];
int wdata[DIM0][DIM1], /* Write buffer */
wdata2[EDIM0][EDIM1], /* Write buffer for
extension */
**rdata, /* Read buffer */
ndims, i, j;
hsize_t dims[2] = {DIM0, DIM1};
hsize_t extdims[2] = {EDIM0, EDIM1};
hsize_t maxdims[2];
hsize_t chunk[2] = {CHUNK0, CHUNK1};
hsize_t start[2];
hsize_t count[2];
int wdata[DIM0][DIM1]; /* Write buffer */
int wdata2[EDIM0][EDIM1]; /* Write buffer for extension */
int **rdata = NULL; /* Read buffer */
int ndims;
hsize_t i, j;

/*
* Initialize data.
Expand Down
23 changes: 15 additions & 8 deletions C/H5D/16/h5ex_d_unlimgzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,26 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
htri_t avail;
H5Z_filter_t filter_type;
hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2], chunk[2] = {CHUNK0, CHUNK1},
start[2], count[2];
hsize_t dims[2] = {DIM0, DIM1};
hsize_t extdims[2] = {EDIM0, EDIM1};
hsize_t maxdims[2];
hsize_t chunk[2] = {CHUNK0, CHUNK1};
hsize_t start[2];
hsize_t count[2];
size_t nelmts;
unsigned int flags, filter_info;
int wdata[DIM0][DIM1], /* Write buffer */
wdata2[EDIM0][EDIM1], /* Write buffer for
extension */
**rdata, /* Read buffer */
ndims, i, j;
int wdata[DIM0][DIM1]; /* Write buffer */
int wdata2[EDIM0][EDIM1]; /* Write buffer for extension */
int **rdata = NULL; /* Read buffer */
int ndims;
hsize_t i, j;

/*
* Check if gzip compression is available and can be used for both
Expand Down
20 changes: 13 additions & 7 deletions C/H5D/16/h5ex_d_unlimmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@
int
main(void)
{
hid_t file, space, dset, dcpl; /* Handles */
hid_t file = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5I_INVALID_HID;
herr_t status;
hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2], chunk[2] = {CHUNK0, CHUNK1};
int wdata[DIM0][DIM1], /* Write buffer */
wdata2[EDIM0][EDIM1], /* Write buffer for
extension */
**rdata, /* Read buffer */
ndims, i, j;
hsize_t dims[2] = {DIM0, DIM1};
hsize_t extdims[2] = {EDIM0, EDIM1};
hsize_t maxdims[2];
hsize_t chunk[2] = {CHUNK0, CHUNK1};
int wdata[DIM0][DIM1]; /* Write buffer */
int wdata2[EDIM0][EDIM1]; /* Write buffer for extension */
int **rdata = NULL; /* Read buffer */
int ndims;
hsize_t i, j;

/*
* Initialize data.
Expand Down
2 changes: 1 addition & 1 deletion C/H5D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project (HDF5Examples_C_H5D C)
include (C_sourcefiles.cmake)

foreach (example_name ${common_examples})
if (${H5_LIBVER_DIR} EQUAL 16)
if (${H5_LIBVER_DIR} EQUAL 16 OR ${EXAMPLE_VARNAME}_USE_16_API)
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)
Expand Down
2 changes: 1 addition & 1 deletion C/H5G/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project (HDF5Examples_C_H5G C)
include (C_sourcefiles.cmake)

foreach (example_name ${common_examples})
if (${H5_LIBVER_DIR} EQUAL 16)
if (${H5_LIBVER_DIR} EQUAL 16 OR ${EXAMPLE_VARNAME}_USE_16_API)
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)
Expand Down
2 changes: 1 addition & 1 deletion C/H5T/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project (HDF5Examples_C_H5T C)
include (C_sourcefiles.cmake)

foreach (example_name ${common_examples})
if (${H5_LIBVER_DIR} EQUAL 16)
if (${H5_LIBVER_DIR} EQUAL 16 OR ${EXAMPLE_VARNAME}_USE_16_API)
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)
Expand Down

0 comments on commit a6f337a

Please sign in to comment.