ESMF_CalendarSetBuiltIn Subroutine

private subroutine ESMF_CalendarSetBuiltIn(calendar, calkindflag, keywordEnforcer, name, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Calendar), intent(inout) :: calendar
type(ESMF_CalKind_Flag), intent(in) :: calkindflag
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
character(len=*), intent(in), optional :: name
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_CalendarSetBuiltIn(calendar, calkindflag, &
        keywordEnforcer, name, rc)

! !ARGUMENTS:
      type(ESMF_Calendar),     intent(inout)         :: calendar
      type(ESMF_CalKind_Flag), intent(in)            :: calkindflag
      type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      character (len=*),       intent(in),  optional :: name
      integer,                 intent(out), optional :: rc

!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
!     Sets {\tt calendar} to the given built-in {\tt ESMF\_CalKind\_Flag}. 
!
!     The arguments are:
!     \begin{description}
!     \item[calendar]
!          The object instance to initialize.
!     \item[calkindflag]
!          The built-in {\tt CalKind\_Flag}.  Valid values are:
!            \newline
!            {\tt ESMF\_CALKIND\_360DAY}, 
!            \newline
!            {\tt ESMF\_CALKIND\_GREGORIAN},
!            \newline
!            {\tt ESMF\_CALKIND\_JULIAN}, 
!            \newline
!            {\tt ESMF\_CALKIND\_JULIANDAY},
!            \newline
!            {\tt ESMF\_CALKIND\_MODJULIANDAY}, 
!            \newline
!            {\tt ESMF\_CALKIND\_NOCALENDAR},
!            \newline
!            and {\tt ESMF\_CALKIND\_NOLEAP}.
!            \newline
!          See Section ~\ref{subsec:Calendar_options} for a description of each
!          calendar kind.
!     \item[{[name]}]
!          The new name for this calendar.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!    
!EOP
    
      ! initialize name length to zero for non-existent name
      integer :: nameLen, localrc

      ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL

      ! check input
      ESMF_INIT_CHECK_DEEP(ESMF_CalendarGetInit,calendar,rc)

      nameLen = 0

      ! get length of given name for C++ validation
      if (present(name)) then
        nameLen = len_trim(name)
      end if
    
      ! invoke C to C++ entry point
      call c_ESMC_CalendarSetBuiltIn(calendar, nameLen, name, calkindflag, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      ! Return success
      if (present(rc)) rc = ESMF_SUCCESS
      end subroutine ESMF_CalendarSetBuiltIn