From cc56600acb39d22db97225ca2ab52cb25ef4465c Mon Sep 17 00:00:00 2001 From: Roland Wirth Date: Fri, 8 Dec 2023 18:37:21 +0100 Subject: [PATCH 1/3] fix intents and variable types in interfaces --- fortran/module_netcdf4_nf_interfaces.F90 | 14 +++++++------- fortran/netcdf4_func.F90 | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fortran/module_netcdf4_nf_interfaces.F90 b/fortran/module_netcdf4_nf_interfaces.F90 index 158e4f97..7f2fe9d2 100755 --- a/fortran/module_netcdf4_nf_interfaces.F90 +++ b/fortran/module_netcdf4_nf_interfaces.F90 @@ -217,10 +217,10 @@ End Function nf_insert_compound Function nf_insert_array_compound( ncid, xtype, name, offset, field_typeid, & ndims, dim_sizes) RESULT (status) - Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims - Integer, Intent(INOUT) :: dim_sizes(*) - Character(LEN=*), Intent(IN) :: name - Integer :: status + Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims + Integer, Intent(IN) :: dim_sizes(*) + Character(LEN=*), Intent(IN) :: name + Integer :: status End Function nf_insert_array_compound End Interface @@ -483,9 +483,9 @@ End Function nf_inq_opaque Function nf_def_var_chunking( ncid, varid, contiguous, chunksizes) & RESULT(status) - Integer, Intent(IN) :: ncid, varid, contiguous - Integer, Intent(INOUT) :: chunksizes(*) - Integer :: status + Integer, Intent(IN) :: ncid, varid, contiguous + Integer, Intent(IN) :: chunksizes(*) + Integer :: status End Function nf_def_var_chunking End Interface diff --git a/fortran/netcdf4_func.F90 b/fortran/netcdf4_func.F90 index 0b92d656..bf1b99f8 100644 --- a/fortran/netcdf4_func.F90 +++ b/fortran/netcdf4_func.F90 @@ -183,7 +183,7 @@ function nf90_inq_dimids(ncid, ndims, dimids, include_parents) integer, intent(in) :: ncid integer, intent(out) :: ndims integer, dimension(:), intent(out) :: dimids - integer, intent(out) :: include_parents + integer, intent(in) :: include_parents integer :: nf90_inq_dimids nf90_inq_dimids = nf_inq_dimids(ncid, ndims, dimids, include_parents) @@ -255,7 +255,7 @@ function nf90_insert_array_compound(ncid, xtype, name, offset, field_typeid, & integer, intent(in) :: offset integer, intent(in) :: field_typeid integer, intent(in) :: ndims - integer, intent(in) :: dim_sizes + integer, dimension(:), intent(in) :: dim_sizes integer :: nf90_insert_array_compound nf90_insert_array_compound = nf_insert_array_compound(ncid, xtype, name, & @@ -319,7 +319,7 @@ function nf90_inq_compound_field(ncid, xtype, fieldid, name, offset, & integer, intent(out) :: offset integer, intent(out) :: field_typeid integer, intent(out) :: ndims - integer, intent(out) :: dim_sizes + integer, dimension(:), intent(out) :: dim_sizes integer :: nf90_inq_compound_field nf90_inq_compound_field = nf_inq_compound_field(ncid, xtype, fieldid, name, offset, & @@ -380,7 +380,7 @@ function nf90_inq_cmp_fielddim_sizes(ncid, xtype, fieldid, dim_sizes) integer, intent(in) :: ncid integer, intent(in) :: xtype integer, intent(in) :: fieldid - integer, intent(out) :: dim_sizes + integer, dimension(:), intent(out) :: dim_sizes integer :: nf90_inq_cmp_fielddim_sizes nf90_inq_cmp_fielddim_sizes = nf_inq_compound_fielddim_sizes(ncid, xtype, fieldid, dim_sizes) @@ -464,20 +464,20 @@ function nf90_inq_enum_member(ncid, xtype, idx, name, value) integer, intent(in) :: xtype integer, intent(in) :: idx character (len = *), intent(out) :: name - integer, intent(in) :: value + integer, intent(out) :: value integer :: nf90_inq_enum_member nf90_inq_enum_member = nf_inq_enum_member(ncid, xtype, idx, name, value) end function nf90_inq_enum_member ! ----------- - function nf90_inq_enum_ident(ncid, xtype, value, idx) + function nf90_inq_enum_ident(ncid, xtype, value, identifier) integer, intent(in) :: ncid integer, intent(in) :: xtype integer, intent(in) :: value - integer, intent(out) :: idx + character (len = *), intent(out) :: identifier integer :: nf90_inq_enum_ident - nf90_inq_enum_ident = nf_inq_enum_ident(ncid, xtype, value, idx) + nf90_inq_enum_ident = nf_inq_enum_ident(ncid, xtype, value, identifier) end function nf90_inq_enum_ident ! ----------- function nf90_def_opaque(ncid, size, name, xtype) From ef33cb7229bfec14e5c0075f5353e478b9cfb345 Mon Sep 17 00:00:00 2001 From: Roland Wirth Date: Wed, 24 Jan 2024 09:36:59 +0000 Subject: [PATCH 2/3] fix some intents in nf_nc4.F90 --- fortran/nf_nc4.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fortran/nf_nc4.F90 b/fortran/nf_nc4.F90 index 30ea9ee9..a1b58f2a 100755 --- a/fortran/nf_nc4.F90 +++ b/fortran/nf_nc4.F90 @@ -566,11 +566,11 @@ Function nf_insert_array_compound( ncid, xtype, name, offset, field_typeid, & Implicit NONE - Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims - Character(LEN=*), Intent(IN) :: name - Integer, Intent(INOUT) :: dim_sizes(*) + Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims + Character(LEN=*), Intent(IN) :: name + Integer, Intent(IN) :: dim_sizes(*) - Integer :: status + Integer :: status Integer(C_INT) :: cncid, cxtype, ctypeid, cndims, cstatus Integer(C_SIZE_T) :: coffset @@ -1370,10 +1370,10 @@ Function nf_def_var_chunking( ncid, varid, contiguous, chunksizes) & Implicit NONE - Integer, Intent(IN) :: ncid, varid, contiguous - Integer, Intent(INOUT) :: chunksizes(*) + Integer, Intent(IN) :: ncid, varid, contiguous + Integer, Intent(IN) :: chunksizes(*) - Integer :: status + Integer :: status Integer(C_INT) :: cncid, cvarid, ccontiguous, cstat1, cstatus, & cndims From 2d8ba90008f70a3d06671a08c187045a6f4a6310 Mon Sep 17 00:00:00 2001 From: Roland Wirth Date: Wed, 24 Jan 2024 10:18:50 +0000 Subject: [PATCH 3/3] fit intent for nc_insert_array_compound_f in nc interfaces --- fortran/module_netcdf4_nc_interfaces.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fortran/module_netcdf4_nc_interfaces.F90 b/fortran/module_netcdf4_nc_interfaces.F90 index 7be413e2..62b2ff34 100755 --- a/fortran/module_netcdf4_nc_interfaces.F90 +++ b/fortran/module_netcdf4_nc_interfaces.F90 @@ -310,13 +310,13 @@ Function nc_insert_array_compound_f(ncid, xtype, name, offset, field_typeid, & USE ISO_C_BINDING, ONLY: C_INT, C_SIZE_T, C_CHAR - Integer(C_INT), VALUE :: ncid, ndims - Integer(C_INT), VALUE :: xtype, field_typeid ! nc_type in C - Integer(C_SIZE_T), VALUE :: offset - Character(KIND=C_CHAR), Intent(IN) :: name(*) - Integer(C_INT), Intent(INOUT) :: dim_sizes(*) + Integer(C_INT), VALUE :: ncid, ndims + Integer(C_INT), VALUE :: xtype, field_typeid ! nc_type in C + Integer(C_SIZE_T), VALUE :: offset + Character(KIND=C_CHAR), Intent(IN) :: name(*) + Integer(C_INT), Intent(IN) :: dim_sizes(*) - Integer(C_INT) :: nc_insert_array_compound_f + Integer(C_INT) :: nc_insert_array_compound_f End Function nc_insert_array_compound_f End Interface