subroutine ESMF_InfoSetArrayCH(info, key, values, keywordEnforcer, force, pkey, rc)
type(ESMF_Info), intent(inout) :: info
character(len=*), intent(in) :: key
character(len=*), dimension(:), intent(in) :: values
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
logical, intent(in), optional :: force
character(len=*), intent(in), optional :: pkey
integer, intent(out), optional :: rc
integer :: localrc
logical(C_BOOL) :: local_force
integer :: ii
integer(C_INT) :: idx
character(:), allocatable :: local_pkey
localrc = ESMF_FAILURE
if (present(rc)) rc = ESMF_FAILURE
if (present(force)) then
local_force = force
else
local_force = .true.
end if
if (present(pkey)) then
local_pkey = TRIM(pkey)//C_NULL_CHAR
else
local_pkey = ""//C_NULL_CHAR
end if
! Allocate storage in C
call c_info_set_array_CH(info%ptr, trim(key)//C_NULL_CHAR, &
SIZE(values), local_force, localrc, local_pkey)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
! Set each character element in the underlying store
do ii=1,SIZE(values)
call ESMF_InfoSetCH(info, key, values(ii), idx=ii, pkey=local_pkey, rc=localrc)
enddo
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_InfoSetArrayCH