function ESMF_CalendarCreateBuiltIn(calkindflag, keywordEnforcer, &
name, rc)
! !RETURN VALUE:
type(ESMF_Calendar) :: ESMF_CalendarCreateBuiltIn
! !ARGUMENTS:
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:
! Creates and sets a {\tt calendar} to the given built-in
! {\tt ESMF\_CalKind\_Flag}.
!
! The arguments are:
! \begin{description}
! \item[calkindflag]
! The built-in {\tt ESMF\_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 name for the newly created calendar. If not specified, a
! default unique name will be generated: "CalendarNNN" where NNN
! is a unique sequence number from 001 to 999.
! \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
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_CalendarCreateBuiltIn(ESMF_CalendarCreateBuiltIn, nameLen, &
name, calkindflag, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! mark output as successfully initialized
ESMF_INIT_SET_CREATED(ESMF_CalendarCreateBuiltIn)
! Return success
if (present(rc)) rc = ESMF_SUCCESS
end function ESMF_CalendarCreateBuiltIn