ESMF_ConfigFindLabel Subroutine

public subroutine ESMF_ConfigFindLabel(config, label, keywordEnforcer, isPresent, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config), intent(inout) :: config
character(len=*), intent(in) :: label
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
logical, intent(out), optional :: isPresent
integer, intent(out), optional :: rc

Calls

proc~~esmf_configfindlabel~~CallsGraph proc~esmf_configfindlabel ESMF_ConfigFindLabel proc~esmf_configgetinit ESMF_ConfigGetInit proc~esmf_configfindlabel->proc~esmf_configgetinit proc~esmf_imerr ESMF_IMErr proc~esmf_configfindlabel->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_configfindlabel->proc~esmf_logfounderror proc~index_ index_ proc~esmf_configfindlabel->proc~index_ proc~esmf_imerr->proc~esmf_logfounderror proc~esmf_initcheckdeep ESMF_InitCheckDeep proc~esmf_imerr->proc~esmf_initcheckdeep 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 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_configfindlabel~~CalledByGraph proc~esmf_configfindlabel ESMF_ConfigFindLabel proc~esmf_configcreatefromsection ESMF_ConfigCreateFromSection proc~esmf_configcreatefromsection->proc~esmf_configfindlabel proc~esmf_configgetdim ESMF_ConfigGetDim proc~esmf_configgetdim->proc~esmf_configfindlabel proc~esmf_configgetfloatsr4 ESMF_ConfigGetFloatsR4 proc~esmf_configgetfloatsr4->proc~esmf_configfindlabel proc~esmf_configgetfloatsr8 ESMF_ConfigGetFloatsR8 proc~esmf_configgetfloatsr8->proc~esmf_configfindlabel proc~esmf_configgetintsi4 ESMF_ConfigGetIntsI4 proc~esmf_configgetintsi4->proc~esmf_configfindlabel proc~esmf_configgetintsi8 ESMF_ConfigGetIntsI8 proc~esmf_configgetintsi8->proc~esmf_configfindlabel proc~esmf_configgetlen ESMF_ConfigGetLen proc~esmf_configgetlen->proc~esmf_configfindlabel proc~esmf_configgetlogicals ESMF_ConfigGetLogicals proc~esmf_configgetlogicals->proc~esmf_configfindlabel proc~esmf_configgetstring ESMF_ConfigGetString proc~esmf_configgetstring->proc~esmf_configfindlabel proc~esmf_configgetstrings ESMF_ConfigGetStrings proc~esmf_configgetstrings->proc~esmf_configfindlabel proc~esmf_frameworkinternalinit ESMF_FrameworkInternalInit proc~esmf_frameworkinternalinit->proc~esmf_configfindlabel proc~f_esmf_configfindlabel f_esmf_configfindlabel proc~f_esmf_configfindlabel->proc~esmf_configfindlabel proc~multpar_multlines MultPar_MultLines proc~multpar_multlines->proc~esmf_configfindlabel proc~multpar_singleline_u MultPar_SingleLine_U proc~multpar_singleline_u->proc~esmf_configfindlabel proc~multpar_singleline_v MultPar_SingleLine_V proc~multpar_singleline_v->proc~esmf_configfindlabel proc~multpar_singleline_vf MultPar_SingleLine_Vf proc~multpar_singleline_vf->proc~esmf_configfindlabel proc~nuopc_freeformatcreateread NUOPC_FreeFormatCreateRead proc~nuopc_freeformatcreateread->proc~esmf_configfindlabel proc~read_descriptor_files read_descriptor_files proc~read_descriptor_files->proc~esmf_configfindlabel proc~read_dist_specification read_dist_specification proc~read_dist_specification->proc~esmf_configfindlabel proc~read_grid_specification read_grid_specification proc~read_grid_specification->proc~esmf_configfindlabel proc~read_redistribution_grid read_redistribution_grid proc~read_redistribution_grid->proc~esmf_configfindlabel proc~read_regridding_grid read_regridding_grid proc~read_regridding_grid->proc~esmf_configfindlabel proc~read_testharness_config Read_TestHarness_Config proc~read_testharness_config->proc~esmf_configfindlabel proc~sections Sections proc~sections->proc~esmf_configfindlabel proc~table Table proc~table->proc~esmf_configfindlabel program~esmf_configoverviewex ESMF_ConfigOverviewEx program~esmf_configoverviewex->proc~esmf_configfindlabel program~esmf_hconfigutest ESMF_HConfigUTest program~esmf_hconfigutest->proc~esmf_configfindlabel

Source Code

    subroutine ESMF_ConfigFindLabel(config, label, keywordEnforcer, isPresent, rc)

! !ARGUMENTS:
      type(ESMF_Config), intent(inout)           :: config 
      character(len=*),  intent(in)              :: label
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      logical,           intent(out),  optional  :: isPresent
      integer,           intent(out),  optional  :: rc 

!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \item\apiStatusModifiedSinceVersion{5.2.0r}
! \begin{description}
! \item[6.1.0] Added the {\tt isPresent} argument.  Allows detection of
!  end-of-line condition to be separate from the {\tt rc}.
! \end{description}
! \end{itemize}
!
! !DESCRIPTION: Finds the {\tt label} (key) string in the {\tt config} object
!   starting from the beginning of its content.
!
!   Since the search is done by looking for a string, possibly multi-worded,
!   in the whole {\tt Config} object, it is important to use special 
!   conventions to distinguish {\tt labels} from other words. This is done 
!   in the Resource File by using the NASA/DAO convention to finish
!   line labels with a colon (:) and table labels with a double colon (::).
!
!
!   The arguments are:
!   \begin{description}
!   \item [config]
!     Already created {\tt ESMF\_Config} object.
!   \item [label]
!     Identifying label. 
!   \item [{[isPresent]}]
!     Set to {\tt .true.} if the item is found.
!   \item [{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     If the label is not found, and the {\tt isPresent} argument is
!     not present, an error is returned.
!   \end{description}
!
!EOP -------------------------------------------------------------------

      integer :: i, j

      ! Initialize return code; assume routine not implemented
      if (present(rc)) rc = ESMF_RC_NOT_IMPL

      !check variables
      ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)

      if (present (isPresent)) then
        isPresent = .false.
      end if

!     Determine whether label exists
!     ------------------------------    

      i = index_ ( config%cptr%buffer(1:config%cptr%nbuf), EOL//label ) + 1
      if ( i .eq. 1 ) then
         if (present (isPresent)) then
           if (present (rc)) rc = ESMF_SUCCESS
           return
         end if
         if (ESMF_LogFoundError(ESMF_RC_NOT_FOUND, &
                                msg="label " // trim (label) // " not found", &
                                 ESMF_CONTEXT, rcToReturn=rc)) return
      elseif(i.le.0) then
         if (ESMF_LogFoundError(ESMF_RC_ARG_BAD, &
                                msg="invalid operation with index_", &
                                 ESMF_CONTEXT, rcToReturn=rc)) return
      end if

      if (present (isPresent)) then
        isPresent = .true.
      end if

!     Save current attribute label without colon,
!       to associate with subsequent GetAttribute() or GetChar()
!     -------------------------------------------
       config%cptr%current_attr = label(1:(index_(label, ":") - 1))


!     Extract the line associated with this label
!     -------------------------------------------
      i = i + len ( label )
      j = verify(config%cptr%buffer(i:config%cptr%nbuf),":")
      if (j .eq. 0) then
        i = config%cptr%nbuf
      else
        i = i + j - 1
      end if
      config%cptr%value_begin = i
      config%cptr%next_item = i
      config%cptr%eolflag = .false.

      j = index_(config%cptr%buffer(i:config%cptr%nbuf),EOL)
      if (j .eq. 0) then
        config%cptr%next_line = config%cptr%nbuf
      else
        config%cptr%next_line = i + j
      end if

      if ( present (rc )) rc = ESMF_SUCCESS
      
    end subroutine ESMF_ConfigFindLabel