[svn-r2975]

Purpose:
    Code maintenance and development
Description:
    I added two functions h5open_f and h5close_f to initialize
    C library and Fortran interface (flags, predefined datatypes, etc).
    Those calls are required for any F90 program that uses HDF5.
    I renamed H5f90misc.c and H5f90miscf.f90 files to H5f.c and H5ff.f90.
    New functions are added to those new files.
Platforms tested:
    Solaris 2.6
This commit is contained in:
Elena Pourmal 2000-11-17 17:43:27 -05:00
parent cfac5f773e
commit 5dad153995
7 changed files with 69 additions and 22 deletions

View File

@ -18,6 +18,7 @@ H5Df.lo: \
H5Dff.lo: \
$(srcdir)/H5Dff.f90 \
H5fortran_types.f90 \
$(srcdir)/H5Rff.f90 \
$(srcdir)/H5f90global.f90
H5Ef.lo: \
$(srcdir)/H5Ef.c \
@ -111,13 +112,13 @@ H5f90kit.lo: \
$(srcdir)/H5f90.h \
$(srcdir)/H5f90i.h \
$(srcdir)/H5f90proto.h
H5f90misc.lo: \
$(srcdir)/H5f90misc.c \
H5f.lo: \
$(srcdir)/H5f.c \
$(srcdir)/H5f90.h \
$(srcdir)/H5f90i.h \
$(srcdir)/H5f90proto.h
H5f90miscf.lo: \
$(srcdir)/H5f90miscf.f90 \
H5ff.lo: \
$(srcdir)/H5ff.f90 \
$(srcdir)/H5f90global.f90
HDF5.lo: \
$(srcdir)/HDF5.f90 \

View File

@ -106,7 +106,7 @@
INTEGER, EXTERNAL :: h5dcreate_c
creation_prp_default = H5P_DEFAULT_F
if (present(creation_prp)) creation_prp_default = creation_prp
if (present(creation_prp)) creation_prp_default = creation_prp
namelen = LEN(name)
hdferr = h5dcreate_c(loc_id, name, namelen, type_id, space_id, &
creation_prp_default, dset_id)

View File

@ -152,9 +152,9 @@ nh5eget_minor_c(int_f* error_no, _fcd name)
* Inputs: printflag - flag to turn automatic error printing on or off.
* Outputs:
* Returns: 0 on success, -1 on failure
* Programmer: Xiangyang Su
* Wednesday, March 29, 2000
* Modifications:
* Programmer: Elena Pourmal
* Friday, November 17, 2000
* Modifications: major bug fix. Function never disabled printing.
*---------------------------------------------------------------------------*/
int_f
nh5eset_auto_c(int_f* printflag)
@ -164,6 +164,8 @@ nh5eset_auto_c(int_f* printflag)
if (*printflag == 1)
status = H5Eset_auto((H5E_auto_t)H5Eprint, stderr);
if (*printflag == 0)
status = H5Eset_auto(NULL,NULL);
if (status >= 0) ret_val = 0;
return ret_val;
}

View File

@ -307,3 +307,37 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5e_flags, int_f *h5f_flags,
ret_value = 0;
return ret_value;
}
/*---------------------------------------------------------------------------
* Name: h5open_c
* Purpose: Calls H5open call to initialize C HDF5 library
* Returns: 0 on success, -1 on failure
* Programmer: Elena Pourmal
* Friday, November 17, 2000
* Modifications:
*---------------------------------------------------------------------------*/
int_f
nh5open_c()
{
int ret_value = -1;
if (H5open() < 0) return ret_value;
ret_value = 0;
return ret_value;
}
/*---------------------------------------------------------------------------
* Name: h5close_c
* Purpose: Calls H5close call to close C HDF5 library
* Returns: 0 on success, -1 on failure
* Programmer: Elena Pourmal
* Friday, November 17, 2000
* Modifications:
*---------------------------------------------------------------------------*/
int_f
nh5close_c()
{
int ret_value = -1;
if (H5close() < 0) return ret_value;
ret_value = 0;
return ret_value;
}

View File

@ -889,21 +889,26 @@ extern int_f nh5eget_minor_c(int_f* error_no, _fcd name);
extern int_f nh5eset_auto_c(int_f* printflag);
/*
* Functions from H5f90misc.c
* Functions from H5f.c
*/
#ifndef H5MISCf90_FNAMES
# define H5MISCf90_FNAMES
#ifndef H5_FNAMES
# define H5_FNAMES
#ifdef DF_CAPFNAMES
# define nh5open_c FNAME(H5OPEN_C)
# define nh5close_c FNAME(H5CLOSE_C)
# define nh5init_type_c FNAME(H5INIT_TYPES_C)
# define nh5close_types_c FNAME(H5CLOSE_TYPES_C)
# define nh5init_flags_c FNAME(H5INIT_FLAGS_C)
#else
# define nh5open_c FNAME(h5open_c)
# define nh5close_c FNAME(h5close_c)
# define nh5init_types_c FNAME(h5init_types_c)
# define nh5close_types_c FNAME(h5close_types_c)
# define nh5init_flags_c FNAME(h5init_flags_c)
#endif
#endif
extern int_f nh5open_c(void);
extern int_f nh5close_c(void);
extern int_f nh5init_types_c(hid_t_f *types, hid_t_f * floatingtypes, hid_t_f * integertypes);
extern int_f nh5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f * floatingtypes, int_f * floatinglen, hid_t_f * integertypes, int_f * integerlen);

View File

@ -1,11 +1,13 @@
SUBROUTINE h5init_fortran_f(error)
SUBROUTINE h5open_f(error)
USE H5GLOBAL
IMPLICIT NONE
INTEGER, INTENT(OUT) :: error
INTEGER :: error_1, error_2
INTEGER :: error_0, error_1, error_2
INTEGER, EXTERNAL :: h5init_types_c
INTEGER, EXTERNAL :: h5init_flags_c
INTEGER, EXTERNAL :: h5open_c
error_0 = h5open_c()
error_1 = h5init_types_c(predef_types, floating_types, integer_types)
error_1 = h5init_flags_c(H5D_flags, &
H5E_flags, &
@ -17,19 +19,22 @@
H5R_flags, &
H5S_flags, &
H5T_flags )
error = error_1 + error_2
error = error_0 + error_1 + error_2
END SUBROUTINE h5init_fortran_f
END SUBROUTINE h5open_f
SUBROUTINE h5close_fortran_f(error)
SUBROUTINE h5close_f(error)
USE H5GLOBAL
IMPLICIT NONE
INTEGER :: error_1, error_2
INTEGER, INTENT(OUT) :: error
INTEGER, EXTERNAL :: h5close_types_c
error = h5close_types_c(predef_types, PREDEF_TYPES_LEN, &
INTEGER, EXTERNAL :: h5close_types_c, h5close_c
error_1 = h5close_types_c(predef_types, PREDEF_TYPES_LEN, &
floating_types, FLOATING_TYPES_LEN, &
integer_types, INTEGER_TYPES_LEN )
error_2 = h5close_c()
error = error_1 + error_2
END SUBROUTINE h5close_fortran_f
END SUBROUTINE h5close_f

View File

@ -27,11 +27,11 @@ FPAR_SRC=H5FDmpioff.f90 HDF5mpio.f90
ADD_PARALLEL_FILES=@ADD_PARALLEL_FILES@
CPARALLEL=${ADD_PARALLEL_FILES:yes=$(CPAR_SRC)}
CLIB_SRC=H5f90kit.c H5f90misc.c H5Git.c H5Rf.c H5Ff.c H5Sf.c H5Df.c H5Gf.c \
CLIB_SRC=H5f90kit.c H5f.c H5Git.c H5Rf.c H5Ff.c H5Sf.c H5Df.c H5Gf.c \
H5Af.c H5Tf.c H5Pf.c H5If.c H5Ef.c ${CPARALLEL:no=}
FPARALLEL=${ADD_PARALLEL_FILES:yes=$(FPAR_SRC)}
FLIB_SRC=H5fortran_types.f90 H5fortran_flags.f90 H5f90global.f90 H5f90miscf.f90 \
FLIB_SRC=H5fortran_types.f90 H5fortran_flags.f90 H5f90global.f90 H5ff.f90 \
H5Rff.f90 H5Fff.f90 H5Sff.f90 H5Dff.f90 H5Gff.f90 H5Aff.f90 H5Tff.f90 \
H5Pff.f90 H5Iff.f90 H5Eff.f90 HDF5.f90 ${FPARALLEL:no=}