diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /hl/fortran/src | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'hl/fortran/src')
-rw-r--r-- | hl/fortran/src/H5DSfc.c | 510 | ||||
-rw-r--r-- | hl/fortran/src/H5IMcc.c | 565 | ||||
-rw-r--r-- | hl/fortran/src/H5IMcc.h | 34 | ||||
-rw-r--r-- | hl/fortran/src/H5IMfc.c | 809 | ||||
-rw-r--r-- | hl/fortran/src/H5LTf90proto.h | 494 | ||||
-rw-r--r-- | hl/fortran/src/H5LTfc.c | 1004 | ||||
-rw-r--r-- | hl/fortran/src/H5TBfc.c | 719 |
7 files changed, 1870 insertions, 2265 deletions
diff --git a/hl/fortran/src/H5DSfc.c b/hl/fortran/src/H5DSfc.c index f99fa4d..398e2b3 100644 --- a/hl/fortran/src/H5DSfc.c +++ b/hl/fortran/src/H5DSfc.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* 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 * + * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This files contains C stubs for H5D Fortran APIs */ @@ -18,354 +18,352 @@ #include "H5Eprivate.h" /*------------------------------------------------------------------------- -* Function: h5dsset_scale_c -* -* Purpose: Calls H5DSset_scale -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 17, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5dsset_scale_c + * + * Purpose: Calls H5DSset_scale + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 17, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen) { - char *c_dimname = NULL; - int_f ret_value = 0; + char *c_dimname = NULL; + int_f ret_value = 0; - /* - * convert FORTRAN name to C name - */ + /* + * convert FORTRAN name to C name + */ - if(*dimnamelen != 0) - if(NULL == (c_dimname = (char *)HD5f2cstring(dimname, (size_t)*dimnamelen))) - HGOTO_DONE(FAIL) + if (*dimnamelen != 0) + if (NULL == (c_dimname = (char *)HD5f2cstring(dimname, (size_t)*dimnamelen))) + HGOTO_DONE(FAIL) - /* - * call H5DSset_scale function. - */ + /* + * call H5DSset_scale function. + */ - if(H5DSset_scale( (hid_t)*dsid, c_dimname) < 0) - HGOTO_DONE(FAIL) + if (H5DSset_scale((hid_t)*dsid, c_dimname) < 0) + HGOTO_DONE(FAIL) - done: - if(c_dimname) - HDfree(c_dimname); +done: + if (c_dimname) + HDfree(c_dimname); - return ret_value; + return ret_value; } /* end h5dsset_scale_c() */ - /*------------------------------------------------------------------------- -* Function: H5DSattach_scale_c -* -* Purpose: Calls H5DSattach_scale -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 17, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: H5DSattach_scale_c + * + * Purpose: Calls H5DSattach_scale + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 17, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx) +h5dsattach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx) { - int_f ret_value = 0; + int_f ret_value = 0; - /* - * call H5DSset_scale function. - */ + /* + * call H5DSset_scale function. + */ - if(H5DSattach_scale( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx ) < 0) - HGOTO_DONE(FAIL) + if (H5DSattach_scale((hid_t)*did, (hid_t)*dsid, (unsigned)*idx) < 0) + HGOTO_DONE(FAIL) - done: +done: return ret_value; } /* end h5dsattach_scale_c() */ - /*------------------------------------------------------------------------- -* Function: H5DSdetach_scale_c -* -* Purpose: Calls H5DSdetach_scale -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 17, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: H5DSdetach_scale_c + * + * Purpose: Calls H5DSdetach_scale + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 17, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx) +h5dsdetach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx) { - int_f ret_value = 0; + int_f ret_value = 0; - /* - * call H5DSset_scale function. - */ + /* + * call H5DSset_scale function. + */ - if(H5DSdetach_scale( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx ) < 0) - HGOTO_DONE(FAIL) + if (H5DSdetach_scale((hid_t)*did, (hid_t)*dsid, (unsigned)*idx) < 0) + HGOTO_DONE(FAIL) - done: +done: return ret_value; } /* end h5dsdetach_scale_c() */ - /*------------------------------------------------------------------------- -* Function: H5DSis_attached_c -* -* Purpose: Calls H5DSis_attached -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 17, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: H5DSis_attached_c + * + * Purpose: Calls H5DSis_attached + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 17, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached) +h5dsis_attached_c(hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached) { - int_f ret_value = 0; - htri_t c_is_attached; + int_f ret_value = 0; + htri_t c_is_attached; - /* - * call H5DSis_attached function. - */ + /* + * call H5DSis_attached function. + */ - if((c_is_attached = H5DSis_attached( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx )) < 0) - HGOTO_DONE(FAIL) + if ((c_is_attached = H5DSis_attached((hid_t)*did, (hid_t)*dsid, (unsigned)*idx)) < 0) + HGOTO_DONE(FAIL) - *is_attached = (int_f)c_is_attached; + *is_attached = (int_f)c_is_attached; - done: - return ret_value; +done: + return ret_value; } /* end h5dsis_attached_c() */ /*------------------------------------------------------------------------- -* Function: H5DSis_scale_c -* -* Purpose: Calls H5DSis_scale -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 18, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: H5DSis_scale_c + * + * Purpose: Calls H5DSis_scale + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 18, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5dsis_scale_c( hid_t_f *did, int_f *is_scale) +h5dsis_scale_c(hid_t_f *did, int_f *is_scale) { - int_f ret_value = 0; - htri_t c_is_scale; + int_f ret_value = 0; + htri_t c_is_scale; - /* - * call H5DSis_scale function. - */ + /* + * call H5DSis_scale function. + */ - if((c_is_scale=H5DSis_scale( (hid_t)*did )) < 0) - HGOTO_DONE(FAIL) + if ((c_is_scale = H5DSis_scale((hid_t)*did)) < 0) + HGOTO_DONE(FAIL) - *is_scale = (int_f)c_is_scale; + *is_scale = (int_f)c_is_scale; - done: +done: return ret_value; } /* end h5dsis_scale_c() */ - /*------------------------------------------------------------------------- -* Function: h5dsset_label_c -* -* Purpose: Calls H5DSset_label -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 18, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5dsset_label_c + * + * Purpose: Calls H5DSset_label + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 18, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen) { - char *c_label = NULL; - int_f ret_value = 0; + char *c_label = NULL; + int_f ret_value = 0; - /* - * convert FORTRAN name to C name - */ + /* + * convert FORTRAN name to C name + */ - if(NULL == (c_label = (char *)HD5f2cstring(label, (size_t)*labellen))) - HGOTO_DONE(FAIL) + if (NULL == (c_label = (char *)HD5f2cstring(label, (size_t)*labellen))) + HGOTO_DONE(FAIL) - /* - * call H5DSset_label function. - */ + /* + * call H5DSset_label function. + */ - if(H5DSset_label( (hid_t)*did, (unsigned)*idx, c_label) < 0) - HGOTO_DONE(FAIL) + if (H5DSset_label((hid_t)*did, (unsigned)*idx, c_label) < 0) + HGOTO_DONE(FAIL) - done: - if(c_label) - HDfree(c_label); +done: + if (c_label) + HDfree(c_label); - return ret_value; + return ret_value; } /* end h5dsset_label_c() */ /*------------------------------------------------------------------------- -* Function: h5dsget_label_c -* -* Purpose: Calls H5DSget_label -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 18, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5dsget_label_c + * + * Purpose: Calls H5DSget_label + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 18, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size) { - char *c_label = NULL; - ssize_t size_c = -1; - int_f ret_value = 0; + char * c_label = NULL; + ssize_t size_c = -1; + int_f ret_value = 0; - /* - * Allocate buffer to hold label - */ - if ((c_label = (char *)HDmalloc((size_t)*size + 1)) == NULL) - HGOTO_DONE(FAIL); + /* + * Allocate buffer to hold label + */ + if ((c_label = (char *)HDmalloc((size_t)*size + 1)) == NULL) + HGOTO_DONE(FAIL); - /* - * call H5DSget_label function. - */ + /* + * call H5DSget_label function. + */ - if( (size_c = H5DSget_label( (hid_t)*did, (unsigned)*idx, c_label, (size_t)*size+1)) < 0) - HGOTO_DONE(FAIL) + if ((size_c = H5DSget_label((hid_t)*did, (unsigned)*idx, c_label, (size_t)*size + 1)) < 0) + HGOTO_DONE(FAIL) - /* - * Convert C name to FORTRAN and place it in the given buffer - */ + /* + * Convert C name to FORTRAN and place it in the given buffer + */ - HD5packFstring(c_label, _fcdtocp(label), (size_t)*size); + HD5packFstring(c_label, _fcdtocp(label), (size_t)*size); done: - *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the - * trailing NULL in the length calculation, Ref. HDFFV-7596 */ - if(c_label) HDfree(c_label); - return ret_value; + *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the + * trailing NULL in the length calculation, Ref. HDFFV-7596 */ + if (c_label) + HDfree(c_label); + return ret_value; } /* end h5dsget_label_c() */ /*------------------------------------------------------------------------- -* Function: h5dsget_scale_name_c -* -* Purpose: Calls H5DSget_scale_name -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 18, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5dsget_scale_name_c + * + * Purpose: Calls H5DSget_scale_name + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 18, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size) { - char *c_scale_name = NULL; - ssize_t size_c = -1; - int_f ret_value = 0; + char * c_scale_name = NULL; + ssize_t size_c = -1; + int_f ret_value = 0; - /* - * Allocate buffer to hold name - */ - if ((c_scale_name = (char *)HDmalloc((size_t)*size + 1)) == NULL) - HGOTO_DONE(FAIL); + /* + * Allocate buffer to hold name + */ + if ((c_scale_name = (char *)HDmalloc((size_t)*size + 1)) == NULL) + HGOTO_DONE(FAIL); - /* - * call H5DSget_scale_name function. - */ + /* + * call H5DSget_scale_name function. + */ - if( (size_c = H5DSget_scale_name( (hid_t)*did, c_scale_name, (size_t)*size+1)) < 0) - HGOTO_DONE(FAIL) + if ((size_c = H5DSget_scale_name((hid_t)*did, c_scale_name, (size_t)*size + 1)) < 0) + HGOTO_DONE(FAIL) - /* - * Convert C name to FORTRAN and place it in the given buffer - */ - HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size); - *size = (size_t_f)size_c; + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size); + *size = (size_t_f)size_c; done: - if(c_scale_name) HDfree(c_scale_name); - return ret_value; + if (c_scale_name) + HDfree(c_scale_name); + return ret_value; } /* end h5dsget_scale_name_c() */ /*------------------------------------------------------------------------- -* Function: H5DSget_num_scales_c -* -* Purpose: Calls H5DSget_num_scales -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: April 18, 2011 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: H5DSget_num_scales_c + * + * Purpose: Calls H5DSget_num_scales + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: April 18, 2011 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales) +h5dsget_num_scales_c(hid_t_f *did, int_f *idx, int_f *num_scales) { - int_f ret_value = 0; + int_f ret_value = 0; - /* - * call H5DSset_scale function. - */ + /* + * call H5DSset_scale function. + */ - if( (*num_scales = (int_f)H5DSget_num_scales( (hid_t)*did, (unsigned)*idx)) < 0) - HGOTO_DONE(FAIL) + if ((*num_scales = (int_f)H5DSget_num_scales((hid_t)*did, (unsigned)*idx)) < 0) + HGOTO_DONE(FAIL) - done: +done: return ret_value; } /* end h5dsget_num_scales_c() */ diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index 1d12f56..fc29302 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -16,16 +16,11 @@ #include <string.h> #include <stdlib.h> - /*------------------------------------------------------------------------- * private functions *------------------------------------------------------------------------- */ -herr_t H5IM_get_palette(hid_t loc_id, - const char *image_name, - int pal_number, - hid_t tid, - void *pal_data); +herr_t H5IM_get_palette(hid_t loc_id, const char *image_name, int pal_number, hid_t tid, void *pal_data); /*------------------------------------------------------------------------- * Function: H5IMmake_image_8bitf @@ -48,77 +43,76 @@ herr_t H5IM_get_palette(hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMmake_image_8bitf(hid_t loc_id, - const char *dset_name, - hsize_t width, - hsize_t height, - int_f *buf) +herr_t +H5IMmake_image_8bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, int_f *buf) { - hid_t did; /* dataset ID */ - hid_t sid; /* space ID */ - hsize_t dims[IMAGE8_RANK]; /* dimensions */ + hid_t did; /* dataset ID */ + hid_t sid; /* space ID */ + hsize_t dims[IMAGE8_RANK]; /* dimensions */ - /* initialize the image dimensions */ - dims[0] = height; - dims[1] = width; + /* initialize the image dimensions */ + dims[0] = height; + dims[1] = width; -/*------------------------------------------------------------------------- - * create and write the dataset - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create and write the dataset + *------------------------------------------------------------------------- + */ - /* create the data space for the dataset. */ - if((sid = H5Screate_simple(IMAGE8_RANK, dims, NULL)) < 0) - return -1; - - /* create the dataset as H5T_NATIVE_UCHAR */ - if((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UINT8, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - - /* write with memory type H5T_NATIVE_INT */ - /* Use long type if Fortran integer is 8 bytes and C long long is also 8 bytes*/ - /* Fail if otherwise */ - if(buf) { - if(sizeof(int_f) == sizeof(int)) { - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; - } else if(sizeof(int_f) == sizeof(long)) { - if(H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; - } else if(sizeof(int_f) == sizeof(long long)) { - if(H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; - } else - return -1; - } - - /* close */ - if(H5Dclose(did) < 0) - return -1; - if(H5Sclose(sid) < 0) - return -1; + /* create the data space for the dataset. */ + if ((sid = H5Screate_simple(IMAGE8_RANK, dims, NULL)) < 0) + return -1; -/*------------------------------------------------------------------------- - * attach the specification attributes - *------------------------------------------------------------------------- - */ + /* create the dataset as H5T_NATIVE_UCHAR */ + if ((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UINT8, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < + 0) + return -1; - /* attach the CLASS attribute */ - if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0) - return -1; + /* write with memory type H5T_NATIVE_INT */ + /* Use long type if Fortran integer is 8 bytes and C long long is also 8 bytes*/ + /* Fail if otherwise */ + if (buf) { + if (sizeof(int_f) == sizeof(int)) { + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + return -1; + } + else if (sizeof(int_f) == sizeof(long)) { + if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + return -1; + } + else if (sizeof(int_f) == sizeof(long long)) { + if (H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + return -1; + } + else + return -1; + } - /* attach the VERSION attribute */ - if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0) - return -1; + /* close */ + if (H5Dclose(did) < 0) + return -1; + if (H5Sclose(sid) < 0) + return -1; - /* attach the IMAGE_SUBCLASS attribute */ - if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED") < 0) - return -1; + /*------------------------------------------------------------------------- + * attach the specification attributes + *------------------------------------------------------------------------- + */ - return 0; -} + /* attach the CLASS attribute */ + if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0) + return -1; + /* attach the VERSION attribute */ + if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0) + return -1; + + /* attach the IMAGE_SUBCLASS attribute */ + if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED") < 0) + return -1; + return 0; +} /*------------------------------------------------------------------------- * Function: H5IMmake_image_24bitf @@ -146,96 +140,94 @@ herr_t H5IMmake_image_8bitf(hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMmake_image_24bitf(hid_t loc_id, - const char *dset_name, - hsize_t width, - hsize_t height, - const char *interlace, - int_f *buf) +herr_t +H5IMmake_image_24bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, + const char *interlace, int_f *buf) { - hid_t did; /* dataset ID */ - hid_t sid; /* space ID */ - hsize_t dims[IMAGE24_RANK]; /* dimensions */ + hid_t did; /* dataset ID */ + hid_t sid; /* space ID */ + hsize_t dims[IMAGE24_RANK]; /* dimensions */ + + /*------------------------------------------------------------------------- + * attach the image dimensions according to the interlace mode + *------------------------------------------------------------------------- + */ + if (strcmp(interlace, "INTERLACE_PIXEL") == 0) { + /* Number of color planes is defined as the third dimension */ + dims[0] = height; + dims[1] = width; + dims[2] = IMAGE24_RANK; + } + else if (strcmp(interlace, "INTERLACE_PLANE") == 0) { + /* Number of color planes is defined as the first dimension */ + dims[0] = IMAGE24_RANK; + dims[1] = height; + dims[2] = width; + } + else + return -1; -/*------------------------------------------------------------------------- - * attach the image dimensions according to the interlace mode - *------------------------------------------------------------------------- - */ - if(strcmp(interlace, "INTERLACE_PIXEL") == 0) { - /* Number of color planes is defined as the third dimension */ - dims[0] = height; - dims[1] = width; - dims[2] = IMAGE24_RANK; - } - else - if(strcmp(interlace, "INTERLACE_PLANE") == 0) { - /* Number of color planes is defined as the first dimension */ - dims[0] = IMAGE24_RANK; - dims[1] = height; - dims[2] = width; - } - else - return -1; + /*------------------------------------------------------------------------- + * create and write the dataset + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * create and write the dataset - *------------------------------------------------------------------------- - */ + /* create the data space for the dataset. */ + if ((sid = H5Screate_simple(IMAGE24_RANK, dims, NULL)) < 0) + return -1; - /* create the data space for the dataset. */ - if((sid = H5Screate_simple(IMAGE24_RANK, dims, NULL)) < 0) - return -1; - - /* create the dataset as H5T_NATIVE_UCHAR */ - if((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - - /* write with memory type H5T_NATIVE_INT */ - if(buf) { - if(sizeof(int_f) == sizeof(int)) { - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; - } else if(sizeof(int_f) == sizeof(long)) { - if(H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; - } else if(sizeof(int_f) == sizeof(long long)) { - if(H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - return -1; - } else - return -1; - } - - /* close */ - if(H5Dclose(did) < 0) - return -1; - if(H5Sclose(sid) < 0) - return -1; + /* create the dataset as H5T_NATIVE_UCHAR */ + if ((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < + 0) + return -1; -/*------------------------------------------------------------------------- - * attach the specification attributes - *------------------------------------------------------------------------- - */ + /* write with memory type H5T_NATIVE_INT */ + if (buf) { + if (sizeof(int_f) == sizeof(int)) { + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + return -1; + } + else if (sizeof(int_f) == sizeof(long)) { + if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + return -1; + } + else if (sizeof(int_f) == sizeof(long long)) { + if (H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + return -1; + } + else + return -1; + } - /* Attach the CLASS attribute */ - if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0) - return -1; + /* close */ + if (H5Dclose(did) < 0) + return -1; + if (H5Sclose(sid) < 0) + return -1; - /* Attach the VERSION attribute */ - if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0) - return -1; + /*------------------------------------------------------------------------- + * attach the specification attributes + *------------------------------------------------------------------------- + */ - /* Attach the IMAGE_SUBCLASS attribute */ - if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR") < 0) - return -1; + /* Attach the CLASS attribute */ + if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0) + return -1; - /* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */ - if(H5LTset_attribute_string(loc_id, dset_name, "INTERLACE_MODE", interlace) < 0) - return -1; + /* Attach the VERSION attribute */ + if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0) + return -1; - return 0; + /* Attach the IMAGE_SUBCLASS attribute */ + if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR") < 0) + return -1; -} + /* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */ + if (H5LTset_attribute_string(loc_id, dset_name, "INTERLACE_MODE", interlace) < 0) + return -1; + return 0; +} /*------------------------------------------------------------------------- * Function: H5IMread_imagef @@ -258,33 +250,32 @@ herr_t H5IMmake_image_24bitf(hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMread_imagef(hid_t loc_id, - const char *dset_name, - int_f *buf) +herr_t +H5IMread_imagef(hid_t loc_id, const char *dset_name, int_f *buf) { - hid_t did; - hid_t tid; + hid_t did; + hid_t tid; /* open the dataset */ - if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* determine appropriate datatype to use */ - if(sizeof(int_f) == sizeof(int)) + if (sizeof(int_f) == sizeof(int)) tid = H5T_NATIVE_INT; - else if(sizeof(int_f) == sizeof(long)) + else if (sizeof(int_f) == sizeof(long)) tid = H5T_NATIVE_LONG; - else if(sizeof(int_f) == sizeof(long long)) + else if (sizeof(int_f) == sizeof(long long)) tid = H5T_NATIVE_LLONG; else goto out; /* read to memory */ - if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; /* close */ - if(H5Dclose(did)) + if (H5Dclose(did)) return -1; return 0; @@ -294,7 +285,6 @@ out: return -1; } - /*------------------------------------------------------------------------- * Function: H5IMmake_palettef * @@ -318,75 +308,75 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMmake_palettef(hid_t loc_id, - const char *pal_name, - const hsize_t *pal_dims, - int_f *pal_data) +herr_t +H5IMmake_palettef(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, int_f *pal_data) { - hid_t did; /* dataset ID */ - hid_t sid; /* space ID */ - int has_pal; + hid_t did; /* dataset ID */ + hid_t sid; /* space ID */ + int has_pal; - /* Check if the dataset already exists */ - has_pal = H5LTfind_dataset(loc_id, pal_name); + /* Check if the dataset already exists */ + has_pal = H5LTfind_dataset(loc_id, pal_name); - /* It exists. Return */ - if(has_pal == 1) - return 0; + /* It exists. Return */ + if (has_pal == 1) + return 0; -/*------------------------------------------------------------------------- - * create and write the dataset - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create and write the dataset + *------------------------------------------------------------------------- + */ - /* create the data space for the dataset. */ - if((sid = H5Screate_simple(2, pal_dims, NULL)) < 0) - return -1; - - /* create the dataset as H5T_NATIVE_UCHAR */ - if((did = H5Dcreate2(loc_id, pal_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - - /* write with memory type H5T_NATIVE_INT */ - if(pal_data) { - if(sizeof(int_f) == sizeof(int)) { - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) - return -1; - } else if(sizeof(int_f) == sizeof(long)) { - if(H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) - return -1; - } else if(sizeof(int_f) == sizeof(long long)) { - if(H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) - return -1; - } else - return -1; - } - - /* close */ - if(H5Dclose(did) < 0) - return -1; - if(H5Sclose(sid) < 0) - return -1; + /* create the data space for the dataset. */ + if ((sid = H5Screate_simple(2, pal_dims, NULL)) < 0) + return -1; -/*------------------------------------------------------------------------- - * attach the specification attributes - *------------------------------------------------------------------------- - */ + /* create the dataset as H5T_NATIVE_UCHAR */ + if ((did = H5Dcreate2(loc_id, pal_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < + 0) + return -1; - /* Attach the attribute "CLASS" to the >>palette<< dataset*/ - if(H5LTset_attribute_string(loc_id, pal_name, "CLASS", PALETTE_CLASS) < 0) - return -1; + /* write with memory type H5T_NATIVE_INT */ + if (pal_data) { + if (sizeof(int_f) == sizeof(int)) { + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) + return -1; + } + else if (sizeof(int_f) == sizeof(long)) { + if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) + return -1; + } + else if (sizeof(int_f) == sizeof(long long)) { + if (H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) + return -1; + } + else + return -1; + } - /* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/ - if(H5LTset_attribute_string(loc_id, pal_name, "PAL_VERSION", "1.2") < 0) - return -1; + /* close */ + if (H5Dclose(did) < 0) + return -1; + if (H5Sclose(sid) < 0) + return -1; - return 0; + /*------------------------------------------------------------------------- + * attach the specification attributes + *------------------------------------------------------------------------- + */ -} + /* Attach the attribute "CLASS" to the >>palette<< dataset*/ + if (H5LTset_attribute_string(loc_id, pal_name, "CLASS", PALETTE_CLASS) < 0) + return -1; + /* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/ + if (H5LTset_attribute_string(loc_id, pal_name, "PAL_VERSION", "1.2") < 0) + return -1; + + return 0; +} /*------------------------------------------------------------------------- * Function: H5IMget_palettef @@ -411,20 +401,17 @@ herr_t H5IMmake_palettef(hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMget_palettef(hid_t loc_id, - const char *image_name, - int pal_number, - int_f *pal_data) +herr_t +H5IMget_palettef(hid_t loc_id, const char *image_name, int pal_number, int_f *pal_data) { - if(sizeof(int_f) == sizeof(int)) - return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_INT,pal_data); - else if(sizeof(int_f) == sizeof(long)) - return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_LONG,pal_data); - else if(sizeof(int_f) == sizeof(long long)) - return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_LLONG,pal_data); - else - return -1; - + if (sizeof(int_f) == sizeof(int)) + return H5IM_get_palette(loc_id, image_name, pal_number, H5T_NATIVE_INT, pal_data); + else if (sizeof(int_f) == sizeof(long)) + return H5IM_get_palette(loc_id, image_name, pal_number, H5T_NATIVE_LONG, pal_data); + else if (sizeof(int_f) == sizeof(long long)) + return H5IM_get_palette(loc_id, image_name, pal_number, H5T_NATIVE_LLONG, pal_data); + else + return -1; } /*------------------------------------------------------------------------- @@ -452,96 +439,88 @@ herr_t H5IMget_palettef(hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5IM_get_palette(hid_t loc_id, - const char *image_name, - int pal_number, - hid_t tid, - void *pal_data) +herr_t +H5IM_get_palette(hid_t loc_id, const char *image_name, int pal_number, hid_t tid, void *pal_data) { - hid_t image_id; - int has_pal; - hid_t attr_type; - hid_t attr_id; - hid_t attr_space_id; - hid_t attr_class; - hssize_t n_refs; - size_t dim_ref; - hobj_ref_t *refbuf; /* buffer to read references */ - hid_t pal_id; - - /* Open the dataset. */ - if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) - return -1; - - /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - has_pal = H5IM_find_palette(image_id); + hid_t image_id; + int has_pal; + hid_t attr_type; + hid_t attr_id; + hid_t attr_space_id; + hid_t attr_class; + hssize_t n_refs; + size_t dim_ref; + hobj_ref_t *refbuf; /* buffer to read references */ + hid_t pal_id; + + /* Open the dataset. */ + if ((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) + return -1; - if(has_pal == 1) - { + /* Try to find the attribute "PALETTE" on the >>image<< dataset */ + has_pal = H5IM_find_palette(image_id); - if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0) - goto out; + if (has_pal == 1) { - if((attr_type = H5Aget_type(attr_id)) < 0) - goto out; + if ((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0) + goto out; - if((attr_class = H5Tget_class(attr_type)) < 0) - goto out; + if ((attr_type = H5Aget_type(attr_id)) < 0) + goto out; - /* Check if it is really a reference */ - if(attr_class == H5T_REFERENCE) - { + if ((attr_class = H5Tget_class(attr_type)) < 0) + goto out; - /* Get the reference(s) */ - if((attr_space_id = H5Aget_space(attr_id)) < 0) - goto out; + /* Check if it is really a reference */ + if (attr_class == H5T_REFERENCE) { - n_refs = H5Sget_simple_extent_npoints(attr_space_id); + /* Get the reference(s) */ + if ((attr_space_id = H5Aget_space(attr_id)) < 0) + goto out; - dim_ref = (size_t)n_refs; + n_refs = H5Sget_simple_extent_npoints(attr_space_id); - refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * dim_ref); + dim_ref = (size_t)n_refs; - if(H5Aread(attr_id, attr_type, refbuf) < 0) - goto out; + refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * dim_ref); - /* Get the palette id */ - if((pal_id = H5Rdereference2(image_id, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0) - goto out; + if (H5Aread(attr_id, attr_type, refbuf) < 0) + goto out; - /* Read the palette dataset using the memory type TID */ - if(H5Dread(pal_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) - goto out; + /* Get the palette id */ + if ((pal_id = H5Rdereference2(image_id, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0) + goto out; - if(H5Sclose(attr_space_id) < 0) - goto out; + /* Read the palette dataset using the memory type TID */ + if (H5Dread(pal_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0) + goto out; - /* close the dereferenced dataset */ - if(H5Dclose(pal_id) < 0) - goto out; + if (H5Sclose(attr_space_id) < 0) + goto out; - HDfree(refbuf); + /* close the dereferenced dataset */ + if (H5Dclose(pal_id) < 0) + goto out; - } /* H5T_REFERENCE */ + HDfree(refbuf); - if(H5Tclose(attr_type) < 0) - goto out; + } /* H5T_REFERENCE */ - /* Close the attribute. */ - if(H5Aclose(attr_id) < 0) - goto out; + if (H5Tclose(attr_type) < 0) + goto out; - } + /* Close the attribute. */ + if (H5Aclose(attr_id) < 0) + goto out; + } - /* Close the image dataset. */ - if(H5Dclose(image_id) < 0) - return -1; + /* Close the image dataset. */ + if (H5Dclose(image_id) < 0) + return -1; - return 0; + return 0; out: - H5Dclose(image_id); - return -1; - - + H5Dclose(image_id); + return -1; } diff --git a/hl/fortran/src/H5IMcc.h b/hl/fortran/src/H5IMcc.h index a65669d..34d3a4e 100644 --- a/hl/fortran/src/H5IMcc.h +++ b/hl/fortran/src/H5IMcc.h @@ -22,34 +22,16 @@ extern "C" { #endif +herr_t H5IMmake_image_8bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, int_f *buf); -herr_t H5IMmake_image_8bitf( hid_t loc_id, - const char *dset_name, - hsize_t width, - hsize_t height, - int_f *buf ); - -herr_t H5IMmake_image_24bitf( hid_t loc_id, - const char *dset_name, - hsize_t width, - hsize_t height, - const char *interlace, - int_f *buf); - -herr_t H5IMread_imagef( hid_t loc_id, - const char *dset_name, - int_f *buf ); - -herr_t H5IMmake_palettef( hid_t loc_id, - const char *pal_name, - const hsize_t *pal_dims, - int_f *pal_data ); - -herr_t H5IMget_palettef( hid_t loc_id, - const char *image_name, - int pal_number, - int_f *pal_data ); +herr_t H5IMmake_image_24bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, + const char *interlace, int_f *buf); +herr_t H5IMread_imagef(hid_t loc_id, const char *dset_name, int_f *buf); + +herr_t H5IMmake_palettef(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, int_f *pal_data); + +herr_t H5IMget_palettef(hid_t loc_id, const char *image_name, int pal_number, int_f *pal_data); #ifdef __cplusplus } diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index 638cea4..b01ed30 100644 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* 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 * + * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This files contains C stubs for H5D Fortran APIs */ @@ -18,51 +18,47 @@ #include "H5Eprivate.h" /*------------------------------------------------------------------------- -* Function: h5immake_image_8bit_c -* -* Purpose: Call H5IMmake_image_8bit -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5immake_image_8bit_c + * + * Purpose: Call H5IMmake_image_8bit + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5immake_image_8bit_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - int_f *buf) +h5immake_image_8bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, hsize_t_f *height, + int_f *buf) { int ret_value = -1; herr_t ret; hid_t c_loc_id; - char *c_name = NULL; - hsize_t w = (hsize_t)*width; - hsize_t h = (hsize_t)*height; + char * c_name = NULL; + hsize_t w = (hsize_t)*width; + hsize_t h = (hsize_t)*height; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5IMmake_image_8bitf function. - */ + * call H5IMmake_image_8bitf function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMmake_image_8bitf(c_loc_id,c_name,w,h,buf); + ret = H5IMmake_image_8bitf(c_loc_id, c_name, w, h, buf); if (ret < 0) goto done; @@ -70,54 +66,49 @@ h5immake_image_8bit_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; - - } /*------------------------------------------------------------------------- -* Function: h5imread_image_c -* -* Purpose: Call H5IMread_image -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imread_image_c + * + * Purpose: Call H5IMread_image + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imread_image_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *buf) +h5imread_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; + int ret_value = -1; + herr_t ret; + char * c_name = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5IMread_image function. - */ - ret = H5IMread_imagef((hid_t)*loc_id,c_name,buf); + * call H5IMread_image function. + */ + ret = H5IMread_imagef((hid_t)*loc_id, c_name, buf); if (ret < 0) goto done; @@ -125,52 +116,46 @@ h5imread_image_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5immake_image_24bit_c -* -* Purpose: Call H5IMmake_image_24bit -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5immake_image_24bit_c + * + * Purpose: Call H5IMmake_image_24bit + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5immake_image_24bit_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *ilen, - _fcd il, - hsize_t_f *width, - hsize_t_f *height, - void *buf) +h5immake_image_24bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd il, + hsize_t_f *width, hsize_t_f *height, void *buf) { int ret_value = -1; herr_t ret; hid_t c_loc_id; - char *c_name = NULL; - char *c_il = NULL; - hsize_t w = (hsize_t)*width; - hsize_t h = (hsize_t)*height; + char * c_name = NULL; + char * c_il = NULL; + hsize_t w = (hsize_t)*width; + hsize_t h = (hsize_t)*height; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; @@ -180,11 +165,11 @@ h5immake_image_24bit_c (hid_t_f *loc_id, goto done; /* - * call H5IMmake_image_24bitf function. - */ + * call H5IMmake_image_24bitf function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMmake_image_24bitf(c_loc_id,c_name,w,h,c_il,(int_f *)buf); + ret = H5IMmake_image_24bitf(c_loc_id, c_name, w, h, c_il, (int_f *)buf); if (ret < 0) goto done; @@ -192,238 +177,218 @@ h5immake_image_24bit_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_il!=NULL) + if (c_il != NULL) HDfree(c_il); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5imget_image_info_c -* -* Purpose: Call H5IMget_image_info -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imget_image_info_c + * + * Purpose: Call H5IMget_image_info + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imget_image_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - hsize_t_f *planes, - hsize_t_f *npals, - size_t_f *ilen, - _fcd interlace) +h5imget_image_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, hsize_t_f *height, + hsize_t_f *planes, hsize_t_f *npals, size_t_f *ilen, _fcd interlace) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - hsize_t c_width; - hsize_t c_height; - hsize_t c_planes; - hssize_t c_npals; - char *c_buf=NULL; /* buffer to hold C string */ + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + hsize_t c_width; + hsize_t c_height; + hsize_t c_planes; + hssize_t c_npals; + char * c_buf = NULL; /* buffer to hold C string */ /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * allocate buffer to hold name of an attribute - */ - if ((c_buf = (char *)HDmalloc((size_t)*ilen +1)) == NULL) + * allocate buffer to hold name of an attribute + */ + if ((c_buf = (char *)HDmalloc((size_t)*ilen + 1)) == NULL) goto done; /* - * call H5IMget_image_info function. - */ + * call H5IMget_image_info function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMget_image_info(c_loc_id,c_name,&c_width,&c_height,&c_planes,c_buf,&c_npals); + ret = H5IMget_image_info(c_loc_id, c_name, &c_width, &c_height, &c_planes, c_buf, &c_npals); if (ret < 0) goto done; - *width = (hsize_t_f) c_width; - *height = (hsize_t_f) c_height; - *planes = (hsize_t_f) c_planes; - *npals = (hsize_t_f) c_npals; + *width = (hsize_t_f)c_width; + *height = (hsize_t_f)c_height; + *planes = (hsize_t_f)c_planes; + *npals = (hsize_t_f)c_npals; /* - * convert C name to FORTRAN and place it in the given buffer - */ + * convert C name to FORTRAN and place it in the given buffer + */ HD5packFstring(c_buf, _fcdtocp(interlace), (size_t)*ilen); ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_buf!=NULL) + if (c_buf != NULL) HDfree(c_buf); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5imis_image_c -* -* Purpose: Call H5IMis_image -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imis_image_c + * + * Purpose: Call H5IMis_image + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imis_image_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name) +h5imis_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name) { - hid_t c_loc_id; - char *c_name = NULL; - herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + herr_t ret; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); - if (c_name == NULL) return -1; + if (c_name == NULL) + return -1; /* - * call H5LTget_dataset_ndims function. - */ + * call H5LTget_dataset_ndims function. + */ c_loc_id = (hid_t)*loc_id; ret = H5IMis_image(c_loc_id, c_name); - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret; - } - /*------------------------------------------------------------------------- -* Function: h5immake_palette_c -* -* Purpose: Call H5IMmake_palette -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5immake_palette_c + * + * Purpose: Call H5IMmake_palette + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5immake_palette_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *dims, - void *buf) +h5immake_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, void *buf) { - char *c_name = NULL; + char * c_name = NULL; hsize_t c_dims[H5S_MAX_RANK]; int i; - int rank=2; + int rank = 2; int_f ret_value = 0; /* - * convert FORTRAN name to C name - */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + * convert FORTRAN name to C name + */ + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - for(i = 0; i < rank ; i++) - c_dims[i] = (hsize_t)dims[i]; + for (i = 0; i < rank; i++) + c_dims[i] = (hsize_t)dims[i]; /* - * call H5IMmake_palette function. - */ - if(H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, (int_f *)buf) < 0) + * call H5IMmake_palette function. + */ + if (H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, (int_f *)buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5imlink_palette_c -* -* Purpose: Call H5IMlink_palette -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imlink_palette_c + * + * Purpose: Call H5IMlink_palette + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imlink_palette_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *ilen, - _fcd pal_name) +h5imlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - char *c_namepal = NULL; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + char * c_namepal = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; @@ -433,11 +398,11 @@ h5imlink_palette_c (hid_t_f *loc_id, goto done; /* - * call H5IMlink_palette function. - */ + * call H5IMlink_palette function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMlink_palette(c_loc_id,c_name,c_namepal); + ret = H5IMlink_palette(c_loc_id, c_name, c_namepal); if (ret < 0) goto done; @@ -445,50 +410,45 @@ h5imlink_palette_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_namepal!=NULL) + if (c_namepal != NULL) HDfree(c_namepal); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5imunlink_palette_c -* -* Purpose: Call H5IMunlink_palette -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imunlink_palette_c + * + * Purpose: Call H5IMunlink_palette + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imunlink_palette_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *ilen, - _fcd pal_name) +h5imunlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - char *c_namepal = NULL; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + char * c_namepal = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; @@ -498,11 +458,11 @@ h5imunlink_palette_c (hid_t_f *loc_id, goto done; /* - * call H5IMunlink_palette function. - */ + * call H5IMunlink_palette function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMunlink_palette(c_loc_id,c_name,c_namepal); + ret = H5IMunlink_palette(c_loc_id, c_name, c_namepal); if (ret < 0) goto done; @@ -510,62 +470,57 @@ h5imunlink_palette_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_namepal!=NULL) + if (c_namepal != NULL) HDfree(c_namepal); return ret_value; } - - /*------------------------------------------------------------------------- -* Function: h5imget_npalettes_c -* -* Purpose: Call H5IMget_npalettes -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imget_npalettes_c + * + * Purpose: Call H5IMget_npalettes + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imget_npalettes_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *npals) +h5imget_npalettes_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *npals) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - hssize_t c_npals; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + hssize_t c_npals; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5IMget_image_info function. - */ + * call H5IMget_image_info function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMget_npalettes(c_loc_id,c_name,&c_npals); + ret = H5IMget_npalettes(c_loc_id, c_name, &c_npals); - *npals = (hsize_t_f) c_npals; + *npals = (hsize_t_f)c_npals; if (ret < 0) goto done; @@ -573,184 +528,166 @@ h5imget_npalettes_c(hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } - - /*------------------------------------------------------------------------- -* Function: h5imget_palette_info_c -* -* Purpose: Call H5IMget_palette_info -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ - + * Function: h5imget_palette_info_c + * + * Purpose: Call H5IMget_palette_info + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imget_palette_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *pal_number, - hsize_t_f *dims) +h5imget_palette_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, hsize_t_f *dims) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - hsize_t c_dims[2]; - int i; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + hsize_t c_dims[2]; + int i; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5IMget_image_info function. - */ + * call H5IMget_image_info function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMget_palette_info(c_loc_id,c_name,*pal_number,c_dims); + ret = H5IMget_palette_info(c_loc_id, c_name, *pal_number, c_dims); if (ret < 0) goto done; - for (i = 0; i < 2 ; i++) - { - dims[i] = (hsize_t_f) c_dims[i]; + for (i = 0; i < 2; i++) { + dims[i] = (hsize_t_f)c_dims[i]; } ret_value = 0; - done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5imget_palette_c -* -* Purpose: Call H5IMget_palette -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ - + * Function: h5imget_palette_c + * + * Purpose: Call H5IMget_palette + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imget_palette_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *pal_number, - void *buf) +h5imget_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) - goto done; + goto done; /* - * call H5IMget_image_info function. - */ + * call H5IMget_image_info function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5IMget_palettef(c_loc_id,c_name,*pal_number,(int_f *)buf); + ret = H5IMget_palettef(c_loc_id, c_name, *pal_number, (int_f *)buf); if (ret < 0) - goto done; + goto done; ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5imis_palette_c -* -* Purpose: Call H5IMis_palette -* -* Return: true, false, fail -* -* Programmer: Pedro Vicente -* -* Date: October 06, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5imis_palette_c + * + * Purpose: Call H5IMis_palette + * + * Return: true, false, fail + * + * Programmer: Pedro Vicente + * + * Date: October 06, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5imis_palette_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name) +h5imis_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name) { - hid_t c_loc_id; - char *c_name; - herr_t ret; + hid_t c_loc_id; + char * c_name; + herr_t ret; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); - if (c_name == NULL) return -1; + if (c_name == NULL) + return -1; /* - * call H5IMis_palette function. - */ + * call H5IMis_palette function. + */ c_loc_id = (hid_t)*loc_id; ret = H5IMis_palette(c_loc_id, c_name); - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret; - } diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 44a2fee..b3c0a72 100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -1,16 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* 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 * + * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef _H5LTf90proto_H #define _H5LTf90proto_H @@ -22,414 +21,189 @@ /* These definitions should match those in fortran/src/H5f90kit.c */ -H5_FCDLL char* HD5f2cstring (_fcd fdesc, size_t len); -H5_FCDLL void HD5packFstring (char *src, char *dest, size_t len); +H5_FCDLL char *HD5f2cstring(_fcd fdesc, size_t len); +H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len); /* * Functions from H5DSfc.c */ HDF5_HL_F90CSTUBDLL -int_f -h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen); +int_f h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen); HDF5_HL_F90CSTUBDLL -int_f -h5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); +int_f h5dsattach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx); HDF5_HL_F90CSTUBDLL -int_f -h5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); +int_f h5dsdetach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx); HDF5_HL_F90CSTUBDLL -int_f -h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *c_is_attached); +int_f h5dsis_attached_c(hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *c_is_attached); HDF5_HL_F90CSTUBDLL -int_f -h5dsis_scale_c(hid_t_f *did, int_f *is_scale); +int_f h5dsis_scale_c(hid_t_f *did, int_f *is_scale); HDF5_HL_F90CSTUBDLL -int_f -h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen); +int_f h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen); HDF5_HL_F90CSTUBDLL -int_f -h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size); +int_f h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size); HDF5_HL_F90CSTUBDLL -int_f -h5dsget_scale_name_c(hid_t_f *did, _fcd label, size_t_f *size); +int_f h5dsget_scale_name_c(hid_t_f *did, _fcd label, size_t_f *size); HDF5_HL_F90CSTUBDLL -int_f -h5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales); +int_f h5dsget_num_scales_c(hid_t_f *did, int_f *idx, int_f *num_scales); /* * Functions from H5LTfc.c */ HDF5_HL_F90CSTUBDLL -int_f -h5ltmake_dataset_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltread_dataset_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltset_attribute_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf, char *dtype, size_t_f *sizeof_val); - - -HDF5_HL_F90CSTUBDLL -int_f -h5ltget_attribute_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - void *buf, char* dtype, size_t_f *sizeof_val); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltget_attribute_string_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - _fcd buf, - size_t_f *buf_size); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltget_dataset_ndims_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *rank); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltfind_dataset_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltget_dataset_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *dims, - int_f *type_class, - size_t_f *type_size); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltget_attribute_ndims_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - int_f *rank); -HDF5_HL_F90CSTUBDLL -int_f -h5ltget_attribute_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *attrnamelen, - _fcd attrname, - hsize_t_f *dims, - int_f *type_class, - size_t_f *type_size); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltmake_dataset_string_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *buflen, - char *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltread_dataset_string_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - char *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5ltpath_valid_c(hid_t_f *loc_id, - _fcd path, - size_t_f *pathlen, - int_f *check_object_valid_c); +int_f h5ltmake_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank, hsize_t_f *dims, + hid_t_f *type_id, void *buf); + +HDF5_HL_F90CSTUBDLL +int_f h5ltread_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hid_t_f *type_id, void *buf); + +HDF5_HL_F90CSTUBDLL +int_f h5ltset_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, + _fcd attrname, size_t_f *size, void *buf, char *dtype, size_t_f *sizeof_val); + +HDF5_HL_F90CSTUBDLL +int_f h5ltget_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, + _fcd attrname, void *buf, char *dtype, size_t_f *sizeof_val); + +HDF5_HL_F90CSTUBDLL +int_f h5ltget_attribute_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, + _fcd attrname, _fcd buf, size_t_f *buf_size); + +HDF5_HL_F90CSTUBDLL +int_f h5ltget_dataset_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank); -/*------------------------------------------------------------------------- -* Image -*------------------------------------------------------------------------- -*/ HDF5_HL_F90CSTUBDLL -int_f -h5immake_image_8bit_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - int_f *buf); +int_f h5ltfind_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name); + HDF5_HL_F90CSTUBDLL -int_f -h5imread_image_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *buf); +int_f h5ltget_dataset_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, + int_f *type_class, size_t_f *type_size); HDF5_HL_F90CSTUBDLL -int_f -h5immake_image_24bit_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *ilen, - _fcd il, - hsize_t_f *width, - hsize_t_f *height, - void *buf); +int_f h5ltget_attribute_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, + _fcd attrname, int_f *rank); HDF5_HL_F90CSTUBDLL -int_f -h5imget_image_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - hsize_t_f *planes, - hsize_t_f *npals, - size_t_f *ilen, - _fcd interlace); +int_f h5ltget_attribute_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *attrnamelen, + _fcd attrname, hsize_t_f *dims, int_f *type_class, size_t_f *type_size); +HDF5_HL_F90CSTUBDLL +int_f h5ltmake_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *buflen, char *buf); HDF5_HL_F90CSTUBDLL -int_f -h5imis_image_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name); +int_f h5ltread_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, char *buf); +HDF5_HL_F90CSTUBDLL +int_f h5ltpath_valid_c(hid_t_f *loc_id, _fcd path, size_t_f *pathlen, int_f *check_object_valid_c); +/*------------------------------------------------------------------------- + * Image + *------------------------------------------------------------------------- + */ HDF5_HL_F90CSTUBDLL -int_f -h5immake_palette_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *dims, - void *buf); +int_f h5immake_image_8bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, + hsize_t_f *height, int_f *buf); +HDF5_HL_F90CSTUBDLL +int_f h5imread_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *buf); HDF5_HL_F90CSTUBDLL -int_f -h5imlink_palette_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *ilen, - _fcd pal_name); +int_f h5immake_image_24bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd il, + hsize_t_f *width, hsize_t_f *height, void *buf); +HDF5_HL_F90CSTUBDLL +int_f h5imget_image_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, hsize_t_f *height, + hsize_t_f *planes, hsize_t_f *npals, size_t_f *ilen, _fcd interlace); HDF5_HL_F90CSTUBDLL -int_f -h5imunlink_palette_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *ilen, - _fcd pal_name); +int_f h5imis_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name); HDF5_HL_F90CSTUBDLL -int_f -h5imget_npalettes_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *npals); +int_f h5immake_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, void *buf); +HDF5_HL_F90CSTUBDLL +int_f h5imlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name); HDF5_HL_F90CSTUBDLL -int_f -h5imget_palette_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *pal_number, - hsize_t_f *dims); +int_f h5imunlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name); HDF5_HL_F90CSTUBDLL -int_f -h5imget_palette_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *pal_number, - void *buf); +int_f h5imget_npalettes_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *npals); HDF5_HL_F90CSTUBDLL -int_f -h5imis_palette_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name); +int_f h5imget_palette_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, + hsize_t_f *dims); +HDF5_HL_F90CSTUBDLL +int_f h5imget_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, void *buf); +HDF5_HL_F90CSTUBDLL +int_f h5imis_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name); /*------------------------------------------------------------------------- -* Table -*------------------------------------------------------------------------- -*/ - -HDF5_HL_F90CSTUBDLL -int_f -h5tbmake_table_c(size_t_f *namelen1, - _fcd name1, - hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords, - size_t_f *type_size, - size_t_f *field_offset, - hid_t_f *field_types, - hsize_t_f *chunk_size, - int_f *compress, - size_t_f *char_len_field_names, /* field_names lengths */ - size_t_f *max_char_size_field_names, /* char len of fields */ - _fcd buf); /* field_names */ - -HDF5_HL_F90CSTUBDLL -int_f -h5tbread_table_c(hid_t_f *loc_id, - _fcd name, - size_t_f *namelen, - hsize_t_f *nfields, - size_t_f *dst_size, - size_t_f *dst_offset, - size_t_f *dst_sizes, - void *dst_buf); - - -HDF5_HL_F90CSTUBDLL -int_f -h5tbmake_table_ptr_c(size_t_f *namelen1, - _fcd name1, - hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords, - size_t_f *type_size, - size_t_f *field_offset, - hid_t_f *field_types, - hsize_t_f *chunk_size, - void *fill_data, - int_f *compress, - size_t_f *char_len_field_names, /* field_names lengths */ - size_t_f *max_char_size_field_names, /* char len of fields */ - char *field_names, /* field_names */ - void *data); - -HDF5_HL_F90CSTUBDLL -int_f -h5tbwrite_field_name_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); - - - -HDF5_HL_F90CSTUBDLL -int_f -h5tbread_field_name_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); - - - -HDF5_HL_F90CSTUBDLL -int_f -h5tbwrite_field_index_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5tbread_field_index_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5tbinsert_field_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -h5tbdelete_field_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name); - - -HDF5_HL_F90CSTUBDLL -int_f -h5tbget_table_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords); - -HDF5_HL_F90CSTUBDLL -int_f -h5tbget_field_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - size_t_f *field_sizes, - size_t_f *field_offsets, - size_t_f *type_size, - size_t_f *namelen2, - size_t_f *lenmax, - _fcd field_names, - size_t_f *maxlen_out); + * Table + *------------------------------------------------------------------------- + */ + +HDF5_HL_F90CSTUBDLL +int_f h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, + hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, + hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, + size_t_f *char_len_field_names, /* field_names lengths */ + size_t_f *max_char_size_field_names, /* char len of fields */ + _fcd buf); /* field_names */ + +HDF5_HL_F90CSTUBDLL +int_f h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, size_t_f *dst_size, + size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf); + +HDF5_HL_F90CSTUBDLL +int_f h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, + hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, + size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size, + void *fill_data, int_f *compress, + size_t_f *char_len_field_names, /* field_names lengths */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char * field_names, /* field_names */ + void * data); + +HDF5_HL_F90CSTUBDLL +int_f h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, + _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, + void *buf); + +HDF5_HL_F90CSTUBDLL +int_f h5tbread_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, + _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, + void *buf); +HDF5_HL_F90CSTUBDLL +int_f h5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf); + +HDF5_HL_F90CSTUBDLL +int_f h5tbread_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf); + +HDF5_HL_F90CSTUBDLL +int_f h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, + hid_t_f *field_type, int_f *position, void *buf); + +HDF5_HL_F90CSTUBDLL +int_f h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name); + +HDF5_HL_F90CSTUBDLL +int_f h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, + hsize_t_f *nrecords); + +HDF5_HL_F90CSTUBDLL +int_f h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, + size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size, + size_t_f *namelen2, size_t_f *lenmax, _fcd field_names, size_t_f *maxlen_out); #endif /* _H5LTf90proto_H */ diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 2c4f274..0813f66 100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* 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 * + * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This files contains C stubs for H5D Fortran APIs */ @@ -18,121 +18,111 @@ #include "H5Eprivate.h" /*------------------------------------------------------------------------- -* Function: H5LTmake_dataset_c -* -* Purpose: Call H5LTmake_dataset -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTmake_dataset_c + * + * Purpose: Call H5LTmake_dataset + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltmake_dataset_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) +h5ltmake_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank, hsize_t_f *dims, + hid_t_f *type_id, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; + int ret_value = -1; + herr_t ret; + char * c_name = NULL; hsize_t *c_dims = NULL; - int i; + int i; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; - c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * ( (size_t)*rank )); + c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * ((size_t)*rank)); if (c_dims == NULL) goto done; /* - * transpose dimension arrays because of C-FORTRAN storage order - */ - for (i = 0; i < *rank ; i++) - { - c_dims[i] = dims[*rank - i - 1]; + * transpose dimension arrays because of C-FORTRAN storage order + */ + for (i = 0; i < *rank; i++) { + c_dims[i] = dims[*rank - i - 1]; } /* - * call H5LTmake_dataset function. - */ + * call H5LTmake_dataset function. + */ - ret = H5LTmake_dataset((hid_t)*loc_id, c_name, (int)*rank, c_dims, (hid_t)*type_id, buf ); + ret = H5LTmake_dataset((hid_t)*loc_id, c_name, (int)*rank, c_dims, (hid_t)*type_id, buf); if (ret < 0) goto done; ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_dims!=NULL) + if (c_dims != NULL) HDfree(c_dims); return ret_value; } /*------------------------------------------------------------------------- -* Function: H5LTread_dataset_c -* -* Purpose: Call H5LTmake_dataset -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTread_dataset_c + * + * Purpose: Call H5LTmake_dataset + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltread_dataset_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf) +h5ltread_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hid_t_f *type_id, void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - hid_t c_type_id; - char *c_name = NULL; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + hid_t c_type_id; + char * c_name = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5LTread_dataset function. - */ - c_loc_id = (hid_t)*loc_id; + * call H5LTread_dataset function. + */ + c_loc_id = (hid_t)*loc_id; c_type_id = (hid_t)*type_id; - ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf ); + ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf); if (ret < 0) goto done; @@ -140,47 +130,43 @@ h5ltread_dataset_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: H5LTmake_dataset_string_c -* -* Purpose: Call H5LTmake_dataset -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTmake_dataset_string_c + * + * Purpose: Call H5LTmake_dataset + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltmake_dataset_string_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *buflen, - char *buf) +h5ltmake_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *buflen, char *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - char *c_buf = NULL; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + char * c_buf = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; @@ -190,11 +176,11 @@ h5ltmake_dataset_string_c (hid_t_f *loc_id, goto done; /* - * call H5LTmake_dataset_string function. - */ + * call H5LTmake_dataset_string function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5LTmake_dataset_string(c_loc_id,c_name,c_buf); + ret = H5LTmake_dataset_string(c_loc_id, c_name, c_buf); if (ret < 0) goto done; @@ -202,58 +188,54 @@ h5ltmake_dataset_string_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_buf!=NULL) + if (c_buf != NULL) HDfree(c_buf); return ret_value; } - /*------------------------------------------------------------------------- -* Function: H5LTread_dataset_string_c -* -* Purpose: Call H5LTread_dataset_string -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTread_dataset_string_c + * + * Purpose: Call H5LTread_dataset_string + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltread_dataset_string_c (hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - char *buf) +h5ltread_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, char *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5LTread_dataset_string function. - */ + * call H5LTread_dataset_string function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5LTread_dataset_string(c_loc_id,c_name,buf); + ret = H5LTread_dataset_string(c_loc_id, c_name, buf); if (ret < 0) goto done; @@ -261,51 +243,46 @@ h5ltread_dataset_string_c (hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: H5LTset_attribute_int_c -* -* Purpose: Call H5LTset_attribute_int -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTset_attribute_int_c + * + * Purpose: Call H5LTset_attribute_int + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltset_attribute_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf, char *dtype, size_t_f *sizeof_val) +h5ltset_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, _fcd attrname, + size_t_f *size, void *buf, char *dtype, size_t_f *sizeof_val) { - int ret_value = -1; - herr_t ret = SUCCEED; - hid_t c_loc_id; - char *c_name = NULL; - char *c_attrname = NULL; - char *c_buf = NULL; - size_t c_size; + int ret_value = -1; + herr_t ret = SUCCEED; + hid_t c_loc_id; + char * c_name = NULL; + char * c_attrname = NULL; + char * c_buf = NULL; + size_t c_size; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen); if (c_name == NULL) goto done; @@ -315,93 +292,97 @@ h5ltset_attribute_c(hid_t_f *loc_id, goto done; /* - * call H5LTset_attribute_int function. - */ + * call H5LTset_attribute_int function. + */ c_loc_id = (hid_t)*loc_id; c_size = (size_t)*size; - if( HDstrncmp(dtype,"I",1) == 0 ) { - if ((size_t)*sizeof_val == sizeof(int)) - ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_INT, (const int *)buf); - else if ((size_t)*sizeof_val == sizeof(long)) - ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LONG, (const long *)buf); + if (HDstrncmp(dtype, "I", 1) == 0) { + if ((size_t)*sizeof_val == sizeof(int)) + ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_INT, + (const int *)buf); + else if ((size_t)*sizeof_val == sizeof(long)) + ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_LONG, + (const long *)buf); #if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG - else if ((size_t)*sizeof_val == sizeof(long long)) - ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LLONG, (const long long *)buf); + else if ((size_t)*sizeof_val == sizeof(long long)) + ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_LLONG, + (const long long *)buf); #endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ - else - goto done; - } else if ( HDstrncmp(dtype,"R",1) == 0 ) { - if((size_t)*sizeof_val == sizeof(float)) - ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_FLOAT, (const float *)buf); - else if((size_t)*sizeof_val == sizeof(double)) - ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_DOUBLE, (const double *)buf); -#if H5_SIZEOF_LONG_DOUBLE !=0 - else if((size_t)*sizeof_val == sizeof(long double)) - ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LDOUBLE, (const long double *)buf); + else + goto done; + } + else if (HDstrncmp(dtype, "R", 1) == 0) { + if ((size_t)*sizeof_val == sizeof(float)) + ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_FLOAT, + (const float *)buf); + else if ((size_t)*sizeof_val == sizeof(double)) + ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_DOUBLE, + (const double *)buf); +#if H5_SIZEOF_LONG_DOUBLE != 0 + else if ((size_t)*sizeof_val == sizeof(long double)) + ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_LDOUBLE, + (const long double *)buf); #endif - else - goto done; - } else if ( HDstrncmp(dtype,"C",1) == 0 ) { + else + goto done; + } + else if (HDstrncmp(dtype, "C", 1) == 0) { - c_buf = (char *)HD5f2cstring((_fcd)buf, c_size); - if (c_buf == NULL) - goto done; + c_buf = (char *)HD5f2cstring((_fcd)buf, c_size); + if (c_buf == NULL) + goto done; - ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,c_buf); + ret = H5LTset_attribute_string(c_loc_id, c_name, c_attrname, c_buf); } if (ret < 0) - goto done; + goto done; ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_attrname!=NULL) + if (c_attrname != NULL) HDfree(c_attrname); - if(c_buf!=NULL) + if (c_buf != NULL) HDfree(c_buf); return ret_value; } /*------------------------------------------------------------------------- -* Function: H5LTget_attribute_c -* -* Purpose: Call H5LTget_attribute_int -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTget_attribute_c + * + * Purpose: Call H5LTget_attribute_int + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltget_attribute_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - void *buf, char *dtype, size_t_f *sizeof_val) +h5ltget_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, _fcd attrname, + void *buf, char *dtype, size_t_f *sizeof_val) { - int ret_value = -1; - herr_t ret = SUCCEED; - hid_t c_loc_id; - char *c_name = NULL; - char *c_attrname = NULL; + int ret_value = -1; + herr_t ret = SUCCEED; + hid_t c_loc_id; + char * c_name = NULL; + char * c_attrname = NULL; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen); if (c_name == NULL) goto done; @@ -411,32 +392,33 @@ h5ltget_attribute_c(hid_t_f *loc_id, goto done; /* - * call H5LTget_attribute_int function. - */ + * call H5LTget_attribute_int function. + */ c_loc_id = (hid_t)*loc_id; - if( HDstrncmp(dtype,"I",1) == 0) { - if((size_t)*sizeof_val == sizeof(int)) - ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_INT,buf); - else if ((size_t)*sizeof_val == sizeof(long)) - ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LONG,buf); + if (HDstrncmp(dtype, "I", 1) == 0) { + if ((size_t)*sizeof_val == sizeof(int)) + ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_INT, buf); + else if ((size_t)*sizeof_val == sizeof(long)) + ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_LONG, buf); #if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG - else if ((size_t)*sizeof_val == sizeof(long long)) - ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LLONG,buf); + else if ((size_t)*sizeof_val == sizeof(long long)) + ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_LLONG, buf); #endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ - else - goto done; - } else if ( HDstrncmp(dtype,"R",1) == 0 ) { - if((size_t)*sizeof_val == sizeof(float)) - ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_FLOAT,buf); - else if((size_t)*sizeof_val == sizeof(double)) - ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_DOUBLE,buf); -#if H5_SIZEOF_LONG_DOUBLE !=0 - else if((size_t)*sizeof_val == sizeof(long double)) - ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LDOUBLE,buf); + else + goto done; + } + else if (HDstrncmp(dtype, "R", 1) == 0) { + if ((size_t)*sizeof_val == sizeof(float)) + ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_FLOAT, buf); + else if ((size_t)*sizeof_val == sizeof(double)) + ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_DOUBLE, buf); +#if H5_SIZEOF_LONG_DOUBLE != 0 + else if ((size_t)*sizeof_val == sizeof(long double)) + ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_LDOUBLE, buf); #endif - else - goto done; + else + goto done; } if (ret < 0) @@ -445,50 +427,46 @@ h5ltget_attribute_c(hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_attrname!=NULL) + if (c_attrname != NULL) HDfree(c_attrname); return ret_value; } /*------------------------------------------------------------------------- -* Function: H5LTget_attribute_string_c -* -* Purpose: Call H5LTget_attribute_string -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTget_attribute_string_c + * + * Purpose: Call H5LTget_attribute_string + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltget_attribute_string_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - _fcd buf, size_t_f *buf_size) +h5ltget_attribute_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, + _fcd attrname, _fcd buf, size_t_f *buf_size) { - int ret_value = -1; - herr_t ret; - char *c_name = NULL; - char *c_attrname = NULL; - char *c_buf = NULL; + int ret_value = -1; + herr_t ret; + char * c_name = NULL; + char * c_attrname = NULL; + char * c_buf = NULL; /* - * Convert FORTRAN name to C name - */ + * Convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen); if (c_name == NULL) goto done; @@ -500,12 +478,12 @@ h5ltget_attribute_string_c(hid_t_f *loc_id, * Allocate buffer to hold C attribute string */ if ((c_buf = (char *)HDmalloc((size_t)*buf_size + 1)) == NULL) - goto done; + goto done; /* * Call H5LTget_attribute_int function. */ - ret = H5LTget_attribute_string((hid_t)*loc_id,c_name,c_attrname,c_buf); + ret = H5LTget_attribute_string((hid_t)*loc_id, c_name, c_attrname, c_buf); if (ret < 0) goto done; @@ -517,58 +495,54 @@ h5ltget_attribute_string_c(hid_t_f *loc_id, ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_attrname!=NULL) + if (c_attrname != NULL) HDfree(c_attrname); - if(c_buf!=NULL) + if (c_buf != NULL) HDfree(c_buf); return ret_value; } - /*------------------------------------------------------------------------- -* Function: H5LTget_dataset_ndims_c -* -* Purpose: Call H5LTget_dataset_ndims -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: H5LTget_dataset_ndims_c + * + * Purpose: Call H5LTget_dataset_ndims + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltget_dataset_ndims_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *rank) +h5ltget_dataset_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - int c_rank; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + int c_rank; /* - * Convert FORTRAN name to C name - */ + * Convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * Call H5LTget_dataset_ndims function. - */ + * Call H5LTget_dataset_ndims function. + */ c_loc_id = (hid_t)*loc_id; ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); @@ -576,113 +550,105 @@ h5ltget_dataset_ndims_c(hid_t_f *loc_id, if (ret < 0) goto done; - *rank = (int_f)c_rank; + *rank = (int_f)c_rank; ret_value = 0; - done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5ltfind_dataset_c -* -* Purpose: Call H5LTfind_dataset -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5ltfind_dataset_c + * + * Purpose: Call H5LTfind_dataset + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltfind_dataset_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name) +h5ltfind_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name) { - hid_t c_loc_id; - char *c_name = NULL; - herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + herr_t ret; /* - * Convert FORTRAN name to C name - */ + * Convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); - if (c_name == NULL) return -1; + if (c_name == NULL) + return -1; /* - * Call H5LTget_dataset_ndims function. - */ + * Call H5LTget_dataset_ndims function. + */ c_loc_id = (hid_t)*loc_id; ret = H5LTfind_dataset(c_loc_id, c_name); - if(c_name!=NULL) - HDfree(c_name); + if (c_name != NULL) + HDfree(c_name); return ret; - } /*------------------------------------------------------------------------- -* Function: h5ltget_dataset_info_c -* -* Purpose: Call H5LTget_dataset_info -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5ltget_dataset_info_c + * + * Purpose: Call H5LTget_dataset_info + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltget_dataset_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *dims, - int_f *type_class, - size_t_f *type_size) +h5ltget_dataset_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, int_f *type_class, + size_t_f *type_size) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - H5T_class_t c_classtype; - size_t c_type_size; - hsize_t c_dims[32]; - int i; - int c_rank; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + H5T_class_t c_classtype; + size_t c_type_size; + hsize_t c_dims[32]; + int i; + int c_rank; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; /* - * call H5LTget_dataset_ndims function. - */ + * call H5LTget_dataset_ndims function. + */ c_loc_id = (hid_t)*loc_id; ret = H5LTget_dataset_info(c_loc_id, c_name, c_dims, &c_classtype, &c_type_size); @@ -690,68 +656,62 @@ h5ltget_dataset_info_c(hid_t_f *loc_id, goto done; *type_class = c_classtype; - *type_size = (size_t_f)c_type_size; + *type_size = (size_t_f)c_type_size; /* - * transpose dimension arrays because of C-FORTRAN storage order - */ + * transpose dimension arrays because of C-FORTRAN storage order + */ ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); if (ret < 0) goto done; - for (i = 0; i < c_rank ; i++) - { - dims[i] = (hsize_t_f) c_dims[c_rank - i - 1]; + for (i = 0; i < c_rank; i++) { + dims[i] = (hsize_t_f)c_dims[c_rank - i - 1]; } - ret_value = 0; done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5ltget_attribute_ndims_c -* -* Purpose: Call H5LTget_attribute_ndims -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 05, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5ltget_attribute_ndims_c + * + * Purpose: Call H5LTget_attribute_ndims + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 05, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltget_attribute_ndims_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd dsetname, - size_t_f *attrnamelen, - _fcd attrname, - int_f *rank) +h5ltget_attribute_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, + _fcd attrname, int_f *rank) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - char *c_attrname = NULL; - int c_rank; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + char * c_attrname = NULL; + int c_rank; /* - * Convert FORTRAN name to C name - */ + * Convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen); if (c_name == NULL) goto done; @@ -761,72 +721,64 @@ h5ltget_attribute_ndims_c(hid_t_f *loc_id, goto done; /* - * Call H5LTset_attribute_ndims function. - */ + * Call H5LTset_attribute_ndims function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank); + ret = H5LTget_attribute_ndims(c_loc_id, c_name, c_attrname, &c_rank); if (ret < 0) goto done; - *rank = (int_f)c_rank; + *rank = (int_f)c_rank; ret_value = 0; - done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_attrname!=NULL) + if (c_attrname != NULL) HDfree(c_attrname); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5ltget_attribute_info_c -* -* Purpose: Call H5LTget_attribute_info -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: September 09, 2004 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5ltget_attribute_info_c + * + * Purpose: Call H5LTget_attribute_info + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: September 09, 2004 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltget_attribute_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *attrnamelen, - _fcd attrname, - hsize_t_f *dims, - int_f *type_class, - size_t_f *type_size) +h5ltget_attribute_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *attrnamelen, _fcd attrname, + hsize_t_f *dims, int_f *type_class, size_t_f *type_size) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name = NULL; - char *c_attrname = NULL; - H5T_class_t c_classtype; - size_t c_type_size; - hsize_t c_dims[32]; - int i; - int c_rank; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char * c_name = NULL; + char * c_attrname = NULL; + H5T_class_t c_classtype; + size_t c_type_size; + hsize_t c_dims[32]; + int i; + int c_rank; /* - * convert FORTRAN name to C name - */ + * convert FORTRAN name to C name + */ c_name = (char *)HD5f2cstring(name, (size_t)*namelen); if (c_name == NULL) goto done; @@ -836,90 +788,84 @@ h5ltget_attribute_info_c(hid_t_f *loc_id, goto done; /* - * call H5LTget_attribute_info function. - */ + * call H5LTget_attribute_info function. + */ c_loc_id = (hid_t)*loc_id; - ret = H5LTget_attribute_info(c_loc_id,c_name,c_attrname,c_dims,&c_classtype,&c_type_size); + ret = H5LTget_attribute_info(c_loc_id, c_name, c_attrname, c_dims, &c_classtype, &c_type_size); if (ret < 0) goto done; *type_class = c_classtype; - *type_size = (size_t_f)c_type_size; + *type_size = (size_t_f)c_type_size; /* - * transpose dimension arrays because of C-FORTRAN storage order - */ + * transpose dimension arrays because of C-FORTRAN storage order + */ - ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank); + ret = H5LTget_attribute_ndims(c_loc_id, c_name, c_attrname, &c_rank); if (ret < 0) goto done; - for (i = 0; i < c_rank ; i++) - { - dims[i] = (hsize_t_f) c_dims[c_rank - i - 1]; + for (i = 0; i < c_rank; i++) { + dims[i] = (hsize_t_f)c_dims[c_rank - i - 1]; } ret_value = 0; - done: - if(c_name!=NULL) + if (c_name != NULL) HDfree(c_name); - if(c_attrname!=NULL) + if (c_attrname != NULL) HDfree(c_attrname); - return ret_value; } /*------------------------------------------------------------------------- -* Function: h5ltpath_valid_c -* -* Purpose: Calls h5ltpath_valid -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: February 18, 2012 -* -* Comments: -* -* Modifications: -* -* -*------------------------------------------------------------------------- -*/ + * Function: h5ltpath_valid_c + * + * Purpose: Calls h5ltpath_valid + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: February 18, 2012 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ int_f -h5ltpath_valid_c(hid_t_f *loc_id, - _fcd path, - size_t_f *pathlen, - int_f *check_object_valid_c) +h5ltpath_valid_c(hid_t_f *loc_id, _fcd path, size_t_f *pathlen, int_f *check_object_valid_c) { - htri_t ret = -1; - char *c_path = NULL; + htri_t ret = -1; + char * c_path = NULL; hbool_t check_object_valid; /* * convert FORTRAN name to C name */ - if( NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen))) - goto done; + if (NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen))) + goto done; check_object_valid = FALSE; - if(*check_object_valid_c == 1) - check_object_valid = TRUE; + if (*check_object_valid_c == 1) + check_object_valid = TRUE; /* * call H5LTpath_valid function. */ - ret = H5LTpath_valid( (hid_t)*loc_id, c_path, check_object_valid ); + ret = H5LTpath_valid((hid_t)*loc_id, c_path, check_object_valid); done: - if(c_path != NULL) - HDfree(c_path); + if (c_path != NULL) + HDfree(c_path); return (int_f)ret; } diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index bd582e4..35d31cc 100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* 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 * + * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <math.h> @@ -20,579 +20,570 @@ #include "H5Eprivate.h" /*------------------------------------------------------------------------- -* Function: h5tbmake_table_c -* -* Purpose: Call H5TBmake_table -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 06, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbmake_table_c + * + * Purpose: Call H5TBmake_table + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 06, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, - hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, - hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, - size_t_f *char_len_field_names, /* field_names lengths */ - size_t_f *max_char_size_field_names, /* char len of fields */ - char *field_names) /* field_names */ + hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, + hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, + size_t_f *char_len_field_names, /* field_names lengths */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char * field_names) /* field_names */ { - char *c_name = NULL; - char *c_name1 = NULL; + char * c_name = NULL; + char * c_name1 = NULL; hsize_t num_elem; hsize_t i; - hsize_t c_nfields = (hsize_t)*nfields; + hsize_t c_nfields = (hsize_t)*nfields; size_t *c_field_offset = NULL; - hid_t *c_field_types = NULL; - char **c_field_names = NULL; - char *tmp = NULL, *tmp_p; - int_f ret_value = 0; + hid_t * c_field_types = NULL; + char ** c_field_names = NULL; + char * tmp = NULL, *tmp_p; + int_f ret_value = 0; num_elem = (hsize_t)*nfields; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) + if (NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) HGOTO_DONE(FAIL) - if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + if (NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) + if (NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - for(i = 0; i < num_elem; i++) { - c_field_offset[i] = (size_t)field_offset[i]; - c_field_types[i] = field_types[i]; + for (i = 0; i < num_elem; i++) { + c_field_offset[i] = (size_t)field_offset[i]; + c_field_types[i] = field_types[i]; } /* end for */ /* * allocate array of character pointers */ - if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) + if (NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) HGOTO_DONE(FAIL) /* copy data to long C string */ - if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)*(max_char_size_field_names)*(size_t)num_elem))) + if (NULL == + (tmp = (char *)HD5f2cstring(field_names, (size_t) * (max_char_size_field_names) * (size_t)num_elem))) HGOTO_DONE(FAIL) /* * move data from temorary buffer */ tmp_p = tmp; - for(i = 0; i < num_elem; i++) { - if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1))) + for (i = 0; i < num_elem; i++) { + if (NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1))) HGOTO_DONE(FAIL) HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]); c_field_names[i][char_len_field_names[i]] = '\0'; - tmp_p = tmp_p + *max_char_size_field_names; + tmp_p = tmp_p + *max_char_size_field_names; } /* end for */ /* * call H5TBmake_table function. */ - if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, - (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types, - (hsize_t)*chunk_size, NULL, *compress, NULL) < 0) + if (H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, (size_t)*type_size, + (const char **)c_field_names, c_field_offset, c_field_types, (hsize_t)*chunk_size, + NULL, *compress, NULL) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_name1) + if (c_name1) HDfree(c_name1); - if(c_field_names) { - for(i = 0; i < num_elem; i++) { - if(c_field_names[i]) + if (c_field_names) { + for (i = 0; i < num_elem; i++) { + if (c_field_names[i]) HDfree(c_field_names[i]); } /* end for */ HDfree(c_field_names); } /* end if */ - if(tmp) + if (tmp) HDfree(tmp); - if(c_field_offset) + if (c_field_offset) HDfree(c_field_offset); - if(c_field_types) + if (c_field_types) HDfree(c_field_types); return ret_value; } /* end h5tbmake_table_c() */ /*------------------------------------------------------------------------- -* Function: h5tbmake_table_ptr_c -* -* Purpose: Call H5TBmake_table using F2003 features -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: Sept. 10, 2015 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbmake_table_ptr_c + * + * Purpose: Call H5TBmake_table using F2003 features + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: Sept. 10, 2015 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, - _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, - size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size, - void *fill_data, int_f *compress, - size_t_f *char_len_field_names, /* field_names lengths */ - size_t_f *max_char_size_field_names, /* char len of fields */ - char *field_names, - void *data) /* field_names */ +h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, + hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, + hid_t_f *field_types, hsize_t_f *chunk_size, void *fill_data, int_f *compress, + size_t_f *char_len_field_names, /* field_names lengths */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names, void *data) /* field_names */ { - char *c_name = NULL; - char *c_name1 = NULL; + char * c_name = NULL; + char * c_name1 = NULL; hsize_t num_elem; hsize_t i; - hsize_t c_nfields = (hsize_t)*nfields; + hsize_t c_nfields = (hsize_t)*nfields; size_t *c_field_offset = NULL; - hid_t *c_field_types = NULL; - char **c_field_names = NULL; - char *tmp = NULL, *tmp_p; - int_f ret_value = 0; + hid_t * c_field_types = NULL; + char ** c_field_names = NULL; + char * tmp = NULL, *tmp_p; + int_f ret_value = 0; num_elem = (hsize_t)*nfields; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) + if (NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) HGOTO_DONE(FAIL) - if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + if (NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) + if (NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - for(i = 0; i < num_elem; i++) { - c_field_offset[i] = (size_t)field_offset[i]; - c_field_types[i] = field_types[i]; + for (i = 0; i < num_elem; i++) { + c_field_offset[i] = (size_t)field_offset[i]; + c_field_types[i] = field_types[i]; } /* end for */ /* * allocate array of character pointers */ - if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) + if (NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) HGOTO_DONE(FAIL) /* copy data to long C string */ - if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)*(max_char_size_field_names)*(size_t)num_elem))) + if (NULL == + (tmp = (char *)HD5f2cstring(field_names, (size_t) * (max_char_size_field_names) * (size_t)num_elem))) HGOTO_DONE(FAIL) /* * move data from temorary buffer */ tmp_p = tmp; - for(i = 0; i < num_elem; i++) { - if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1))) + for (i = 0; i < num_elem; i++) { + if (NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1))) HGOTO_DONE(FAIL) HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]); c_field_names[i][char_len_field_names[i]] = '\0'; - tmp_p = tmp_p + *max_char_size_field_names; + tmp_p = tmp_p + *max_char_size_field_names; } /* end for */ /* * call H5TBmake_table function. */ - if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, - (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types, - (hsize_t)*chunk_size, fill_data, *compress, data) < 0) + if (H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, (size_t)*type_size, + (const char **)c_field_names, c_field_offset, c_field_types, (hsize_t)*chunk_size, + fill_data, *compress, data) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_name1) + if (c_name1) HDfree(c_name1); - if(c_field_names) { - for(i = 0; i < num_elem; i++) { - if(c_field_names[i]) + if (c_field_names) { + for (i = 0; i < num_elem; i++) { + if (c_field_names[i]) HDfree(c_field_names[i]); } /* end for */ HDfree(c_field_names); } /* end if */ - if(tmp) + if (tmp) HDfree(tmp); - if(c_field_offset) + if (c_field_offset) HDfree(c_field_offset); - if(c_field_types) + if (c_field_types) HDfree(c_field_types); return ret_value; } /* end h5tbmake_table_c() */ - /*------------------------------------------------------------------------- -* Function: h5tbread_table_c -* -* Purpose: Call H5TBread_table using F2003 features -* -* Return: Success: 0, Failure: -1 -* -* Programmer: M. Scot Breitenfeld -* -* Date: Sept. 14, 2015 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbread_table_c + * + * Purpose: Call H5TBread_table using F2003 features + * + * Return: Success: 0, Failure: -1 + * + * Programmer: M. Scot Breitenfeld + * + * Date: Sept. 14, 2015 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, - size_t_f *dst_size, size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf) +h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, size_t_f *dst_size, + size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf) { - char *c_name = NULL; + char * c_name = NULL; size_t *c_dst_offset = NULL; - size_t *c_dst_sizes = NULL; - hsize_t c_nfields = (hsize_t)*nfields; - int_f ret_value = 0; + size_t *c_dst_sizes = NULL; + hsize_t c_nfields = (hsize_t)*nfields; + int_f ret_value = 0; hsize_t i; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + if (NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - if(NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + if (NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - for(i = 0; i < c_nfields; i++) { - c_dst_offset[i] = (size_t)dst_offset[i]; - c_dst_sizes[i] = (size_t)dst_sizes[i]; + for (i = 0; i < c_nfields; i++) { + c_dst_offset[i] = (size_t)dst_offset[i]; + c_dst_sizes[i] = (size_t)dst_sizes[i]; } /* end for */ /* * call H5TBread_table function. */ - if(H5TBread_table( (hid_t)*loc_id, c_name, (size_t)*dst_size, c_dst_offset, - c_dst_sizes, dst_buf) < 0) + if (H5TBread_table((hid_t)*loc_id, c_name, (size_t)*dst_size, c_dst_offset, c_dst_sizes, dst_buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_dst_offset) + if (c_dst_offset) HDfree(c_dst_offset); - if(c_dst_sizes) + if (c_dst_sizes) HDfree(c_dst_sizes); return ret_value; } /* end h5tbmake_table_c() */ - - - /*------------------------------------------------------------------------- -* Function: h5tbwrite_field_name_c -* -* Purpose: Call H5TBwrite_fields_name -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 12, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbwrite_field_name_c + * + * Purpose: Call H5TBwrite_fields_name + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 12, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, - hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { - char *c_name = NULL; - char *c_name1 = NULL; - size_t c_type_size[1] = {(size_t)*type_size}; - int_f ret_value = 0; + char * c_name = NULL; + char * c_name1 = NULL; + size_t c_type_size[1] = {(size_t)*type_size}; + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* * call H5TBwrite_fields_name function. */ - if(H5TBwrite_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, - (hsize_t)*nrecords, c_type_size[0], 0, c_type_size, buf) < 0) + if (H5TBwrite_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, (hsize_t)*nrecords, + c_type_size[0], 0, c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_name1) + if (c_name1) HDfree(c_name1); return ret_value; } - /*------------------------------------------------------------------------- -* Function: h5tbread_field_name_c -* -* Purpose: Call H5TBread_fields_name -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 12, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbread_field_name_c + * + * Purpose: Call H5TBread_fields_name + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 12, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5tbread_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, - hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { - char *c_name = NULL; - char *c_name1 = NULL; - size_t c_type_size[1] = {(size_t)*type_size}; - int_f ret_value = 0; + char * c_name = NULL; + char * c_name1 = NULL; + size_t c_type_size[1] = {(size_t)*type_size}; + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* * call H5TBread_fields_name function. */ - if(H5TBread_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, - (hsize_t)*nrecords, c_type_size[0], 0, c_type_size, buf) < 0) + if (H5TBread_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, (hsize_t)*nrecords, + c_type_size[0], 0, c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_name1) + if (c_name1) HDfree(c_name1); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5tbwrite_field_index_c -* -* Purpose: Call H5TBwrite_fields_index -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 12, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbwrite_field_index_c + * + * Purpose: Call H5TBwrite_fields_index + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 12, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start, - hsize_t_f *nrecords, size_t_f *type_size, void *buf) + hsize_t_f *nrecords, size_t_f *type_size, void *buf) { - char *c_name = NULL; - size_t c_type_size = *type_size; - int c_field_index = *field_index - 1; /* C zero based index */ - int_f ret_value = 0; + char * c_name = NULL; + size_t c_type_size = *type_size; + int c_field_index = *field_index - 1; /* C zero based index */ + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - /* * call H5TBwrite_fields_name function. */ - if(H5TBwrite_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index, - (hsize_t)*start, (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0) + if (H5TBwrite_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index, (hsize_t)*start, + (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5tbread_field_index_c -* -* Purpose: Call H5TBread_fields_index -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 12, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbread_field_index_c + * + * Purpose: Call H5TBread_fields_index + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 12, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f h5tbread_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start, - hsize_t_f *nrecords, size_t_f *type_size, void *buf) + hsize_t_f *nrecords, size_t_f *type_size, void *buf) { - char *c_name = NULL; - size_t c_type_size = *type_size; - int c_field_index = *field_index - 1; /* C zero based index */ - int_f ret_value = 0; + char * c_name = NULL; + size_t c_type_size = *type_size; + int c_field_index = *field_index - 1; /* C zero based index */ + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) /* * call H5TBread_fields_index function. */ - if(H5TBread_fields_index((hid_t)*loc_id, c_name,(hsize_t)1, &c_field_index, - (hsize_t)*start, (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0) + if (H5TBread_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index, (hsize_t)*start, + (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5tbinsert_field_c -* -* Purpose: Call H5TBinsert_field -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 13, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbinsert_field_c + * + * Purpose: Call H5TBinsert_field + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 13, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, - _fcd field_name, hid_t_f *field_type, int_f *position, void *buf) +h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, + hid_t_f *field_type, int_f *position, void *buf) { - char *c_name = NULL; - char *c_name1 = NULL; - int_f ret_value = 0; + char *c_name = NULL; + char *c_name1 = NULL; + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* * call H5TBinsert_field function. */ - if(H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type, - (hsize_t)*position, NULL, buf) < 0) + if (H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type, (hsize_t)*position, NULL, buf) < + 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_name1) + if (c_name1) HDfree(c_name1); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5tbdelete_field_c -* -* Purpose: Call H5TBdelete_field -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 13, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbdelete_field_c + * + * Purpose: Call H5TBdelete_field + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 13, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, - size_t_f *namelen1, _fcd field_name) +h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name) { - char *c_name = NULL; - char *c_name1 = NULL; - int_f ret_value = 0; + char *c_name = NULL; + char *c_name1 = NULL; + int_f ret_value = 0; /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) + if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1))) HGOTO_DONE(FAIL) /* * call H5TBinsert_field function. */ - if(H5TBdelete_field((hid_t)*loc_id, c_name, c_name1) < 0) + if (H5TBdelete_field((hid_t)*loc_id, c_name, c_name1) < 0) HGOTO_DONE(FAIL) done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_name1) + if (c_name1) HDfree(c_name1); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5tbget_table_info_c -* -* Purpose: Call H5TBread_fields_index -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 12, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbget_table_info_c + * + * Purpose: Call H5TBread_fields_index + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 12, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, - _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords) +h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords) { - char *c_name = NULL; + char * c_name = NULL; hsize_t c_nfields; hsize_t c_nrecords; int_f ret_value = 0; @@ -600,62 +591,61 @@ h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - /* * call H5TBread_fields_index function. */ - if(H5TBget_table_info((hid_t)*loc_id, c_name, &c_nfields, &c_nrecords) < 0) + if (H5TBget_table_info((hid_t)*loc_id, c_name, &c_nfields, &c_nrecords) < 0) HGOTO_DONE(FAIL) - *nfields = (hsize_t_f) c_nfields; - *nrecords = (hsize_t_f) c_nrecords; + *nfields = (hsize_t_f)c_nfields; + *nrecords = (hsize_t_f)c_nrecords; done: - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } /*------------------------------------------------------------------------- -* Function: h5tbget_field_info_c -* -* Purpose: Call H5TBget_field_info -* -* Return: Success: 0, Failure: -1 -* -* Programmer: Pedro Vicente -* -* Date: October 13, 2004 -* -* Comments: -* -*------------------------------------------------------------------------- -*/ + * Function: h5tbget_field_info_c + * + * Purpose: Call H5TBget_field_info + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente + * + * Date: October 13, 2004 + * + * Comments: + * + *------------------------------------------------------------------------- + */ int_f -h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, - size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size, - size_t_f *namelen2, /* field_names lengths */ - size_t_f *lenmax, /* character len max */ - _fcd field_names, /* field_names */ - size_t_f *maxlen_out) +h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, size_t_f *field_sizes, + size_t_f *field_offsets, size_t_f *type_size, + size_t_f *namelen2, /* field_names lengths */ + size_t_f *lenmax, /* character len max */ + _fcd field_names, /* field_names */ + size_t_f *maxlen_out) { - char *c_name = NULL; + char * c_name = NULL; hsize_t num_elem; - hsize_t c_nfields = *nfields; - size_t *c_field_sizes = NULL; + hsize_t c_nfields = *nfields; + size_t *c_field_sizes = NULL; size_t *c_field_offsets = NULL; size_t c_type_size; - char **c_field_names = NULL; - char *tmp = NULL, *tmp_p; + char ** c_field_names = NULL; + char * tmp = NULL, *tmp_p; hsize_t i; int_f ret_value = 0; - size_t c_lenmax; - size_t length = 0; + size_t c_lenmax; + size_t length = 0; c_lenmax = (size_t)*lenmax; @@ -664,47 +654,47 @@ h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *n /* * convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) HGOTO_DONE(FAIL) - if(NULL == (c_field_offsets = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + if (NULL == (c_field_offsets = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - if(NULL == (c_field_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + if (NULL == (c_field_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) HGOTO_DONE(FAIL) - if(NULL == (c_field_names = (char **)HDcalloc((size_t)c_nfields, sizeof(char *)))) + if (NULL == (c_field_names = (char **)HDcalloc((size_t)c_nfields, sizeof(char *)))) HGOTO_DONE(FAIL) - for(i = 0; i < c_nfields; i++) - if(NULL == (c_field_names[i] = (char *)HDmalloc(sizeof(char) * HLTB_MAX_FIELD_LEN))) + for (i = 0; i < c_nfields; i++) + if (NULL == (c_field_names[i] = (char *)HDmalloc(sizeof(char) * HLTB_MAX_FIELD_LEN))) HGOTO_DONE(FAIL) /* * call H5TBget_field_info function. */ - if(H5TBget_field_info((hid_t)*loc_id, c_name, c_field_names, c_field_sizes, - c_field_offsets, &c_type_size) < 0) + if (H5TBget_field_info((hid_t)*loc_id, c_name, c_field_names, c_field_sizes, c_field_offsets, + &c_type_size) < 0) HGOTO_DONE(FAIL) /* return values */ /* names array */ - if(NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1))) + if (NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1))) HGOTO_DONE(FAIL) tmp_p = tmp; HDmemset(tmp, ' ', c_lenmax * (size_t)c_nfields); tmp[c_lenmax * c_nfields] = '\0'; - for(i = 0; i < c_nfields; i++) { - size_t field_name_len = HDstrlen(c_field_names[i]); + for (i = 0; i < c_nfields; i++) { + size_t field_name_len = HDstrlen(c_field_names[i]); - HDmemcpy(tmp_p, c_field_names[i], field_name_len); - namelen2[i] = (size_t_f)field_name_len; - length = MAX(length, strlen((c_field_names[i]))); - tmp_p = tmp_p + c_lenmax; + HDmemcpy(tmp_p, c_field_names[i], field_name_len); + namelen2[i] = (size_t_f)field_name_len; + length = MAX(length, strlen((c_field_names[i]))); + tmp_p = tmp_p + c_lenmax; } /* end for */ - HD5packFstring(tmp, _fcdtocp(field_names), (size_t)( c_lenmax* c_nfields)); + HD5packFstring(tmp, _fcdtocp(field_names), (size_t)(c_lenmax * c_nfields)); *type_size = (size_t_f)c_type_size; - for(i = 0; i < num_elem; i++) { + for (i = 0; i < num_elem; i++) { field_sizes[i] = (size_t_f)c_field_sizes[i]; field_offsets[i] = (size_t_f)c_field_offsets[i]; } /* end for */ @@ -712,21 +702,20 @@ h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *n *maxlen_out = (size_t_f)length; done: - if(c_name) + if (c_name) HDfree(c_name); - if(c_field_names) { - for(i = 0; i < num_elem; i++) - if(c_field_names[i]) + if (c_field_names) { + for (i = 0; i < num_elem; i++) + if (c_field_names[i]) HDfree(c_field_names[i]); HDfree(c_field_names); } /* end if */ - if(tmp) + if (tmp) HDfree(tmp); - if(c_field_offsets) + if (c_field_offsets) HDfree(c_field_offsets); - if(c_field_sizes) + if (c_field_sizes) HDfree(c_field_sizes); return ret_value; } - |