subroutine ESMF_FeatureAllocArgStr (n, str_dllen, str_pilen, str_dllensize, str_pilensize, rc)
integer, intent(in) :: n
! F2003 and F95+TR15581 allocatable string dummy arguments
character(:), allocatable, intent(out), optional :: str_dllen ! Scalar w/deferred-length
character(*), allocatable, intent(out), optional :: str_pilen ! Scalar w/passed-in length
character(:), allocatable, intent(out), optional :: str_dllensize(:) ! Array w/deferred-length
character(*), allocatable, intent(out), optional :: str_pilensize(:) ! Array w/passed-in length
integer, intent(out) :: rc
integer :: i, j
integer :: memstat
if (present (str_dllen)) then
allocate (character(n)::str_dllen, stat=memstat)
if (ESMF_LogFoundAllocError (memstat, &
ESMF_CONTEXT, &
rcToReturn=rc)) return
do, i=1, n
str_dllen(i:i) = achar (mod (i, 127))
end do
end if
if (present (str_pilen)) then
allocate (str_pilen, stat=memstat)
if (ESMF_LogFoundAllocError (memstat, &
ESMF_CONTEXT, &
rcToReturn=rc)) return
do, i=1, len (str_pilen)
str_pilen(i:i) = achar (mod (i, 127))
end do
end if
if (present (str_pilensize)) then
allocate (str_pilensize(n), stat=memstat)
if (ESMF_LogFoundAllocError (memstat, &
ESMF_CONTEXT, &
rcToReturn=rc)) return
do, i=1, n
str_pilensize(i) = achar (mod (i, 127))
end do
end if
if (present (str_dllensize)) then
allocate (character(n)::str_dllensize(n), stat=memstat)
if (ESMF_LogFoundAllocError (memstat, &
ESMF_CONTEXT, &
rcToReturn=rc)) return
do, j=1, n
do, i=1, len (str_dllensize)
str_dllensize(j)(i:i) = achar (mod (i, 127))
end do
end do
end if
rc = ESMF_SUCCESS
end subroutine ESMF_FeatureAllocArgStr