ESMF_ConfigFindNextLabel Subroutine

public subroutine ESMF_ConfigFindNextLabel(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_configfindnextlabel~~CallsGraph proc~esmf_configfindnextlabel ESMF_ConfigFindNextLabel proc~esmf_configgetinit ESMF_ConfigGetInit proc~esmf_configfindnextlabel->proc~esmf_configgetinit proc~esmf_imerr ESMF_IMErr proc~esmf_configfindnextlabel->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_configfindnextlabel->proc~esmf_logfounderror proc~index_ index_ proc~esmf_configfindnextlabel->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_configfindnextlabel~~CalledByGraph proc~esmf_configfindnextlabel ESMF_ConfigFindNextLabel proc~esmf_configcreatefromsection ESMF_ConfigCreateFromSection proc~esmf_configcreatefromsection->proc~esmf_configfindnextlabel interface~esmf_configcreate ESMF_ConfigCreate proc~esmf_configcreatefromsection->interface~esmf_configcreate proc~f_esmf_configfindnextlabel f_esmf_configfindnextlabel proc~f_esmf_configfindnextlabel->proc~esmf_configfindnextlabel proc~sections Sections proc~sections->proc~esmf_configfindnextlabel proc~sections->interface~esmf_configcreate interface~esmf_configcreate->proc~esmf_configcreatefromsection proc~complianceinitialize ComplianceInitialize proc~complianceinitialize->interface~esmf_configcreate proc~esmf_compconstruct ESMF_CompConstruct proc~esmf_compconstruct->interface~esmf_configcreate proc~esmf_compset ESMF_CompSet proc~esmf_compset->interface~esmf_configcreate proc~esmf_frameworkinternalinit ESMF_FrameworkInternalInit proc~esmf_frameworkinternalinit->interface~esmf_configcreate proc~f_esmf_configcreate f_esmf_configcreate proc~f_esmf_configcreate->interface~esmf_configcreate proc~f_esmf_configcreatefromsection f_esmf_configcreatefromsection proc~f_esmf_configcreatefromsection->interface~esmf_configcreate proc~initialization Initialization proc~initialization->interface~esmf_configcreate proc~read_descriptor_files read_descriptor_files proc~read_descriptor_files->interface~esmf_configcreate proc~read_dist_specification read_dist_specification proc~read_dist_specification->interface~esmf_configcreate proc~read_grid_specification read_grid_specification proc~read_grid_specification->interface~esmf_configcreate proc~read_redistribution_grid read_redistribution_grid proc~read_redistribution_grid->interface~esmf_configcreate proc~read_regridding_grid read_regridding_grid proc~read_regridding_grid->interface~esmf_configcreate proc~read_testharness_config Read_TestHarness_Config proc~read_testharness_config->interface~esmf_configcreate program~esmf_appdriver ESMF_AppDriver program~esmf_appdriver->interface~esmf_configcreate program~esmf_config_test ESMF_Config_Test program~esmf_config_test->interface~esmf_configcreate program~esmf_configoverviewex ESMF_ConfigOverviewEx program~esmf_configoverviewex->interface~esmf_configcreate program~esmf_hconfigex ESMF_HConfigEx program~esmf_hconfigex->interface~esmf_configcreate program~esmf_hconfigutest ESMF_HConfigUTest program~esmf_hconfigutest->interface~esmf_configcreate

Source Code

    subroutine ESMF_ConfigFindNextLabel(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

!
! !DESCRIPTION: Finds the {\tt label} (key) string in the {\tt config} object,
!   starting from the current position pointer.
!
!   This method is equivalent to {\tt ESMF\_ConfigFindLabel}, but the search
!   is performed starting from the current position pointer.
!
!   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, ptr

      ! 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 from current position onward
!     -----------------------------------------------------------
      ptr = max(config%cptr%next_line-1, 1)
      i = index_ ( config%cptr%buffer(ptr: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 ) + ptr - 1
      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_ConfigFindNextLabel