diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-19 15:53:05 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-05-19 15:53:05 (GMT) |
commit | 3417e79f880421fb2f3f5af5e426b2c55405d501 (patch) | |
tree | 6b3cc8d95394bbd8d8e8d1f0b3989184b4b0d60b | |
parent | ebe57002d61b1b2928b31dbc687d178901d21066 (diff) | |
download | hdf5-3417e79f880421fb2f3f5af5e426b2c55405d501.zip hdf5-3417e79f880421fb2f3f5af5e426b2c55405d501.tar.gz hdf5-3417e79f880421fb2f3f5af5e426b2c55405d501.tar.bz2 |
[svn-r16961] Description:
Merge r16901:16960 from trunk into revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
-rwxr-xr-x | hl/fortran/src/H5IMfc.c | 1249 | ||||
-rwxr-xr-x | hl/fortran/src/H5LTf90proto.h | 1020 | ||||
-rwxr-xr-x | hl/fortran/src/H5LTfc.c | 2308 | ||||
-rwxr-xr-x | hl/fortran/src/H5LTff.f90 | 14 | ||||
-rwxr-xr-x | hl/fortran/src/H5TBfc.c | 1678 | ||||
-rw-r--r-- | hl/fortran/test/tstlite.f90 | 70 | ||||
-rw-r--r-- | release_docs/INSTALL_Windows.txt | 4 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 4 | ||||
-rw-r--r-- | src/H5ACprivate.h | 38 | ||||
-rw-r--r-- | src/H5Cprivate.h | 2 | ||||
-rw-r--r-- | src/H5E.c | 8 |
11 files changed, 3477 insertions, 2918 deletions
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index 367de86..bbf98cf 100755 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* 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 files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. 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 */ @@ -20,74 +20,86 @@ /*------------------------------------------------------------------------- - * Function: h5immake_image_8bit_c - * - * Purpose: Call H5IMmake_image_8bit - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5immake_image_8bit_c +* +* Purpose: Call H5IMmake_image_8bit +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5immake_image_8bit_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - int_f *buf) + int_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; - int c_namelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5IMmake_image_8bitf function. - */ - c_loc_id = (hid_t)*loc_id; - ret = H5IMmake_image_8bitf(c_loc_id,c_name,(hsize_t)*width,(hsize_t)*height,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + hsize_t w = (hsize_t)*width; + hsize_t h = (hsize_t)*height; + + /* + * convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5IMmake_image_8bitf function. + */ + c_loc_id = (hid_t)*loc_id; + ret = H5IMmake_image_8bitf(c_loc_id,c_name,w,h,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; + + } /*------------------------------------------------------------------------- - * Function: h5imread_image_c - * - * Purpose: Call H5IMread_image - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imread_image_c +* +* Purpose: Call H5IMread_image +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imread_image_c (hid_t_f *loc_id, @@ -95,235 +107,268 @@ nh5imread_image_c (hid_t_f *loc_id, _fcd name, int_f *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5IMread_image function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMread_imagef(c_loc_id,c_name,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5IMread_image function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMread_imagef(c_loc_id,c_name,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5immake_image_24bit_c - * - * Purpose: Call H5IMmake_image_24bit - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5immake_image_24bit_c +* +* Purpose: Call H5IMmake_image_24bit +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5immake_image_24bit_c (hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *ilen, + int_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; - int c_namelen; - char *c_il; - int c_ilen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_ilen = *ilen; - c_il = (char *)HD5f2cstring(il, c_ilen); - if (c_il == NULL) return ret_value; - -/* - * Call H5IMmake_image_24bitf function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMmake_image_24bitf(c_loc_id,c_name,(hsize_t)*width,(hsize_t)*height,c_il,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + char *c_il = NULL; + int c_ilen; + hsize_t w = (hsize_t)*width; + hsize_t h = (hsize_t)*height; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_ilen = *ilen; + c_il = (char *)HD5f2cstring(il, c_ilen); + if (c_il == NULL) + goto done; + + /* + * 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,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_il!=NULL) + free(c_il); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imget_image_info_c - * - * Purpose: Call H5IMget_image_info - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imget_image_info_c +* +* Purpose: Call H5IMget_image_info +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imget_image_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - hsize_t_f *planes, - hsize_t_f *npals, - int_f *ilen, - _fcd interlace) + int_f *namelen, + _fcd name, + hsize_t_f *width, + hsize_t_f *height, + hsize_t_f *planes, + hsize_t_f *npals, + int_f *ilen, + _fcd interlace) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - 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 - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Allocate buffer to hold name of an attribute - */ - if ((c_buf = malloc((size_t)*ilen +1)) == NULL) - return ret_value; - -/* - * 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); - - *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 - */ - HD5packFstring(c_buf, _fcdtocp(interlace), (size_t)*ilen); - - if(c_buf) free(c_buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + 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 + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * allocate buffer to hold name of an attribute + */ + if ((c_buf = malloc((size_t)*ilen +1)) == NULL) + goto done; + + /* + * 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); + + 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; + + /* + * 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) + free(c_name); + if(c_buf!=NULL) + free(c_buf); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imis_image_c - * - * Purpose: Call H5IMis_image - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imis_image_c +* +* Purpose: Call H5IMis_image +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imis_image_c(hid_t_f *loc_id, int_f *namelen, _fcd name) { - hid_t c_loc_id; - char *c_name; - int c_namelen; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + herr_t ret; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return -1; + + /* + * call H5LTget_dataset_ndims function. + */ + c_loc_id = (hid_t)*loc_id; -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return -1; + ret = H5IMis_image(c_loc_id, c_name); -/* - * Call H5LTget_dataset_ndims function. - */ - c_loc_id = (hid_t)*loc_id; + if(c_name!=NULL) + free(c_name); - return( H5IMis_image(c_loc_id, c_name)); + return ret; } /*------------------------------------------------------------------------- - * Function: h5immake_palette_c - * - * Purpose: Call H5IMmake_palette - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5immake_palette_c +* +* Purpose: Call H5IMmake_palette +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5immake_palette_c (hid_t_f *loc_id, @@ -332,62 +377,72 @@ nh5immake_palette_c (hid_t_f *loc_id, hsize_t_f *dims, void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - hsize_t *c_dims; - int i; - int rank=2; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_dims = malloc(sizeof(hsize_t) * (rank )); - if (!c_dims) return ret_value; - - for (i = 0; i < rank ; i++) { - c_dims[i] = dims[i]; - } - -/* - * Call H5IMmake_palette function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMmake_palettef(c_loc_id,c_name,c_dims,buf); - - free (c_dims); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + hsize_t *c_dims; + int i; + int rank=2; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_dims = malloc(sizeof(hsize_t) * (rank )); + if (c_dims == NULL) + goto done; + + for (i = 0; i < rank ; i++) + { + c_dims[i] = dims[i]; + } + + /* + * call H5IMmake_palette function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMmake_palettef(c_loc_id,c_name,c_dims,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_dims!=NULL) + free(c_dims); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imlink_palette_c - * - * Purpose: Call H5IMlink_palette - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imlink_palette_c +* +* Purpose: Call H5IMlink_palette +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imlink_palette_c (hid_t_f *loc_id, @@ -396,119 +451,138 @@ nh5imlink_palette_c (hid_t_f *loc_id, int_f *ilen, _fcd pal_name) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - char *c_namepal; - int c_namelenpal; - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelenpal = *ilen; - c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); - if (c_namepal == NULL) return ret_value; - -/* - * Call H5IMlink_palette function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMlink_palette(c_loc_id,c_name,c_namepal); - - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_namepal = NULL; + int c_namelen; + int c_namelenpal; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelenpal = *ilen; + c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); + if (c_namepal == NULL) + goto done; + + /* + * call H5IMlink_palette function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMlink_palette(c_loc_id,c_name,c_namepal); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_namepal!=NULL) + free(c_namepal); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imunlink_palette_c - * - * Purpose: Call H5IMunlink_palette - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imunlink_palette_c +* +* Purpose: Call H5IMunlink_palette +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imunlink_palette_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *ilen, - _fcd pal_name) + int_f *namelen, + _fcd name, + int_f *ilen, + _fcd pal_name) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - char *c_namepal; - int c_namelenpal; - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelenpal = *ilen; - c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); - if (c_namepal == NULL) return ret_value; - -/* - * Call H5IMunlink_palette function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMunlink_palette(c_loc_id,c_name,c_namepal); - - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_namepal = NULL; + int c_namelen; + int c_namelenpal; + + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelenpal = *ilen; + c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); + if (c_namepal == NULL) + goto done; + + /* + * call H5IMunlink_palette function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMunlink_palette(c_loc_id,c_name,c_namepal); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_namepal!=NULL) + free(c_namepal); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imget_npalettes_c - * - * Purpose: Call H5IMget_npalettes - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imget_npalettes_c +* +* Purpose: Call H5IMget_npalettes +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imget_npalettes_c(hid_t_f *loc_id, @@ -516,189 +590,220 @@ nh5imget_npalettes_c(hid_t_f *loc_id, _fcd name, hsize_t_f *npals) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - hssize_t c_npals; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - /* - * Call H5IMget_image_info function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMget_npalettes(c_loc_id,c_name,&c_npals); - - *npals = (hsize_t_f) c_npals; - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + hssize_t c_npals; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5IMget_image_info function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMget_npalettes(c_loc_id,c_name,&c_npals); + + *npals = (hsize_t_f) c_npals; + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imget_palette_info_c - * - * Purpose: Call H5IMget_palette_info - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imget_palette_info_c +* +* Purpose: Call H5IMget_palette_info +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imget_palette_info_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, - int_f *pal_number, - hsize_t_f *dims) + _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; - int c_namelen; - hsize_t c_dims[2]; - int i; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - /* - * 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); - - for (i = 0; i < 2 ; i++) { - dims[i] = (hsize_t_f) c_dims[i]; - } - - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + hsize_t c_dims[2]; + int i; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * 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); + + if (ret < 0) + goto done; + + for (i = 0; i < 2 ; i++) + { + dims[i] = (hsize_t_f) c_dims[i]; + } + + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imget_palette_c - * - * Purpose: Call H5IMget_palette - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imget_palette_c +* +* Purpose: Call H5IMget_palette +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imget_palette_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *pal_number, - void *buf) + int_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; - int c_namelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - /* - * Call H5IMget_image_info function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5IMget_palettef(c_loc_id,c_name,*pal_number,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5IMget_image_info function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMget_palettef(c_loc_id,c_name,*pal_number,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5imis_palette_c - * - * Purpose: Call H5IMis_palette - * - * Return: true, false, fail - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5imis_palette_c +* +* Purpose: Call H5IMis_palette +* +* Return: true, false, fail +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5imis_palette_c(hid_t_f *loc_id, int_f *namelen, - _fcd name) + _fcd name) { - hid_t c_loc_id; - char *c_name; - int c_namelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return -1; - -/* - * Call H5IMis_palette function. - */ - c_loc_id = (hid_t)*loc_id; - - return( H5IMis_palette(c_loc_id, c_name)); + hid_t c_loc_id; + char *c_name; + int c_namelen; + herr_t ret; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return -1; + + /* + * call H5IMis_palette function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5IMis_palette(c_loc_id, c_name); + + if(c_name!=NULL) + free(c_name); + + return ret; } diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 247a3e6..8a9d6c0 100755 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -1,17 +1,17 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* 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 files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +* access to either file, you may request a copy from help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef _H5LTf90proto_H @@ -28,8 +28,8 @@ H5_DLL void HD5packFstring (char *src, char *dest, size_t len); /* - * Functions from H5LTfc.c - */ +* Functions from H5LTfc.c +*/ # define nh5ltmake_dataset_c H5_FC_FUNC_(h5ltmake_dataset_c, H5LTMAKE_DATASET_C) # define nh5ltmake_dataset_int1_c H5_FC_FUNC_(h5ltmake_dataset_int1_c, H5LTMAKE_DATASET_INT1_C) # define nh5ltmake_dataset_int2_c H5_FC_FUNC_(h5ltmake_dataset_int2_c, H5LTMAKE_DATASET_INT2_C) @@ -89,9 +89,9 @@ H5_DLL void HD5packFstring (char *src, char *dest, size_t len); # define nh5ltget_attribute_info_c H5_FC_FUNC_(h5ltget_attribute_info_c, H5LTGET_ATTRIBUTE_INFO_C) /*------------------------------------------------------------------------- - * Image - *------------------------------------------------------------------------- - */ +* Image +*------------------------------------------------------------------------- +*/ # define nh5immake_image_8bit_c H5_FC_FUNC_(h5immake_image_8bit_c, H5IMMAKE_IMAGE_8BIT_C) # define nh5immake_image_24bit_c H5_FC_FUNC_(h5immake_image_24bit_c, H5IMMAKE_IMAGE_24BIT_C) # define nh5imread_image_c H5_FC_FUNC_(h5imread_image_c, H5IMREAD_IMAGE_C) @@ -106,9 +106,9 @@ H5_DLL void HD5packFstring (char *src, char *dest, size_t len); # define nh5imis_palette_c H5_FC_FUNC_(h5imis_palette_c, H5IMIS_PALETTE_C) /*------------------------------------------------------------------------- - * Table - *------------------------------------------------------------------------- - */ +* Table +*------------------------------------------------------------------------- +*/ # define nh5tbmake_table_c H5_FC_FUNC_(h5tbmake_table_c, H5TBMAKE_TABLE_C) # define nh5tbwrite_field_name_c H5_FC_FUNC_(h5tbwrite_field_name_c, H5TBWRITE_FIELD_NAME_C) # define nh5tbwrite_field_name_int_c H5_FC_FUNC_(h5tbwrite_field_name_int_c, H5TBWRITE_FIELD_NAME_INT_C) @@ -152,182 +152,182 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, H5_DLL int_f nh5ltmake_dataset_int1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_int2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_int3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_fl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_fl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_fl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_dl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_dl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_dl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_nint1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_nint2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_nfl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_ndl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_ndl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f nh5ltmake_dataset_ndl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf); H5_DLL int_f @@ -336,253 +336,254 @@ nh5ltread_dataset_c (hid_t_f *loc_id, _fcd name, hid_t_f *type_id, void *buf, - hsize_t_f *dims); + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_int1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_int2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_int3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_fl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_fl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_fl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_dl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_dl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_dl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_nint1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_nint2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_nint3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_nfl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_nfl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_nfl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_ndl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_ndl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltread_dataset_ndl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims); H5_DLL int_f nh5ltset_attribute_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + size_t_f *size, + void *buf); H5_DLL int_f nh5ltset_attribute_float_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + size_t_f *size, + void *buf); H5_DLL int_f nh5ltset_attribute_double_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + size_t_f *size, + void *buf); H5_DLL int_f nh5ltset_attribute_string_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + int_f *buflen, + void *buf); H5_DLL int_f nh5ltget_attribute_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf); H5_DLL int_f nh5ltget_attribute_float_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf); H5_DLL int_f nh5ltget_attribute_double_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf); H5_DLL int_f nh5ltget_attribute_string_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf); H5_DLL int_f nh5ltget_dataset_ndims_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank); + int_f *namelen, + _fcd name, + int_f *rank); H5_DLL int_f @@ -595,34 +596,35 @@ int_f nh5ltget_dataset_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, - hsize_t_f *dims, + hsize_t_f *dims, int_f *type_class, - size_t_f *type_size); + size_t_f *type_size); H5_DLL int_f nh5ltget_attribute_ndims_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - int_f *rank); + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + int_f *rank); H5_DLL int_f nh5ltget_attribute_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *attrnamelen, - _fcd attrname, - hsize_t_f *dims, - int_f *type_class, - size_t_f *type_size); + int_f *namelen, + _fcd name, + int_f *attrnamelen, + _fcd attrname, + hsize_t_f *dims, + int_f *type_class, + size_t_f *type_size); H5_DLL int_f nh5ltmake_dataset_string_c (hid_t_f *loc_id, int_f *namelen, _fcd name, + int_f *buflen, char *buf); H5_DLL @@ -633,18 +635,18 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, char *buf); /*------------------------------------------------------------------------- - * Image - *------------------------------------------------------------------------- - */ +* Image +*------------------------------------------------------------------------- +*/ H5_DLL int_f nh5immake_image_8bit_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - int_f *buf); + int_f *namelen, + _fcd name, + hsize_t_f *width, + hsize_t_f *height, + int_f *buf); H5_DLL int_f nh5imread_image_c (hid_t_f *loc_id, @@ -657,22 +659,22 @@ int_f nh5immake_image_24bit_c (hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *ilen, + int_f *ilen, _fcd il, hsize_t_f *width, hsize_t_f *height, - void *buf); + void *buf); H5_DLL int_f nh5imget_image_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *width, - hsize_t_f *height, - hsize_t_f *planes, - hsize_t_f *npals, - int_f *ilen, - _fcd interlace); + int_f *namelen, + _fcd name, + hsize_t_f *width, + hsize_t_f *height, + hsize_t_f *planes, + hsize_t_f *npals, + int_f *ilen, + _fcd interlace); H5_DLL @@ -701,71 +703,71 @@ nh5imlink_palette_c (hid_t_f *loc_id, H5_DLL int_f nh5imunlink_palette_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *ilen, - _fcd pal_name); + int_f *namelen, + _fcd name, + int_f *ilen, + _fcd pal_name); H5_DLL int_f nh5imget_npalettes_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *npals); + int_f *namelen, + _fcd name, + hsize_t_f *npals); H5_DLL int_f nh5imget_palette_info_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, - int_f *pal_number, - hsize_t_f *dims); + _fcd name, + int_f *pal_number, + hsize_t_f *dims); H5_DLL int_f nh5imget_palette_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *pal_number, - void *buf); + int_f *namelen, + _fcd name, + int_f *pal_number, + void *buf); H5_DLL int_f nh5imis_palette_c(hid_t_f *loc_id, int_f *namelen, - _fcd name); + _fcd name); /*------------------------------------------------------------------------- - * Table - *------------------------------------------------------------------------- - */ +* Table +*------------------------------------------------------------------------- +*/ H5_DLL int_f nh5tbmake_table_c(int_f *namelen1, - _fcd name1, - hid_t_f *loc_id, - int_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, - int_f *len, /* field_names lenghts */ - _fcd buf); /* field_names */ + _fcd name1, + hid_t_f *loc_id, + int_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, + int_f *len, /* field_names lenghts */ + _fcd buf); /* field_names */ H5_DLL int_f nh5tbwrite_field_name_c(hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *namelen1, + int_f *namelen1, _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, @@ -775,165 +777,165 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, H5_DLL int_f nh5tbwrite_field_name_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_name_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_name_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_name_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_name_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_name_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_name_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_index_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_index_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbwrite_field_index_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f @@ -949,53 +951,53 @@ nh5tbread_field_index_c(hid_t_f *loc_id, H5_DLL int_f nh5tbread_field_index_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_index_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_index_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbread_field_index_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf); + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf); H5_DLL int_f nh5tbinsert_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *namelen1, + int_f *namelen1, _fcd field_name, hid_t_f *field_type, int_f *position, @@ -1004,71 +1006,71 @@ nh5tbinsert_field_c(hid_t_f *loc_id, H5_DLL int_f nh5tbinsert_field_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf); H5_DLL int_f nh5tbinsert_field_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf); H5_DLL int_f nh5tbinsert_field_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf); H5_DLL int_f nh5tbinsert_field_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf); + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf); H5_DLL int_f nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *namelen1, - _fcd field_name); + int_f *namelen1, + _fcd field_name); H5_DLL int_f nh5tbget_table_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords); + int_f *namelen, + _fcd name, + hsize_t_f *nfields, + hsize_t_f *nrecords); H5_DLL int_f nh5tbget_field_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *nfields, - size_t_f *field_sizes, - size_t_f *field_offsets, - size_t_f *type_size, - int_f *namelen2, /* field_names lenghts */ - _fcd field_names) ; /* field_names */ + int_f *namelen, + _fcd name, + hsize_t_f *nfields, + size_t_f *field_sizes, + size_t_f *field_offsets, + size_t_f *type_size, + int_f *namelen2, /* field_names lenghts */ + _fcd field_names) ; /* field_names */ diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 61c7547..039385a 100755 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* 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 files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. 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 */ @@ -21,23 +21,23 @@ /*------------------------------------------------------------------------- - * Function: H5LTmake_dataset_c - * - * Purpose: Call H5LTmake_dataset - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTmake_dataset_c +* +* Purpose: Call H5LTmake_dataset +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltmake_dataset_c (hid_t_f *loc_id, @@ -48,57 +48,66 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, 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; - int c_namelen; - hsize_t *c_dims; - int i; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_dims = malloc(sizeof(hsize_t) * (*rank )); - if (!c_dims) return ret_value; - -/* - * 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. - */ - c_loc_id = (hid_t)*loc_id; - c_type_id = (hid_t)*type_id; - - ret = H5LTmake_dataset(c_loc_id, c_name, *rank, c_dims, c_type_id, buf ); - - free (c_dims); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + hid_t c_type_id; + char *c_name = NULL; + hsize_t *c_dims = NULL; + int c_namelen; + int i; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_dims = malloc(sizeof(hsize_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]; + } + + /* + * call H5LTmake_dataset function. + */ + c_loc_id = (hid_t)*loc_id; + c_type_id = (hid_t)*type_id; + + ret = H5LTmake_dataset(c_loc_id, c_name, *rank, c_dims, c_type_id, buf ); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_dims!=NULL) + free(c_dims); + return ret_value; } int_f nh5ltmake_dataset_int1_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_int2_c (hid_t_f *loc_id, @@ -109,7 +118,7 @@ nh5ltmake_dataset_int2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_int3_c (hid_t_f *loc_id, @@ -120,7 +129,7 @@ nh5ltmake_dataset_int3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_fl1_c (hid_t_f *loc_id, @@ -131,7 +140,7 @@ nh5ltmake_dataset_fl1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_fl2_c (hid_t_f *loc_id, @@ -142,7 +151,7 @@ nh5ltmake_dataset_fl2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_fl3_c (hid_t_f *loc_id, @@ -153,7 +162,7 @@ nh5ltmake_dataset_fl3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_dl1_c (hid_t_f *loc_id, @@ -164,7 +173,7 @@ nh5ltmake_dataset_dl1_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_dl2_c (hid_t_f *loc_id, @@ -175,7 +184,7 @@ nh5ltmake_dataset_dl2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_dl3_c (hid_t_f *loc_id, @@ -186,21 +195,43 @@ nh5ltmake_dataset_dl3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_nint1_c (hid_t_f *loc_id, - int_f *namelen, + int_f *namelen, _fcd name, int_f *rank, hsize_t_f *dims, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_nint2_c (hid_t_f *loc_id, + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) +{ + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); +} +int_f +nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) +{ + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); +} +int_f +nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *rank, @@ -208,10 +239,10 @@ nh5ltmake_dataset_nint2_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f -nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, +nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *rank, @@ -219,92 +250,70 @@ nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, hid_t_f *type_id, void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); -} -int_f -nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) -{ - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); -} -int_f -nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) -{ - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_nfl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_ndl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_ndl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } int_f nh5ltmake_dataset_ndl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf) + int_f *namelen, + _fcd name, + int_f *rank, + hsize_t_f *dims, + hid_t_f *type_id, + void *buf) { - return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); + return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf); } /*------------------------------------------------------------------------- - * Function: H5LTread_dataset_c - * - * Purpose: Call H5LTmake_dataset - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTread_dataset_c +* +* Purpose: Call H5LTmake_dataset +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltread_dataset_c (hid_t_f *loc_id, @@ -314,282 +323,308 @@ nh5ltread_dataset_c (hid_t_f *loc_id, void *buf, hsize_t_f *dims) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - hid_t c_type_id; - char *c_name; - int c_namelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * 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 ); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + hid_t c_type_id; + char *c_name = NULL; + int c_namelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * 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 ); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } int_f nh5ltread_dataset_int1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_int2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_int3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_fl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_fl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_fl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_dl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_dl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_dl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_nint1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_nint2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_nint3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_nfl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_nfl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_nfl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_ndl1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_ndl2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } int_f nh5ltread_dataset_ndl3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + int_f *namelen, + _fcd name, + hid_t_f *type_id, + void *buf, + hsize_t_f *dims) { - return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); + return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims); } /*------------------------------------------------------------------------- - * Function: H5LTmake_dataset_string_c - * - * Purpose: Call H5LTmake_dataset - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTmake_dataset_string_c +* +* Purpose: Call H5LTmake_dataset +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltmake_dataset_string_c (hid_t_f *loc_id, int_f *namelen, _fcd name, + int_f *buflen, char *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5LTmake_dataset_string function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTmake_dataset_string(c_loc_id,c_name,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + char *c_buf = NULL; + int c_buflen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_buflen = *buflen; + c_buf = (char *)HD5f2cstring(buf, c_buflen); + if (c_buf == NULL) + goto done; + + /* + * call H5LTmake_dataset_string function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTmake_dataset_string(c_loc_id,c_name,c_buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_buf!=NULL) + free(c_buf); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTread_dataset_string_c - * - * Purpose: Call H5LTread_dataset_string - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTread_dataset_string_c +* +* Purpose: Call H5LTread_dataset_string +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltread_dataset_string_c (hid_t_f *loc_id, @@ -597,541 +632,654 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, _fcd name, char *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5LTread_dataset_string function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTread_dataset_string(c_loc_id,c_name,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5LTread_dataset_string function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTread_dataset_string(c_loc_id,c_name,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTset_attribute_int_c - * - * Purpose: Call H5LTset_attribute_int - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTset_attribute_int_c +* +* Purpose: Call H5LTset_attribute_int +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltset_attribute_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + size_t_f *size, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - char *c_attrname; - int c_namelen; - int c_attrnamelen; - size_t c_size; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTset_attribute_int function. - */ - c_loc_id = (hid_t)*loc_id; - c_size = (size_t)*size; - - if (sizeof(int_f) == sizeof(int)) - ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,buf,c_size); - else if (sizeof(int_f) == sizeof(long)) - ret = H5LTset_attribute_long(c_loc_id,c_name,c_attrname,buf,c_size); - else if (sizeof(int_f) == sizeof(long long)) - ret = H5LTset_attribute_long_long(c_loc_id,c_name,c_attrname,buf,c_size); - else - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + size_t c_size; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * call H5LTset_attribute_int function. + */ + c_loc_id = (hid_t)*loc_id; + c_size = (size_t)*size; + + if (sizeof(int_f) == sizeof(int)) + ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,buf,c_size); + else if (sizeof(int_f) == sizeof(long)) + ret = H5LTset_attribute_long(c_loc_id,c_name,c_attrname,buf,c_size); + else if (sizeof(int_f) == sizeof(long long)) + ret = H5LTset_attribute_long_long(c_loc_id,c_name,c_attrname,buf,c_size); + else + goto done; + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTset_attribute_float_c - * - * Purpose: Call H5LTset_attribute_float - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTset_attribute_float_c +* +* Purpose: Call H5LTset_attribute_float +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltset_attribute_float_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + size_t_f *size, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - char *c_attrname; - int c_namelen; - int c_attrnamelen; - size_t c_size; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = *attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTset_attribute_float function. - */ - c_loc_id = (hid_t)*loc_id; - c_size = (size_t)*size; - - ret = H5LTset_attribute_float(c_loc_id,c_name,c_attrname,buf,c_size); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + size_t c_size; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = *attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * Call H5LTset_attribute_float function. + */ + c_loc_id = (hid_t)*loc_id; + c_size = (size_t)*size; + + ret = H5LTset_attribute_float(c_loc_id,c_name,c_attrname,buf,c_size); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTset_attribute_double_c - * - * Purpose: Call H5LTset_attribute_double - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTset_attribute_double_c +* +* Purpose: Call H5LTset_attribute_double +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltset_attribute_double_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - size_t_f *size, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + size_t_f *size, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - char *c_attrname; - int c_namelen; - int c_attrnamelen; - size_t c_size; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = *attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTset_attribute_double function. - */ - c_loc_id = (hid_t)*loc_id; - c_size = (size_t)*size; - - ret = H5LTset_attribute_double(c_loc_id,c_name,c_attrname,buf,c_size); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + size_t c_size; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = *attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * Call H5LTset_attribute_double function. + */ + c_loc_id = (hid_t)*loc_id; + c_size = (size_t)*size; + + ret = H5LTset_attribute_double(c_loc_id,c_name,c_attrname,buf,c_size); + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTset_attribute_string_c - * - * Purpose: Call H5LTset_attribute_string - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTset_attribute_string_c +* +* Purpose: Call H5LTset_attribute_string +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltset_attribute_string_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + int_f *buflen, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - char *c_attrname; - int c_namelen; - int c_attrnamelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = *attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTset_attribute_string function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + char *c_buf = NULL; + int c_buflen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = *attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + c_buflen = *buflen; + c_buf = (char *)HD5f2cstring(buf, c_buflen); + if (c_buf == NULL) + goto done; + + + /* + * call H5LTset_attribute_string function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,c_buf); + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + if(c_buf!=NULL) + free(c_buf); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTget_attribute_int_c - * - * Purpose: Call H5LTget_attribute_int - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTget_attribute_int_c +* +* Purpose: Call H5LTget_attribute_int +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_attribute_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - char *c_attrname; - int c_attrnamelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTget_attribute_int function. - */ - c_loc_id = (hid_t)*loc_id; - - if(sizeof(int_f) == sizeof(int)) - ret = H5LTget_attribute_int(c_loc_id,c_name,c_attrname,buf); - else if (sizeof(int_f) == sizeof(long)) - ret = H5LTget_attribute_long(c_loc_id,c_name,c_attrname,buf); - else if (sizeof(int_f) == sizeof(long long)) - ret = H5LTget_attribute_long_long(c_loc_id,c_name,c_attrname,buf); - else - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * call H5LTget_attribute_int function. + */ + c_loc_id = (hid_t)*loc_id; + + if(sizeof(int_f) == sizeof(int)) + ret = H5LTget_attribute_int(c_loc_id,c_name,c_attrname,buf); + else if (sizeof(int_f) == sizeof(long)) + ret = H5LTget_attribute_long(c_loc_id,c_name,c_attrname,buf); + else if (sizeof(int_f) == sizeof(long long)) + ret = H5LTget_attribute_long_long(c_loc_id,c_name,c_attrname,buf); + else + goto done; + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTget_attribute_float_c - * - * Purpose: Call H5LTget_attribute_float - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTget_attribute_float_c +* +* Purpose: Call H5LTget_attribute_float +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_attribute_float_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - char *c_attrname; - int c_attrnamelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTget_attribute_int function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTget_attribute_float(c_loc_id,c_name,c_attrname,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * call H5LTget_attribute_int function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTget_attribute_float(c_loc_id,c_name,c_attrname,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTget_attribute_double_c - * - * Purpose: Call H5LTget_attribute_double - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTget_attribute_double_c +* +* Purpose: Call H5LTget_attribute_double +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_attribute_double_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - char *c_attrname; - int c_attrnamelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTget_attribute_int function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTget_attribute_double(c_loc_id,c_name,c_attrname,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + + /* + * convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * call H5LTget_attribute_int function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTget_attribute_double(c_loc_id,c_name,c_attrname,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTget_attribute_string_c - * - * Purpose: Call H5LTget_attribute_string - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTget_attribute_string_c +* +* Purpose: Call H5LTget_attribute_string +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_attribute_string_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - void *buf) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + void *buf) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - char *c_attrname; - int c_attrnamelen; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * Call H5LTget_attribute_int function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTget_attribute_string(c_loc_id,c_name,c_attrname,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * Call H5LTget_attribute_int function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTget_attribute_string(c_loc_id,c_name,c_attrname,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + + return ret_value; } /*------------------------------------------------------------------------- - * Function: H5LTget_dataset_ndims_c - * - * Purpose: Call H5LTget_dataset_ndims - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: H5LTget_dataset_ndims_c +* +* Purpose: Call H5LTget_dataset_ndims +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_dataset_ndims_c(hid_t_f *loc_id, @@ -1139,96 +1287,111 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, _fcd name, int_f *rank) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - int c_rank; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5LTget_dataset_ndims function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); - - if (ret < 0) return ret_value; - *rank = (int_f)c_rank; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + int c_rank; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * Call H5LTget_dataset_ndims function. + */ + c_loc_id = (hid_t)*loc_id; + + ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); + + if (ret < 0) + goto done; + + *rank = (int_f)c_rank; + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5ltfind_dataset_c - * - * Purpose: Call H5LTfind_dataset - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5ltfind_dataset_c +* +* Purpose: Call H5LTfind_dataset +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltfind_dataset_c(hid_t_f *loc_id, int_f *namelen, _fcd name) { - hid_t c_loc_id; - char *c_name; - int c_namelen; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + herr_t ret; -/* - * Convert FORTRAN name to C name - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return -1; + /* + * Convert FORTRAN name to C name + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return -1; -/* - * Call H5LTget_dataset_ndims function. - */ - c_loc_id = (hid_t)*loc_id; + /* + * Call H5LTget_dataset_ndims function. + */ + c_loc_id = (hid_t)*loc_id; - return( H5LTfind_dataset(c_loc_id, c_name)); + ret = H5LTfind_dataset(c_loc_id, c_name); + + if(c_name!=NULL) + free(c_name); + + return ret; } /*------------------------------------------------------------------------- - * Function: h5ltget_dataset_info_c - * - * Purpose: Call H5LTget_dataset_info - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5ltget_dataset_info_c +* +* Purpose: Call H5LTget_dataset_info +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_dataset_info_c(hid_t_f *loc_id, @@ -1238,187 +1401,222 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, int_f *type_class, size_t_f *type_size) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - int c_namelen; - 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 - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * 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); - if (ret < 0) return ret_value; - - *type_class = c_classtype; - *type_size = (size_t_f)c_type_size; - - /* - * Transpose dimension arrays because of C-FORTRAN storage order - */ - - ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); - if (ret < 0) return ret_value; - - for (i = 0; i < c_rank ; i++) { - dims[i] = (hsize_t_f) c_dims[c_rank - i - 1]; - } - - - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + int c_namelen; + 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 + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * 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); + if (ret < 0) + goto done; + + *type_class = c_classtype; + *type_size = (size_t_f)c_type_size; + + /* + * 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]; + } + + + ret_value = 0; + +done: + if(c_name!=NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5ltget_attribute_ndims_c - * - * Purpose: Call H5LTget_attribute_ndims - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 05, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5ltget_attribute_ndims_c +* +* Purpose: Call H5LTget_attribute_ndims +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 05, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_attribute_ndims_c(hid_t_f *loc_id, - int_f *namelen, - _fcd dsetname, - int_f *attrnamelen, - _fcd attrname, - int_f *rank) + int_f *namelen, + _fcd dsetname, + int_f *attrnamelen, + _fcd attrname, + int_f *rank) { - int ret_value = -1; - herr_t ret; - hid_t c_loc_id; - char *c_name; - char *c_attrname; - int c_namelen; - int c_attrnamelen; - int c_rank; - -/* - * Convert FORTRAN name to C name - */ - c_namelen =(int) *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * 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); - - if (ret < 0) return ret_value; - *rank = (int_f)c_rank; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + int c_rank; + + /* + * Convert FORTRAN name to C name + */ + c_namelen =(int) *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * 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); + + if (ret < 0) + goto done; + + *rank = (int_f)c_rank; + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5ltget_attribute_info_c - * - * Purpose: Call H5LTget_attribute_info - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September 09, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5ltget_attribute_info_c +* +* Purpose: Call H5LTget_attribute_info +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: September 09, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5ltget_attribute_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *attrnamelen, - _fcd attrname, - hsize_t_f *dims, - int_f *type_class, - size_t_f *type_size) + int_f *namelen, + _fcd name, + int_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; - char *c_attrname; - int c_namelen; - int c_attrnamelen; - 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 - */ - c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); - if (c_attrname == NULL) return ret_value; - -/* - * 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); - if (ret < 0) return ret_value; - - *type_class = c_classtype; - *type_size = (size_t_f)c_type_size; - -/* - * Transpose dimension arrays because of C-FORTRAN storage order - */ - - ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank); - if (ret < 0) return ret_value; - - for (i = 0; i < c_rank ; i++) { - dims[i] = (hsize_t_f) c_dims[c_rank - i - 1]; - } - - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + hid_t c_loc_id; + char *c_name = NULL; + char *c_attrname = NULL; + int c_namelen; + int c_attrnamelen; + 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 + */ + c_namelen = (int)*namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_attrnamelen = (int)*attrnamelen; + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + if (c_attrname == NULL) + goto done; + + /* + * 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); + if (ret < 0) + goto done; + + *type_class = c_classtype; + *type_size = (size_t_f)c_type_size; + + /* + * transpose dimension arrays because of C-FORTRAN storage order + */ + + 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]; + } + + ret_value = 0; + + +done: + if(c_name!=NULL) + free(c_name); + if(c_attrname!=NULL) + free(c_attrname); + + + return ret_value; } diff --git a/hl/fortran/src/H5LTff.f90 b/hl/fortran/src/H5LTff.f90 index 45d9a23..c6a6396 100755 --- a/hl/fortran/src/H5LTff.f90 +++ b/hl/fortran/src/H5LTff.f90 @@ -2453,9 +2453,10 @@ subroutine h5ltmake_dataset_string_f(loc_id,& character(len=*), intent(in) :: buf ! data buffer integer :: errcode ! error code integer :: namelen ! name length + integer :: buflen ! buffer length interface - integer function h5ltmake_dataset_string_c(loc_id,namelen,dset_name,buf) + integer function h5ltmake_dataset_string_c(loc_id,namelen,dset_name,buflen,buf) use h5global !DEC$ IF DEFINED(HDF5F90_WINDOWS) !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5LTMAKE_DATASET_STRING_C'::h5ltmake_dataset_string_c @@ -2463,13 +2464,15 @@ subroutine h5ltmake_dataset_string_f(loc_id,& !DEC$ATTRIBUTES reference :: dset_name integer(hid_t), intent(in) :: loc_id ! file or group identifier integer :: namelen ! lenght of name buffer + integer :: buflen ! lenght of data buffer character(len=*), intent(in) :: dset_name ! name of the dataset character(len=*), intent(in) :: buf ! data buffer end function h5ltmake_dataset_string_c end interface namelen = len(dset_name) - errcode = h5ltmake_dataset_string_c(loc_id,namelen,dset_name,buf) + buflen = len(buf) + errcode = h5ltmake_dataset_string_c(loc_id,namelen,dset_name,buflen,buf) end subroutine h5ltmake_dataset_string_f @@ -2775,9 +2778,10 @@ subroutine h5ltset_attribute_string_f(loc_id,& character(len=*), intent(in) :: buf ! data buffer integer :: namelen ! name length integer :: attrlen ! name length + integer :: buflen ! data buffer length interface - integer function h5ltset_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf) + integer function h5ltset_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buflen,buf) use h5global !DEC$ IF DEFINED(HDF5F90_WINDOWS) !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5LTSET_ATTRIBUTE_STRING_C'::h5ltset_attribute_string_c @@ -2787,6 +2791,7 @@ subroutine h5ltset_attribute_string_f(loc_id,& integer(hid_t), intent(in) :: loc_id ! file or group identifier integer :: namelen ! lenght of name buffer integer :: attrlen ! lenght of attr name buffer + integer :: buflen ! data buffer length character(len=*), intent(in) :: dset_name ! name of the dataset character(len=*), intent(in) :: attr_name ! name of the attribute character(len=*), intent(in) :: buf ! data buffer @@ -2795,7 +2800,8 @@ subroutine h5ltset_attribute_string_f(loc_id,& namelen = len(dset_name) attrlen = len(attr_name) - errcode = h5ltset_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf) + buflen = len(buf) + errcode = h5ltset_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buflen,buf) end subroutine h5ltset_attribute_string_f diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index c641cf4..38af99c 100755 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +* 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 files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. 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 */ @@ -19,23 +19,23 @@ #include "H5LTf90proto.h" /*------------------------------------------------------------------------- - * Function: h5tbmake_table_c - * - * Purpose: Call H5TBmake_table - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 06, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbmake_table_c +* +* Purpose: Call H5TBmake_table +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 06, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbmake_table_c(int_f *namelen1, _fcd name1, @@ -52,472 +52,550 @@ nh5tbmake_table_c(int_f *namelen1, int_f *namelen2, /* field_names lenghts */ _fcd field_names) /* field_names */ { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - char *c_name1; - int c_namelen1; - hsize_t num_elem; - hsize_t i; - int max_len=1; - hid_t c_loc_id = *loc_id; - hsize_t c_nfields = *nfields; - hsize_t c_nrecords = *nrecords; - hsize_t c_chunk_size = *chunk_size; - size_t c_type_size = *type_size; - size_t *c_field_offset; - hid_t *c_field_types; - char **c_field_names; - char *tmp, *tmp_p; - - num_elem = *nfields; - - for (i=0; i < num_elem; i++) { - if (namelen2[i] > max_len) max_len = namelen2[i]; - } - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(name1, c_namelen1); - if (c_name1 == NULL) return ret_value; - - c_field_offset = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); - if (!c_field_offset) return ret_value; - - c_field_types = (hid_t*)malloc(sizeof(hid_t) * (size_t)c_nfields); - if (!c_field_types) return ret_value; - - for (i=0; i < num_elem; i++) { - c_field_offset[i] = field_offset[i]; - c_field_types[i] = field_types[i]; - } - -/* - * Allocate array of character pointers - */ - c_field_names = (char **)malloc((size_t)num_elem * sizeof(char *)); - if (c_field_names == NULL) return ret_value; - - /* Copy data to long C string */ - tmp = (char *)HD5f2cstring(field_names, (int)(max_len*num_elem)); - if (tmp == NULL) { - free(c_field_names); - return ret_value; - } - -/* - * Move data from temorary buffer - */ - tmp_p = tmp; - for (i=0; i < num_elem; i++) { - c_field_names[i] = (char *) malloc((size_t)namelen2[i]+1); - memcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]); - c_field_names[i][namelen2[i]] = '\0'; - tmp_p = tmp_p + max_len; - } - -/* - * Call H5TBmake_table function. - */ - - ret = H5TBmake_table(c_name1,c_loc_id,c_name,c_nfields,c_nrecords,c_type_size, - c_field_names,c_field_offset,c_field_types,c_chunk_size,NULL,*compress,NULL); - - for (i=0; i < num_elem; i++) { - free (c_field_names[i]); - } - free(c_field_names); - free(tmp); - free(c_field_offset); - free(c_field_types); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + char *c_name1 = NULL; + int c_namelen1; + hsize_t num_elem; + hsize_t i; + int max_len=1; + hid_t c_loc_id = *loc_id; + hsize_t c_nfields = *nfields; + hsize_t c_nrecords = *nrecords; + hsize_t c_chunk_size = *chunk_size; + size_t c_type_size = *type_size; + size_t *c_field_offset = NULL; + hid_t *c_field_types = NULL; + char **c_field_names = NULL; + char *tmp = NULL, *tmp_p = NULL; + + num_elem = *nfields; + + for ( i = 0; i < num_elem; i++) + { + if (namelen2[i] > max_len) max_len = namelen2[i]; + } + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelen1 = *namelen1; + c_name1 = (char *)HD5f2cstring(name1, c_namelen1); + if (c_name1 == NULL) + goto done; + + c_field_offset = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); + if (!c_field_offset) + goto done; + + c_field_types = (hid_t*)malloc(sizeof(hid_t) * (size_t)c_nfields); + if (!c_field_types) + goto done; + + for ( i = 0; i < num_elem; i++) + { + c_field_offset[i] = field_offset[i]; + c_field_types[i] = field_types[i]; + } + + /* + * allocate array of character pointers + */ + c_field_names = (char **)malloc((size_t)num_elem * sizeof(char *)); + if (c_field_names == NULL) + goto done; + + /* copy data to long C string */ + tmp = (char *)HD5f2cstring(field_names, (int)(max_len*num_elem)); + if (tmp == NULL) + { + goto done; + } + + /* + * move data from temorary buffer + */ + tmp_p = tmp; + for (i=0; i < num_elem; i++) + { + c_field_names[i] = (char *) malloc((size_t)namelen2[i]+1); + memcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]); + c_field_names[i][namelen2[i]] = '\0'; + tmp_p = tmp_p + max_len; + } + + /* + * call H5TBmake_table function. + */ + + ret = H5TBmake_table(c_name1, + c_loc_id, + c_name, + c_nfields, + c_nrecords, + c_type_size, + c_field_names, + c_field_offset, + c_field_types, + c_chunk_size, + NULL, + *compress, + NULL); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name != NULL) + free(c_name); + if(c_name1 != NULL) + free(c_name1); + + for ( i = 0; i < num_elem; i++) + { + if ( c_field_names[i] ) + free (c_field_names[i]); + } + if ( c_field_names ) + free(c_field_names); + if ( tmp ) + free(tmp); + if ( c_field_offset ) + free(c_field_offset); + if ( c_field_types ) + free(c_field_types); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5tbwrite_field_name_c - * - * Purpose: Call H5TBwrite_fields_name - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 12, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbwrite_field_name_c +* +* Purpose: Call H5TBwrite_fields_name +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 12, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbwrite_field_name_c(hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *namelen1, + int_f *namelen1, _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - char *c_name1; - int c_namelen1; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; - size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - - c_type_sizes[0] = c_type_size; - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) return ret_value; - -/* - * Call H5TBwrite_fields_name function. - */ - - ret = H5TBwrite_fields_name(c_loc_id,c_name,c_name1,c_start,c_nrecords,c_type_size, - 0,c_type_sizes,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + char *c_name1 = NULL; + int c_namelen1; + hid_t c_loc_id = *loc_id; + hsize_t c_start = *start; + hsize_t c_nrecords = *nrecords; + size_t c_type_size = *type_size; + size_t c_type_sizes[1]; + + c_type_sizes[0] = c_type_size; + + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelen1 = *namelen1; + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + if (c_name1 == NULL) + goto done; + + /* + * call H5TBwrite_fields_name function. + */ + + ret = H5TBwrite_fields_name(c_loc_id, + c_name, + c_name1, + c_start, + c_nrecords, + c_type_size, + 0, + c_type_sizes, + buf); + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name != NULL) + free(c_name); + if(c_name1 != NULL) + free(c_name1); + + return ret_value; } int_f nh5tbwrite_field_name_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } int_f nh5tbwrite_field_name_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } int_f nh5tbwrite_field_name_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } int_f nh5tbwrite_field_name_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } /*------------------------------------------------------------------------- - * Function: h5tbread_field_name_c - * - * Purpose: Call H5TBread_fields_name - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 12, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbread_field_name_c +* +* Purpose: Call H5TBread_fields_name +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 12, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbread_field_name_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, + int_f *namelen, + _fcd name, int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - char *c_name1; - int c_namelen1; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; - size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - - c_type_sizes[0] = c_type_size; - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) return ret_value; - -/* - * Call H5TBread_fields_name function. - */ - - ret = H5TBread_fields_name(c_loc_id,c_name,c_name1,c_start,c_nrecords,c_type_size, - 0,c_type_sizes,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + char *c_name1 = NULL; + int c_namelen1; + hid_t c_loc_id = *loc_id; + hsize_t c_start = *start; + hsize_t c_nrecords = *nrecords; + size_t c_type_size = *type_size; + size_t c_type_sizes[1]; + + c_type_sizes[0] = c_type_size; + + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelen1 = *namelen1; + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + if (c_name1 == NULL) + goto done; + + /* + * call H5TBread_fields_name function. + */ + + ret = H5TBread_fields_name(c_loc_id, + c_name, + c_name1, + c_start, + c_nrecords, + c_type_size, + 0, + c_type_sizes, + buf); + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name != NULL) + free(c_name); + + return ret_value; } int_f nh5tbread_field_name_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } int_f nh5tbread_field_name_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } int_f nh5tbread_field_name_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } int_f nh5tbread_field_name_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); + return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf); } /*------------------------------------------------------------------------- - * Function: h5tbwrite_field_index_c - * - * Purpose: Call H5TBwrite_fields_index - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 12, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbwrite_field_index_c +* +* Purpose: Call H5TBwrite_fields_index +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 12, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbwrite_field_index_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; - size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - int c_field_index[1]; - - c_type_sizes[0] = c_type_size; - c_field_index[0] = *field_index - 1; /* C zero based index */ - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - -/* - * Call H5TBwrite_fields_name function. - */ - - ret = H5TBwrite_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size, - 0,c_type_sizes,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + hid_t c_loc_id = *loc_id; + hsize_t c_start = *start; + hsize_t c_nrecords = *nrecords; + size_t c_type_size = *type_size; + size_t c_type_sizes[1]; + int c_field_index[1]; + + c_type_sizes[0] = c_type_size; + c_field_index[0] = *field_index - 1; /* C zero based index */ + + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + + /* + * call H5TBwrite_fields_name function. + */ + + ret = H5TBwrite_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size, + 0,c_type_sizes,buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name != NULL) + free(c_name); + + return ret_value; } int_f nh5tbwrite_field_index_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } int_f nh5tbwrite_field_index_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } int_f nh5tbwrite_field_index_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } int_f nh5tbwrite_field_index_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } /*------------------------------------------------------------------------- - * Function: h5tbread_field_index_c - * - * Purpose: Call H5TBread_fields_index - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 12, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbread_field_index_c +* +* Purpose: Call H5TBread_fields_index +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 12, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbread_field_index_c(hid_t_f *loc_id, @@ -529,107 +607,122 @@ nh5tbread_field_index_c(hid_t_f *loc_id, size_t_f *type_size, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - hid_t c_loc_id = *loc_id; - hsize_t c_start = *start; - hsize_t c_nrecords = *nrecords; - size_t c_type_size = *type_size; - size_t c_type_sizes[1]; - int c_field_index[1]; - - c_type_sizes[0] = c_type_size; - c_field_index[0] = *field_index - 1; /* C zero based index */ - - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5TBread_fields_index function. - */ - - ret = H5TBread_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size, - 0,c_type_sizes,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + hid_t c_loc_id = *loc_id; + hsize_t c_start = *start; + hsize_t c_nrecords = *nrecords; + size_t c_type_size = *type_size; + size_t c_type_sizes[1]; + int c_field_index[1]; + + c_type_sizes[0] = c_type_size; + c_field_index[0] = *field_index - 1; /* C zero based index */ + + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5TBread_fields_index function. + */ + + ret = H5TBread_fields_index(c_loc_id, + c_name,(hsize_t)1, + c_field_index, + c_start, + c_nrecords, + c_type_size, + 0, + c_type_sizes, + buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name != NULL) + free(c_name); + + return ret_value; } int_f nh5tbread_field_index_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } int_f nh5tbread_field_index_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } int_f nh5tbread_field_index_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } int_f nh5tbread_field_index_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) + int_f *namelen, + _fcd name, + int_f *field_index, + hsize_t_f *start, + hsize_t_f *nrecords, + size_t_f *type_size, + void *buf) { - return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); + return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf); } /*------------------------------------------------------------------------- - * Function: h5tbinsert_field_c - * - * Purpose: Call H5TBinsert_field - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 13, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbinsert_field_c +* +* Purpose: Call H5TBinsert_field +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 13, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbinsert_field_c(hid_t_f *loc_id, @@ -641,320 +734,379 @@ nh5tbinsert_field_c(hid_t_f *loc_id, int_f *position, void *buf) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - char *c_name1; - int c_namelen1; - hid_t c_loc_id = *loc_id; - hid_t c_field_type = *field_type; - hsize_t c_position = *position; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) return ret_value; - -/* - * Call H5TBinsert_field function. - */ - - ret = H5TBinsert_field(c_loc_id,c_name,c_name1,c_field_type,c_position,NULL,buf); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + char *c_name1 = NULL; + int c_namelen1; + hid_t c_loc_id = *loc_id; + hid_t c_field_type = *field_type; + hsize_t c_position = *position; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelen1 = *namelen1; + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + if (c_name1 == NULL) + goto done; + + /* + * call H5TBinsert_field function. + */ + + ret = H5TBinsert_field(c_loc_id, + c_name, + c_name1, + c_field_type, + c_position, + NULL, + buf); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name != NULL) + free(c_name); + if(c_name1 != NULL) + free(c_name1); + + return ret_value; } int_f nh5tbinsert_field_int_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } int_f nh5tbinsert_field_fl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } int_f nh5tbinsert_field_dl_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } int_f nh5tbinsert_field_st_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf) + int_f *namelen, + _fcd name, + int_f *namelen1, + _fcd field_name, + hid_t_f *field_type, + int_f *position, + void *buf) { - return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); + return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf); } /*------------------------------------------------------------------------- - * Function: h5tbdelete_field_c - * - * Purpose: Call H5TBdelete_field - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 13, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbdelete_field_c +* +* Purpose: Call H5TBdelete_field +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 13, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, - int_f *namelen1, - _fcd field_name) + int_f *namelen1, + _fcd field_name) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - char *c_name1; - int c_namelen1; - hid_t c_loc_id = *loc_id; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); - if (c_name1 == NULL) return ret_value; - -/* - * Call H5TBinsert_field function. - */ - - ret = H5TBdelete_field(c_loc_id,c_name,c_name1); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + char *c_name1 = NULL; + int c_namelen1; + hid_t c_loc_id = *loc_id; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + c_namelen1 = *namelen1; + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + if (c_name1 == NULL) + goto done; + + /* + * call H5TBinsert_field function. + */ + + ret = H5TBdelete_field(c_loc_id, + c_name, + c_name1); + + if (ret < 0) + goto done; + + ret_value = 0; + +done: + if(c_name != NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5tbget_table_info_c - * - * Purpose: Call H5TBread_fields_index - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 12, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbget_table_info_c +* +* Purpose: Call H5TBread_fields_index +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 12, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbget_table_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords) + int_f *namelen, + _fcd name, + hsize_t_f *nfields, + hsize_t_f *nrecords) { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - hid_t c_loc_id = *loc_id; - hsize_t c_nfields; - hsize_t c_nrecords; - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - -/* - * Call H5TBread_fields_index function. - */ - - ret = H5TBget_table_info(c_loc_id,c_name,&c_nfields,&c_nrecords); - - *nfields = (hsize_t_f) c_nfields;; - *nrecords = (hsize_t_f) c_nrecords; - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + hid_t c_loc_id = *loc_id; + hsize_t c_nfields; + hsize_t c_nrecords; + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + /* + * call H5TBread_fields_index function. + */ + + ret = H5TBget_table_info(c_loc_id, + c_name, + &c_nfields, + &c_nrecords); + + if (ret < 0) + goto done; + + *nfields = (hsize_t_f) c_nfields;; + *nrecords = (hsize_t_f) c_nrecords; + + ret_value = 0; + +done: + if(c_name != NULL) + free(c_name); + + return ret_value; } /*------------------------------------------------------------------------- - * Function: h5tbget_field_info_c - * - * Purpose: Call H5TBget_field_info - * - * Return: Success: 0, Failure: -1 - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: October 13, 2004 - * - * Comments: - * - * Modifications: - * - * - *------------------------------------------------------------------------- - */ +* Function: h5tbget_field_info_c +* +* Purpose: Call H5TBget_field_info +* +* Return: Success: 0, Failure: -1 +* +* Programmer: pvn@ncsa.uiuc.edu +* +* Date: October 13, 2004 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ int_f nh5tbget_field_info_c(hid_t_f *loc_id, - int_f *namelen, - _fcd name, - hsize_t_f *nfields, - size_t_f *field_sizes, - size_t_f *field_offsets, - size_t_f *type_size, - int_f *namelen2, /* field_names lenghts */ - _fcd field_names) /* field_names */ + int_f *namelen, + _fcd name, + hsize_t_f *nfields, + size_t_f *field_sizes, + size_t_f *field_offsets, + size_t_f *type_size, + int_f *namelen2, /* field_names lenghts */ + _fcd field_names) /* field_names */ { - int ret_value = -1; - herr_t ret; - char *c_name; - int c_namelen; - hsize_t num_elem; - hsize_t i; - int max_len=1; - hid_t c_loc_id = *loc_id; - hsize_t c_nfields = *nfields; - size_t *c_field_sizes; - size_t *c_field_offsets; - size_t c_type_size; - char **c_field_names; - char *tmp, *tmp_p; - int c_lenmax=HLTB_MAX_FIELD_LEN; - size_t length = 0; - - num_elem = c_nfields; - - for (i=0; i < num_elem; i++) { - if (namelen2[i] > max_len) max_len = namelen2[i]; - } - -/* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; - - - c_field_offsets = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); - if (!c_field_offsets) return ret_value; - - c_field_sizes = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); - if (!c_field_sizes) return ret_value; - - c_field_names = malloc( sizeof(char*) * (size_t)c_nfields ); - if (!c_field_names) return ret_value; - for ( i = 0; i < c_nfields; i++) - { - c_field_names[i] = malloc( sizeof(char) * HLTB_MAX_FIELD_LEN ); - } - -/* - * Call H5TBget_field_info function. - */ - - ret = H5TBget_field_info(c_loc_id,c_name,c_field_names,c_field_sizes,c_field_offsets, - &c_type_size); - - /* return values*/ - - /* names array */ - tmp = (char *)malloc(c_lenmax* (size_t) c_nfields + 1); - tmp_p = tmp; - memset(tmp,' ', c_lenmax* (size_t) c_nfields); - tmp[c_lenmax*c_nfields] = '\0'; - for (i=0; i < c_nfields; i++) { - memcpy(tmp_p, c_field_names[i], strlen(c_field_names[i])); - namelen2[i] = (int_f)strlen(c_field_names[i]); - length = MAX(length, strlen(c_field_names[i])); - tmp_p = tmp_p + c_lenmax; - } - HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax*c_nfields)); - - - *type_size = (size_t_f)c_type_size; - 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]; - } - - - - /* free */ - - for (i=0; i < num_elem; i++) { - free (c_field_names[i]); - } - free(c_field_names); - free(tmp); - free(c_field_offsets); - free(c_field_sizes); - - if (ret < 0) return ret_value; - ret_value = 0; - return ret_value; + int ret_value = -1; + herr_t ret; + char *c_name = NULL; + int c_namelen; + hsize_t num_elem; + hsize_t i; + int max_len=1; + hid_t c_loc_id = *loc_id; + 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 = NULL; + int c_lenmax=HLTB_MAX_FIELD_LEN; + size_t length = 0; + + num_elem = c_nfields; + + for (i=0; i < num_elem; i++) + { + if (namelen2[i] > max_len) max_len = namelen2[i]; + } + + /* + * convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) + goto done; + + + c_field_offsets = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); + if (!c_field_offsets) + goto done; + + c_field_sizes = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); + if (!c_field_sizes) + goto done; + + c_field_names = malloc( sizeof(char*) * (size_t)c_nfields ); + if (!c_field_names) return ret_value; + for ( i = 0; i < c_nfields; i++) + { + c_field_names[i] = malloc( sizeof(char) * HLTB_MAX_FIELD_LEN ); + } + + /* + * call H5TBget_field_info function. + */ + + ret = H5TBget_field_info(c_loc_id, + c_name, + c_field_names, + c_field_sizes, + c_field_offsets, + &c_type_size); + + /* return values*/ + + /* names array */ + tmp = (char *)malloc(c_lenmax* (size_t) c_nfields + 1); + tmp_p = tmp; + memset(tmp,' ', c_lenmax* (size_t) c_nfields); + tmp[c_lenmax*c_nfields] = '\0'; + for (i=0; i < c_nfields; i++) + { + memcpy(tmp_p, c_field_names[i], strlen(c_field_names[i])); + namelen2[i] = (int_f)strlen(c_field_names[i]); + length = MAX(length, strlen(c_field_names[i])); + tmp_p = tmp_p + c_lenmax; + } + HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax*c_nfields)); + + + *type_size = (size_t_f)c_type_size; + 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]; + } + + + if (ret < 0) + goto done; + + ret_value = 0; + + +done: + if(c_name != NULL) + free(c_name); + + for ( i = 0; i < num_elem; i++) + { + if ( c_field_names[i] ) + free (c_field_names[i]); + } + if ( c_field_names ) + free(c_field_names); + if ( tmp ) + free(tmp); + if ( c_field_offsets ) + free(c_field_offsets); + if ( c_field_sizes ) + free(c_field_sizes); + + return ret_value; } diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index 9332c10..168bb99 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -717,6 +717,40 @@ end do call passed() + +!------------------------------------------------------------------------- +! string +!------------------------------------------------------------------------- + +call test_begin(' Make/Read datasets (string) ') + + +! +! write dataset. +! +call h5ltmake_dataset_string_f(file_id, dsetname5, buf1, errcode) + +! +! read dataset. +! +call h5ltread_dataset_string_f(file_id, dsetname5, buf1r, errcode) + +! +! compare read and write buffers. +! +if ( buf1 .ne. buf1r ) then + print *, 'read buffer differs from write buffer' + print *, buf1, ' and ', buf1r + stop +endif + +call passed() + + + + + + call test_begin(' Get dataset dimensions/info ') !------------------------------------------------------------------------- @@ -799,8 +833,8 @@ character(LEN=5), parameter :: attrname2 = "attr2" ! Attribute name character(LEN=5), parameter :: attrname3 = "attr3" ! Attribute name character(LEN=5), parameter :: attrname4 = "attr4" ! Attribute name character(LEN=5), parameter :: attrname5 = "attr5" ! Attribute name -character(LEN=9), parameter :: buf1 = "mystring" ! Data buffer -character(LEN=9) :: bufr1 ! Data buffer +character(LEN=8), parameter :: buf1 = "mystring" ! Data buffer +character(LEN=8) :: bufr1 ! Data buffer integer, dimension(DIM1) :: buf2 ! Data buffer integer, dimension(DIM1) :: bufr2 ! Data buffer real, dimension(DIM1) :: buf3 ! Data buffer @@ -936,6 +970,38 @@ end do call passed() + + +!------------------------------------------------------------------------- +! string +!------------------------------------------------------------------------- + +call test_begin(' Set/Get attributes string ') + + +! +! write attribute. +! +call h5ltset_attribute_string_f(file_id,dsetname1,attrname5,buf1,errcode) + +! +! read attribute. +! +call h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1,errcode) + +! +! compare read and write buffers. +! + +if ( buf1 .ne. bufr1 ) then + print *, 'read buffer differs from write buffer' + print *, buf1, ' and ', bufr1 + stop + endif + + +call passed() + !------------------------------------------------------------------------- ! get attribute rank !------------------------------------------------------------------------- diff --git a/release_docs/INSTALL_Windows.txt b/release_docs/INSTALL_Windows.txt index 61a81a9..d20c35f 100644 --- a/release_docs/INSTALL_Windows.txt +++ b/release_docs/INSTALL_Windows.txt @@ -940,7 +940,7 @@ project, you may choose one of the following two methods. 3. Choose the build configuration you would like to modify in the drop down menu labeled "Configuration:" - 4. Choose the "Linker" tab, anc select "General". + 4. Choose the "Linker" tab, and select "General". 5. In a text-area labeled with "Additional Library Directories:", add HDF5, Zlib, and Szip library files directories. For example: @@ -980,7 +980,7 @@ project, you may choose one of the following two methods. 1. In Visual Studio, go to the Project menu and choose "Properties". 2. Find the "Link" option and "Input" category. In the "Additional - Dependencies" field, insert "zdll.lib, szlibdll.lib, hdf5.lib". + Dependencies" field, insert "zlib1.lib, szlibdll.lib, hdf5.lib". 3. (Optional) Also insert "hdf5_cpp.lib" if you want to use HDF5 C++ static library. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cb6ab32..b7b2534 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -344,7 +344,9 @@ Bug Fixes since HDF5-1.8.0 release Fortran High-Level APIs: ------ - Lite: The h5ltget_dataset_info_f function (gets information about a dataset) - was not correctly returning the dimension array (PVN - 2009/3/23) + was not correctly returning the dimension array. (PVN - 2009/3/23) + - Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions + had memory problems with the g95 fortran compiler. (PVN – 5/13/2009) 1522 diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b5e0bda..6bf1afe 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -208,6 +208,7 @@ extern hid_t H5AC_ind_dxpl_id; /* Default cache configuration. */ +#ifdef H5_HAVE_PARALLEL #define H5AC__DEFAULT_CACHE_CONFIG \ { \ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, \ @@ -219,7 +220,7 @@ extern hid_t H5AC_ind_dxpl_id; /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 2 * 1024 * 1024), \ /* double min_clean_fraction = */ 0.3, \ - /* size_t max_size = */ (16 * 1024 * 1024), \ + /* size_t max_size = */ (32 * 1024 * 1024), \ /* size_t min_size = */ ( 1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ @@ -241,6 +242,41 @@ extern hid_t H5AC_ind_dxpl_id; /* double empty_reserve = */ 0.1, \ /* int dirty_bytes_threshold = */ (256 * 1024) \ } +#else /* H5_HAVE_PARALLEL */ +#define H5AC__DEFAULT_CACHE_CONFIG \ +{ \ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, \ + /* hbool_t rpt_fcn_enabled = */ FALSE, \ + /* hbool_t open_trace_file = */ FALSE, \ + /* hbool_t close_trace_file = */ FALSE, \ + /* char trace_file_name[] = */ "", \ + /* hbool_t evictions_enabled = */ TRUE, \ + /* hbool_t set_initial_size = */ TRUE, \ + /* size_t initial_size = */ ( 2 * 1024 * 1024), \ + /* double min_clean_fraction = */ 0.01, \ + /* size_t max_size = */ (32 * 1024 * 1024), \ + /* size_t min_size = */ ( 1 * 1024 * 1024), \ + /* long int epoch_length = */ 50000, \ + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ + /* double lower_hr_threshold = */ 0.9, \ + /* double increment = */ 2.0, \ + /* hbool_t apply_max_increment = */ TRUE, \ + /* size_t max_increment = */ (4 * 1024 * 1024), \ + /* enum H5C_cache_flash_incr_mode */ \ + /* flash_incr_mode = */ H5C_flash_incr__add_space, \ + /* double flash_multiple = */ 1.4, \ + /* double flash_threshold = */ 0.25, \ + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\ + /* double upper_hr_threshold = */ 0.999, \ + /* double decrement = */ 0.9, \ + /* hbool_t apply_max_decrement = */ TRUE, \ + /* size_t max_decrement = */ (1 * 1024 * 1024), \ + /* int epochs_before_eviction = */ 3, \ + /* hbool_t apply_empty_reserve = */ TRUE, \ + /* double empty_reserve = */ 0.1, \ + /* int dirty_bytes_threshold = */ (256 * 1024) \ +} +#endif /* H5_HAVE_PARALLEL */ /* diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index e252134..e5a2dba 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -46,7 +46,7 @@ * * JRM - 5/17/04 */ -#define H5C_MAX_ENTRY_SIZE ((size_t)(10 * 1024 * 1024)) +#define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024)) /* H5C_COLLECT_CACHE_STATS controls overall collection of statistics * on cache activity. In general, this #define should be set to 0. @@ -1296,14 +1296,6 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") } /* end else */ - /* Check for mis-matches in major & minor error classes */ - if(NULL == (maj_ptr = (H5E_msg_t *)H5I_object_verify(maj_id, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") - if(NULL == (min_ptr = (H5E_msg_t *)H5I_object_verify(min_id, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") - if(maj_ptr->cls != min_ptr->cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "major and minor errors not from same error class") - /* Note that the variable-argument parsing for the format is identical in * the H5E_printf_stack() routine - correct errors and make changes in both * places. -QAK |