ESMF_ConfigNextLine Subroutine

public subroutine ESMF_ConfigNextLine(config, keywordEnforcer, tableEnd, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config), intent(inout) :: config
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
logical, intent(out), optional :: tableEnd
integer, intent(out), optional :: rc

Source Code

    subroutine ESMF_ConfigNextLine(config, keywordEnforcer, tableEnd, rc)

! !ARGUMENTS:
      type(ESMF_Config), intent(inout)          :: config 
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      logical,           intent(out),  optional :: tableEnd
      integer,           intent(out),  optional :: rc 
!
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION: 
!   Selects the next line (for tables).
!
!   The arguments are:
!   \begin{description}
!   \item [config]
!     Already created {\tt ESMF\_Config} object.
!   \item [{[tableEnd]}]
!     Returns {\tt .true.} if end of table mark (::) is encountered.
!   \item [{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}

!EOP -------------------------------------------------------------------
!
      integer :: localrc
      integer :: i, j
      logical :: local_tend

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

      localrc = ESMF_RC_NOT_IMPL
      local_tend = .false.
      !check variables
      ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)

      if ( config%cptr%next_line >= config%cptr%nbuf ) then
         localrc = ESMF_RC_MEM
           if ( present (rc )) then
             rc = localrc
           endif
         return
      end if

      i = config%cptr%next_line
      j = i + index_(config%cptr%buffer(i:config%cptr%nbuf),EOL) - 2
      config%cptr%this_line = config%cptr%buffer(i:j) // BLK // EOL
      
      if ( config%cptr%this_line(1:2) .eq. '::' ) then
         localrc = ESMF_SUCCESS      ! end of table. We set rc = ESMF_SUCCESS
         local_tend = .true.         ! and end = .true. Used to be iret = 1  
         config%cptr%next_line = config%cptr%nbuf + 1
         if ( present (tableEnd )) then
           tableEnd = local_tend
         endif
         if ( present (rc )) then
           rc = localrc
         endif
         return
      end if

      config%cptr%next_line = j + 2
      localrc = ESMF_SUCCESS
      if ( present (tableEnd )) then
        tableEnd = local_tend
      endif
      if ( present (rc )) then
        rc = localrc
      endif

    end subroutine ESMF_ConfigNextLine