subroutine ESMF_InfoSetLG(info, key, value, keywordEnforcer, force, idx, pkey, rc)
type(ESMF_Info), intent(inout) :: info
character(len=*), intent(in) :: key
logical, intent(in) :: value
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
logical, intent(in), optional :: force
integer, intent(in), optional :: idx
character(len=*), intent(in), optional :: pkey
integer, intent(out), optional :: rc
integer :: localrc
logical(C_BOOL) :: local_force, local_value
integer(C_INT), target :: local_idx
type(C_PTR) :: local_idx_ptr
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(idx)) then
local_idx = idx - 1 ! Shift to C (zero-based) indexing
local_idx_ptr = C_LOC(local_idx)
else
local_idx_ptr = C_NULL_PTR
end if
if (present(pkey)) then
local_pkey = TRIM(pkey)//C_NULL_CHAR
else
local_pkey = ""//C_NULL_CHAR
end if
local_value = value
call c_info_set_LG(&
info%ptr, &
trim(key)//C_NULL_CHAR, &
local_value, &
local_force, &
localrc, &
local_idx_ptr, &
local_pkey)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_InfoSetLG