% This file is part of babel. For further details see:
% https://www.ctan.org/pkg/babel
\ifx\BabelBeforeIni\undefined
  \PackageError{babel}%
    {This file is a component of babel and cannot\MessageBreak
     be loaded directly. I'll stop immediately}%
    {Just use babel as documented.}%
  \stop
\fi
\BabelBeforeIni{grc}{%
}

\ifcase\bbl@engine\else

  % Date with Greek (Ionian) numerals

  \expandafter\addto\csname date\languagename\endcsname{%
     \babel@save\BabelDatey
     \def\BabelDatey#1{\greeknumeral{#1}}%
     \babel@save\BabelDated
     \def\BabelDated#1{\greeknumeral{#1}}}
     
  % Numerals (Ionian)

  \def\BabelGreekNumeralMarkerEnd#1{#1ʹ}
  \def\BabelGreekNumeralMarker#1{#1}

  \def\greek@num@aux#1#2#3#4#5#6#7#8#9\@@{%
    \ifcase\@car#9\@nil\or
       \greek@num@format0000000#1\or
       \greek@num@format000000#1#2\or
       \greek@num@format00000#1#2#3\or
       \greek@num@format0000#1#2#3#4\or
       \greek@num@format000#1#2#3#4#5\or
       \greek@num@format00#1#2#3#4#5#6\or
       \greek@num@format0#1#2#3#4#5#6#7\or
       \greek@num@format#1#2#3#4#5#6#7#8\else
       \greek@invalid
    \fi}
      
  \def\BabelGreekNumeralMyriads#1#2#3#4{%
    \ifnum#1#2=\z@
      \ifcase#3\or ͵ρ\or ͵σ\or ͵τ\or ͵υ\or ͵φ\or ͵χ\or ͵ψ\or ͵ω\or ͵ϡ\fi
      \ifcase#4\or ͵ι\or ͵κ\or ͵λ\or ͵μ\or ͵ν\or ͵ξ\or ͵ο\or ͵π\or ͵ϟ\fi
    \else
      \greek@invalid
    \fi}
    
  \def\greek@num@format#1#2#3#4#5#6#7#8{%
    \BabelGreekNumeralMarker{%
      \BabelGreekNumeralMyriads#1#2#3#4%
      \ifcase#5\or ͵α\or ͵β\or ͵γ\or ͵δ\or ͵ε\or ͵Ϛ\or ͵ζ\or ͵η\or ͵θ\fi
      \ifnum#6#7#8=\z@\else
        \BabelGreekNumeralMarkerEnd{%
          \ifcase#6\or ρ\or σ\or τ\or υ\or φ\or χ\or ψ\or ω\or ϡ\fi
          \ifcase#7\or ι\or κ\or λ\or μ\or ν\or ξ\or ο\or π\or ϟ\fi
          \ifcase#8\or α\or β\or γ\or δ\or ε\or Ϛ\or ζ\or η\or θ\fi}%
      \fi}}

  \def\greek@invalid{%
    \bbl@error{Greek numeral too large (>999999)}%
      {Currently this is the limit.}}
      
  \expandafter\addto\csname extras\languagename\endcsname{%
    \babel@save\greeknumeral
    \def\greeknumeral#1{\expandafter\greek@num@aux\number#1 876543210\@@}}    
    
\fi

\endinput