diff options
Diffstat (limited to 'hl/fortran')
-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 |
5 files changed, 55 insertions, 40 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 |