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/src/H5LT.c | |
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/src/H5LT.c')
-rw-r--r-- | hl/src/H5LT.c | 80 |
1 files changed, 80 insertions, 0 deletions
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 |