%% File `dhucs-enumerate.sty`
%%
%% Copyright (c) 2007-2013 Dohyun Kim <nomos at ktug org>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%  http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2006/05/20 or later.
%%
\ProvidesPackage{dhucs-enumerate}
  [2015/09/10 partially support enumerate.sty under dhucs]

\RequirePackage{enumerate}

\ifx 가가\g@addto@macro\@enhook{%
    \ifx ^^^^ac00\@entemp \def\@tempa{\@enLabel\gana}\else
    \ifx ^^^^2170\@entemp \def\@tempa{\@enLabel\hroman}\else
    \ifx ^^^^2160\@entemp \def\@tempa{\@enLabel\hRoman}\else
    \ifx ^^^^249c\@entemp \def\@tempa{\@enLabel\peng}\else
    \ifx ^^^^24d0\@entemp \def\@tempa{\@enLabel\oeng}\else
    \ifx ^^^^2474\@entemp \def\@tempa{\@enLabel\pnum}\else
    \ifx ^^^^2460\@entemp \def\@tempa{\@enLabel\onum}\else
    \ifx ^^^^320e\@entemp \def\@tempa{\@enLabel\pgana}\else
    \ifx ^^^^326e\@entemp \def\@tempa{\@enLabel\ogana}\else
    \ifx ^^^^3260\@entemp \def\@tempa{\@enLabel\ojaso}\else
    \ifx ^^^^3131\@entemp \def\@tempa{\@enLabel\jaso}\else
    \ifx ^^^^3200\@entemp \def\@tempa{\@enLabel\pjaso}%
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
    \expandafter\endinput
\fi

\g@addto@macro\@enhook{%
  \ifx^^ea\@entemp  % 가,
    \let\@tempa\@dhucs@enumerate@EA\else %%%%%
  \ifx^^e2\@entemp  % ①, ⑴, ⒜, ⓐ, ⅰ, Ⅰ
    \let\@tempa\@dhucs@enumerate@Eii\else %%%%%
  \ifx^^e3\@entemp  % ㄱ, ㉠, ㉮, ㈀, ㈎
    \let\@tempa\@dhucs@enumerate@Eiii
  \fi\fi\fi
}
\def\@dhucs@enumerate@error#1{%
  \PackageError{dhucs-enumerate}
    {You can't use `\unexpanded{#1}' as enum label}
    {Legal enum labels of hangul-ucs are: \MessageBreak\space\space
      \unexpanded{가, ㄱ, ㉠, ㉮, ㈀, ㈎, ①, ⑴, ⒜, ⓐ, ⅰ, Ⅰ}.}%
}
\def\@dhucs@enumerate@EA#1#2#3{%
  \ifnum\pdfstrcmp{#1#2#3}{^^ea^^b0^^80}=\z@ \def\@tempa{\@enLabel\gana}\else
    \@dhucs@enumerate@error{#1#2#3}%
  \fi
  \@tempa\relax
}
\def\@dhucs@enumerate@Eii#1#2#3{%
  \ifnum\pdfstrcmp{#1#2#3}{^^e2^^85^^b0}=\z@ \def\@tempa{\@enLabel\hroman}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e2^^85^^a0}=\z@ \def\@tempa{\@enLabel\hRoman}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e2^^92^^9c}=\z@ \def\@tempa{\@enLabel\peng}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e2^^93^^90}=\z@ \def\@tempa{\@enLabel\oeng}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e2^^91^^b4}=\z@ \def\@tempa{\@enLabel\pnum}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e2^^91^^a0}=\z@ \def\@tempa{\@enLabel\onum}\else
    \@dhucs@enumerate@error{#1#2#3}%
  \fi\fi\fi\fi\fi\fi
  \@tempa\relax
}
\def\@dhucs@enumerate@Eiii#1#2#3{%
  \ifnum\pdfstrcmp{#1#2#3}{^^e3^^88^^8e}=\z@ \def\@tempa{\@enLabel\pgana}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e3^^89^^ae}=\z@ \def\@tempa{\@enLabel\ogana}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e3^^89^^a0}=\z@ \def\@tempa{\@enLabel\ojaso}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e3^^84^^b1}=\z@ \def\@tempa{\@enLabel\jaso}\else
  \ifnum\pdfstrcmp{#1#2#3}{^^e3^^88^^80}=\z@ \def\@tempa{\@enLabel\pjaso}\else
    \@dhucs@enumerate@error{#1#2#3}%
  \fi\fi\fi\fi\fi
  \@tempa\relax
}
\endinput
