\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{simurgh-abjad}[2013/12/01 v0.01a abjad counter]
\if@simurgh@csundef{abjadnumeral}{%
\def\abjadnumeral#1{%
\ifnum#1>1999 \simurgh@warning{Illegal value (#1) for abjad numeral} {#1}
\else
  \ifnum#1<\z@\space\simurgh@warning{Illegal value (#1) for abjad numeral}%
  \else
    \ifnum#1<10\expandafter\abj@num@i\number#1%
    \else
      \ifnum#1<100\expandafter\abj@num@ii\number#1%
      \else
        \ifnum#1<\@m\expandafter\abj@num@iii\number#1%
        \else
          \ifnum#1<\@M\expandafter\abj@num@iv\number#1%since #1<2000, we must have 1000
          \fi
        \fi
      \fi
    \fi
  \fi
\fi
}
\def\abjad@zero{}
\def\abj@num@i#1{%
  \ifcase#1\or آ\or ب\or ج\or د%
           \or ه‍\or و\or ز\or ح\or ط\fi
  \ifnum#1=\z@\abjad@zero\fi}
\def\abj@num@ii#1{%
  \ifcase#1\or ی\or ک\or ل\or م\or ن%
           \or س\or ع\or ف\or ص\fi
  \ifnum#1=\z@\fi\abj@num@i}
\def\abj@num@iii#1{%
  \ifcase#1\or ق\or ر\or ش\or ت\or ث%
            \or خ\or ذ\or ض\or ظ\fi
  \ifnum#1=\z@\fi\abj@num@ii}
\def\abj@num@iv#1{%
  \ifcase#1\or غ\fi
  \ifnum#1=\z@\fi\abj@num@iii}
}{}
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
\def\ParsiAlphs{%
   \let\@alph\abjadnumeral%
   \let\@Alph\abjadnumeral%
}
\def\LatinAlphs{%
   \let\@alph\@latinalph%
   \let\@Alph\@latinAlph%
}
\ParsiAlphs
\endinput