diff options
author | Elena Pourmal <epourmal@hdfgroup.org> | 2005-06-22 18:23:21 (GMT) |
---|---|---|
committer | Elena Pourmal <epourmal@hdfgroup.org> | 2005-06-22 18:23:21 (GMT) |
commit | ea66068977639b7b2737bb9db1e59b26db914d1e (patch) | |
tree | bc1ce12c71d0f91dba3c2d0ddccd81862a588c89 /hl | |
parent | ec071c6c149c44d9b3a056948502ca2af3b875b9 (diff) | |
download | hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.zip hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.tar.gz hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.tar.bz2 |
[svn-r10970] Purpose: New feature/bug #350 fix
Description:
When compiler flag was used to set the size of Fortran integer
to 8 bytes, library would fail.
Solution:
Cleaned up the code; added detection of Fortran INTEGER type size
and appropriately defined int_f type for C-stubs routines.
Platforms tested:
Solaris 2.8 32 and 64-bit, AIX 5.1 64-bit parallel
PGI Fortran with -i8 flag on heping
Absoft Fortran with -i8 flag on heping
g95 on mir (Fortran integer is 8 bytes by default that cannot be
changed - compiler bug ;-)
AIX Fortran with -qintsize=8 32 and 64-bit modes on copper
Misc. update:
Diffstat (limited to 'hl')
-rwxr-xr-x | hl/fortran/src/H5IMfc.c | 10 | ||||
-rwxr-xr-x | hl/fortran/src/H5LTf90proto.h | 4 | ||||
-rwxr-xr-x | hl/fortran/src/H5LTfc.c | 76 | ||||
-rwxr-xr-x | hl/fortran/test/tstimage.f90 | 2 | ||||
-rw-r--r-- | hl/fortran/test/tstlite.f90 | 3 | ||||
-rw-r--r-- | hl/src/H5IM.c | 67 | ||||
-rw-r--r-- | hl/src/H5IM.h | 11 | ||||
-rw-r--r-- | hl/src/H5LT.c | 80 | ||||
-rw-r--r-- | hl/src/H5LT.h | 11 |
9 files changed, 209 insertions, 55 deletions
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index f4c71cb..7d09f10 100755 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -16,6 +16,7 @@ #include "H5IM.h" #include "H5LTf90proto.h" +#include "../../../fortran/src/H5f90i_gen.h" /*------------------------------------------------------------------------- @@ -43,7 +44,7 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, _fcd name, hsize_t_f *width, hsize_t_f *height, - void *buf) + int_f *buf) { int ret_value = -1; herr_t ret; @@ -54,7 +55,7 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; @@ -62,7 +63,6 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, * Call H5IMmake_image_8bitf function. */ c_loc_id = (hid_t)*loc_id; - ret = H5IMmake_image_8bitf(c_loc_id,c_name,*width,*height,buf); if (ret < 0) return ret_value; @@ -93,7 +93,7 @@ int_f nh5imread_image_c (hid_t_f *loc_id, int_f *namelen, _fcd name, - void *buf) + int_f *buf) { int ret_value = -1; herr_t ret; @@ -105,7 +105,7 @@ nh5imread_image_c (hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 2b8e932..e3c36fd 100755 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -245,13 +245,13 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, _fcd name, hsize_t_f *width, hsize_t_f *height, - void *buf); + int_f *buf); H5_DLL int_f nh5imread_image_c (hid_t_f *loc_id, int_f *namelen, _fcd name, - void *buf); + int_f *buf); H5_DLL int_f diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index d36128f..15733ab 100755 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -291,7 +291,7 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; @@ -301,8 +301,15 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; c_size = (size_t)*size; - ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,buf,c_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; + if (ret < 0) return ret_value; ret_value = 0; return ret_value; @@ -311,7 +318,7 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, /*------------------------------------------------------------------------- * Function: H5LTset_attribute_float_c * - * Purpose: Call H5LTset_attribute_int + * Purpose: Call H5LTset_attribute_float * * Return: Success: 0, Failure: -1 * @@ -357,7 +364,7 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, if (c_attrname == NULL) return ret_value; /* - * Call H5LTset_attribute_int function. + * Call H5LTset_attribute_float function. */ c_loc_id = (hid_t)*loc_id; c_size = (size_t)*size; @@ -373,7 +380,7 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, /*------------------------------------------------------------------------- * Function: H5LTset_attribute_double_c * - * Purpose: Call H5LTset_attribute_int + * Purpose: Call H5LTset_attribute_double * * Return: Success: 0, Failure: -1 * @@ -419,7 +426,7 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, if (c_attrname == NULL) return ret_value; /* - * Call H5LTset_attribute_int function. + * Call H5LTset_attribute_double function. */ c_loc_id = (hid_t)*loc_id; c_size = (size_t)*size; @@ -434,7 +441,7 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, /*------------------------------------------------------------------------- * Function: H5LTset_attribute_string_c * - * Purpose: Call H5LTset_attribute_int + * Purpose: Call H5LTset_attribute_string * * Return: Success: 0, Failure: -1 * @@ -478,7 +485,7 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id, if (c_attrname == NULL) return ret_value; /* - * Call H5LTset_attribute_int function. + * Call H5LTset_attribute_string function. */ c_loc_id = (hid_t)*loc_id; @@ -527,11 +534,11 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; @@ -539,8 +546,15 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, * Call H5LTget_attribute_int function. */ c_loc_id = (hid_t)*loc_id; - - ret = H5LTget_attribute_int(c_loc_id,c_name,c_attrname,buf); + + 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; if (ret < 0) return ret_value; ret_value = 0; @@ -586,11 +600,11 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; @@ -644,11 +658,11 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; @@ -702,11 +716,11 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; @@ -753,11 +767,12 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, hid_t c_loc_id; char *c_name; int c_namelen; + int c_rank; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; @@ -766,9 +781,10 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, */ c_loc_id = (hid_t)*loc_id; - ret = H5LTget_dataset_ndims(c_loc_id, c_name, rank); + 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; } @@ -805,7 +821,7 @@ nh5ltfind_dataset_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return -1; @@ -858,7 +874,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; @@ -915,26 +931,28 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id, char *c_attrname; int c_namelen; int c_attrnamelen; + int c_rank; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen =(int) *namelen; c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* - * Call H5LTset_attribute_int function. + * Call H5LTset_attribute_ndims function. */ c_loc_id = (hid_t)*loc_id; - ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,rank); + 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; } @@ -984,11 +1002,11 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; + c_namelen = (int)*namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; - c_attrnamelen = *attrnamelen; + c_attrnamelen = (int)*attrnamelen; c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; diff --git a/hl/fortran/test/tstimage.f90 b/hl/fortran/test/tstimage.f90 index 42fe52a..d820caf 100755 --- a/hl/fortran/test/tstimage.f90 +++ b/hl/fortran/test/tstimage.f90 @@ -127,12 +127,10 @@ call test_begin(' Make/Read image 8bit ') ! write image. ! call h5immake_image_8bit_f(file_id,dsetname1,width,height,buf1,errcode) - ! ! read image. ! call h5imread_image_f(file_id,dsetname1,bufr1,errcode) - ! ! compare read and write buffers. ! diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index f34053a..f043c8f 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -707,7 +707,6 @@ call test_begin(' Get dataset dimensions ') !------------------------------------------------------------------------- call h5ltget_dataset_ndims_f(file_id, dsetname4, rankr, errcode) - if ( rankr .ne. rank ) then print *, 'h5ltget_dataset_ndims_f return error' stop @@ -952,4 +951,4 @@ end subroutine test_begin subroutine passed() write(*, fmt = '(6a)') 'PASSED' -end subroutine passed
\ No newline at end of file +end subroutine passed diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index b7e8060..a6709c0 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -11,6 +11,8 @@ ****************************************************************************/ #include "H5IM.h" +#include "../../fortran/src/H5f90i_gen.h" + #include <string.h> #include <stdlib.h> @@ -24,7 +26,7 @@ herr_t H5IM_get_palette( hid_t loc_id, const char *image_name, int pal_number, hid_t tid, - void *pal_data); + int_f *pal_data); /*------------------------------------------------------------------------- @@ -1292,7 +1294,7 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, - void *buf ) + int_f *buf ) { hid_t did; /* dataset ID */ hid_t sid; /* space ID */ @@ -1313,13 +1315,24 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, return -1; /* create the dataset as H5T_NATIVE_UCHAR */ - if ((did=H5Dcreate(loc_id,dset_name,H5T_NATIVE_UCHAR,sid,H5P_DEFAULT))<0) + if ((did=H5Dcreate(loc_id,dset_name,H5T_NATIVE_UINT8,sid,H5P_DEFAULT))<0) return -1; /* write with memory type H5T_NATIVE_INT */ + /* Use long type if Fortran integer is 8 bytes and C long long is also 8 bytes*/ + /* Fail if otherwise */ if (buf) { + if (sizeof(int_f) == sizeof(int)) { if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + return -1;} + else if (sizeof(int_f) == sizeof(long)) { + if (H5Dwrite(did,H5T_NATIVE_LONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + return -1;} + else if (sizeof(int_f) == sizeof(long long)) { + if (H5Dwrite(did,H5T_NATIVE_LLONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + return -1;} + else return -1; } @@ -1382,7 +1395,7 @@ herr_t H5IMmake_image_24bitf( hid_t loc_id, hsize_t width, hsize_t height, const char *interlace, - void *buf) + int_f *buf) { hid_t did; /* dataset ID */ hid_t sid; /* space ID */ @@ -1425,7 +1438,16 @@ herr_t H5IMmake_image_24bitf( hid_t loc_id, /* write with memory type H5T_NATIVE_INT */ if (buf) { + if (sizeof(int_f) == sizeof(int)) { if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + return -1;} + else if (sizeof(int_f) == sizeof(long)) { + if (H5Dwrite(did,H5T_NATIVE_LONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + return -1;} + else if (sizeof(int_f) == sizeof(long long)) { + if (H5Dwrite(did,H5T_NATIVE_LLONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + return -1;} + else return -1; } @@ -1484,7 +1506,7 @@ herr_t H5IMmake_image_24bitf( hid_t loc_id, herr_t H5IMread_imagef( hid_t loc_id, const char *dset_name, - void *buf ) + int_f *buf ) { hid_t did; @@ -1493,13 +1515,21 @@ herr_t H5IMread_imagef( hid_t loc_id, return -1; /* read to memory type H5T_NATIVE_INT */ + if (sizeof(int_f) == sizeof(int)){ if ( H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0 ) + goto out;} + else if (sizeof(int_f) == sizeof(long)) { + if ( H5Dread( did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0 ) + goto out;} + else if (sizeof(int_f) == sizeof(long long)) { + if ( H5Dread( did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0 ) + goto out;} + else goto out; /* close */ if ( H5Dclose( did ) ) return -1; - return 0; out: @@ -1536,7 +1566,7 @@ out: herr_t H5IMmake_palettef( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, - void *pal_data ) + int_f *pal_data ) { @@ -1567,7 +1597,16 @@ herr_t H5IMmake_palettef( hid_t loc_id, /* write with memory type H5T_NATIVE_INT */ if (pal_data) { + if (sizeof(int_f) == sizeof(int)) { if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,pal_data)<0) + return -1;} + else if (sizeof(int_f) == sizeof(long)) { + if (H5Dwrite(did,H5T_NATIVE_LONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,pal_data)<0) + return -1;} + else if (sizeof(int_f) == sizeof(long long)) { + if (H5Dwrite(did,H5T_NATIVE_LLONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,pal_data)<0) + return -1;} + else return -1; } @@ -1622,9 +1661,17 @@ herr_t H5IMmake_palettef( hid_t loc_id, herr_t H5IMget_palettef( hid_t loc_id, const char *image_name, int pal_number, - void *pal_data ) + int_f *pal_data ) { - return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_INT,pal_data); + if(sizeof(int_f) == sizeof(int)) + return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_INT,pal_data); + else if (sizeof(int_f) == sizeof(long)) + return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_LONG,pal_data); + else if (sizeof(int_f) == sizeof(long long)) + return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_LLONG,pal_data); + else + return -1; + } /*------------------------------------------------------------------------- @@ -1659,7 +1706,7 @@ herr_t H5IM_get_palette( hid_t loc_id, const char *image_name, int pal_number, hid_t tid, - void *pal_data) + int_f *pal_data) { hid_t image_id; int has_pal; diff --git a/hl/src/H5IM.h b/hl/src/H5IM.h index 6b7b6d8..27359dd 100644 --- a/hl/src/H5IM.h +++ b/hl/src/H5IM.h @@ -16,6 +16,7 @@ #define _H5IM_H #include "H5LT.h" +#include "../../fortran/src/H5f90i_gen.h" #ifdef __cplusplus extern "C" { @@ -93,28 +94,28 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, - void *buf ); + int_f *buf ); herr_t H5IMmake_image_24bitf( hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, const char *interlace, - void *buf); + int_f *buf); herr_t H5IMread_imagef( hid_t loc_id, const char *dset_name, - void *buf ); + int_f *buf ); herr_t H5IMmake_palettef( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, - void *pal_data ); + int_f *pal_data ); herr_t H5IMget_palettef( hid_t loc_id, const char *image_name, int pal_number, - void *pal_data ); + int_f *pal_data ); #ifdef __cplusplus diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index daa420c..acee4a7 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1560,6 +1560,38 @@ herr_t H5LTset_attribute_long( hid_t loc_id, return 0; } +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_long_long + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Elena Pourmal, epourmal@ncsa.uiuc.edu + * + * Date: June 17, 2005 + * + * Comments: This function was added to support 8-bytes int_f type that + * may correspond to INTEGER*8 in Fortran + * + *------------------------------------------------------------------------- + */ + +herr_t H5LTset_attribute_long_long( hid_t loc_id, + const char *obj_name, + const char *attr_name, + const long long *data, + size_t size ) +{ + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + H5T_NATIVE_LLONG, data ) < 0 ) + return -1; + + return 0; + +} + /*------------------------------------------------------------------------- * Function: H5LTset_attribute_ulong @@ -2416,6 +2448,54 @@ herr_t H5LTget_attribute_long( hid_t loc_id, return 0; } +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_long_long + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Elena Pourmal, epourmal@ncsa.uiuc.edu + * + * Date: June 17, 2005 + * + * Comments: This funstion was added to suuport INTEGER*8 Fortran types + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5LTget_attribute_long_long( hid_t loc_id, + const char *obj_name, + const char *attr_name, + long long *data ) +{ + + /* identifiers */ + hid_t obj_id; + H5G_stat_t statbuf; + + /* Get the type of object */ + if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) + return -1; + + /* Open the object */ + if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) + return -1; + + /* Get the attribute */ + if ( H5LT_get_attribute_mem( obj_id, attr_name, H5T_NATIVE_LLONG, data ) < 0 ) + return -1; + + /* Close the object */ + if ( H5LT_close_id( obj_id, statbuf.type ) < 0 ) + return -1; + + return 0; + +} + +/*------------------------------------------------------------------------- /*------------------------------------------------------------------------- * Function: H5LTget_attribute_ulong diff --git a/hl/src/H5LT.h b/hl/src/H5LT.h index 3380888..63f9c8e 100644 --- a/hl/src/H5LT.h +++ b/hl/src/H5LT.h @@ -211,6 +211,12 @@ herr_t H5LTset_attribute_long( hid_t loc_id, const long *buffer, size_t size ); +herr_t H5LTset_attribute_long_long( hid_t loc_id, + const char *obj_name, + const char *attr_name, + const long long *buffer, + size_t size ); + herr_t H5LTset_attribute_ulong( hid_t loc_id, const char *obj_name, const char *attr_name, @@ -282,6 +288,11 @@ herr_t H5LTget_attribute_long( hid_t loc_id, const char *attr_name, long *data ); +herr_t H5LTget_attribute_long_long( hid_t loc_id, + const char *obj_name, + const char *attr_name, + long long *data ); + herr_t H5LTget_attribute_ulong( hid_t loc_id, const char *obj_name, const char *attr_name, |