ESMF_UtilStringDiffMatch Function

public function ESMF_UtilStringDiffMatch(string1, string2, minusStringList, plusStringList, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string1
character(len=*), intent(in) :: string2
character(len=*), intent(in) :: minusStringList(:)
character(len=*), intent(in) :: plusStringList(:)
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Return Value logical


Calls

proc~~esmf_utilstringdiffmatch~~CallsGraph proc~esmf_utilstringdiffmatch ESMF_UtilStringDiffMatch c_esmc_stringdiffmatch c_esmc_stringdiffmatch proc~esmf_utilstringdiffmatch->c_esmc_stringdiffmatch proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_utilstringdiffmatch->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~esmf_utilstringdiffmatch->proc~esmf_logseterror esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_logseterror->proc~esmf_logwrite c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Called by

proc~~esmf_utilstringdiffmatch~~CalledByGraph proc~esmf_utilstringdiffmatch ESMF_UtilStringDiffMatch proc~esmf_statereconcile ESMF_StateReconcile proc~esmf_statereconcile->proc~esmf_utilstringdiffmatch

Source Code

  function ESMF_UtilStringDiffMatch(string1, string2, minusStringList, &
    plusStringList, keywordEnforcer, rc)
! !RETURN VALUE:
    logical :: ESMF_UtilStringDiffMatch
! !ARGUMENTS:
    character(len=*), intent(in)            :: string1
    character(len=*), intent(in)            :: string2
    character(len=*), intent(in)            :: minusStringList(:)
    character(len=*), intent(in)            :: plusStringList(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    integer,          intent(out), optional :: rc
! !DESCRIPTION:
!   Match the list of differences between {\tt string1} and {\tt string2}
!   against {\tt plus} and {\tt minus} string pairs.
!   The generated differences are based on Myers diff algorithm implementation
!   provided by \url{https://github.com/gritzko/myers-diff}.
!
!   The arguments are:
!   \begin{description}
!   \item[string1]
!     First string in the difference.
!   \item[string2]
!     Second string in the difference.
!   \item[minusStringList]
!     List of strings that are allowed to show up as "minus" in the difference.
!   \item[plusStringList]
!     List of strings that are allowed to show up as "plus" in the difference.
!   \item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOPI
  !-----------------------------------------------------------------------------
    ! local variables
    integer                   :: localrc
    integer                   :: matchCount
    type(ESMF_Logical)        :: tf

    if (present(rc)) rc = ESMF_SUCCESS

    ESMF_UtilStringDiffMatch = .false.  ! default return value

    matchCount = size(minusStringList)
    if (size(plusStringList) /= matchCount) then
      call ESMF_LogSetError(ESMF_RC_ARG_BAD, &
        msg="Number of strings in minus/plus string lists must match!`", &
        line=__LINE__, &
        file=ESMF_FILENAME, &
        rcToReturn=rc)
      return ! bail out
    endif

    call c_ESMC_StringDiffMatch(string1, string2, minusStringList, &
      plusStringList, matchCount, tf, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    ESMF_UtilStringDiffMatch = (tf == ESMF_TRUE)

  end function ESMF_UtilStringDiffMatch