% This is the file CJK.enc of the CJK package
%   for using asiatic logographs (Chinese/Japanese/Korean) with LaTeX2e
%
% created by Werner Lemberg <a7621gac@awiuni11.bitnet>
%
% Version 2.5 (10-Apr-1995)

\def\fileversion{2.5}
\def\filedate{1995/04/10}
\ProvidesFile{CJK.enc}[\filedate\space\fileversion]


% we first define macros to load an encoding file xxx.enc if \CJK@xxxEncoding
%     is still undefined.

\def\CJK@loadEncoding#1{
  \expandafter\ifx\csname CJK@#1Encoding\endcsname \relax
    \makeatletter
    \endlinechar \m@ne
    \input #1.enc
    \endlinechar `\^^M
    \makeatother
  \fi
  \csname CJK@#1Encoding\endcsname
  \CJK@let}

% define macros for individual characters (i.e. the first byte); each active
%     character selects the appropriate subfont.

\def\CJK@namegdef#1{
  \expandafter\gdef\csname CJK@#1\endcsname}


% here are the punctuation tables. We suppress spaces additionally in this
%     group.

\begingroup
  \catcode`\ 9\relax

  \CJK@prePunct  {Bg5}{A1}{5D, 61, 65, 69, 6D, 71, 75, 79, 7D, A1, A3,
                           A5, A7, A9, AB,
                           AD, B1, CC, CD}
  \CJK@postPunct {Bg5}{A1}{41, 42, 43, 44, 45, 46, 47, 48,
                           49, 4B, 4C, 4D, 4E, 4F, 50, 51,
                           52, 53, 54,
                           5E, 62, 66, 6A, 6E, 72, 76, 7A, 7E, A2, A4,
                           A6, A8, AA, AC}
  \CJK@prePunct  {Bg5}{A2}{43, 44, 45, 46, 47, 49,
                           4C, 4E}
  \CJK@postPunct {Bg5}{A2}{48, 4A, 4B, 4D,
                           4F, 50, 51, 52, 53, 54, 55, 56, 57, 58}

  \CJK@prePunct   {GB}{A1}{AE, B0, B2, B4, B6, B8, BA, BC, BE,
                           E7, E8, E9, EA, EC, ED}
  \CJK@postPunct  {GB}{A1}{A2, A3, A4, A9, AD,
                           AF, B1, B3, B5, B7, B9, BB, BD, BF,
                           E3, E4, E5, E6, EB}
  \CJK@prePunct   {GB}{A3}{A3, A4, A8, C0, DB, FB}
  \CJK@postPunct  {GB}{A3}{A1, A5, A9, AC, AE, BA, BB, BF, DD, FD}

  \CJK@prePunct  {JIS}{A1}{C6, C8, CA, CC, CE, D0, D2, D4, D6, D8, DA,
                           EF, F0, F1, F2, F4, F7, F8}
  \CJK@postPunct {JIS}{A1}{A2, A3, A4, A5, A6, A7, A8, A9, AA, AB, AC,
                           B3, B4, B5, B6, B9, BA, BC,
                           C4, C7, C9, CB, CD, CF, D1, D3, D5, D7, D9, DB,
                           EB, EC, ED, EE, F3}
  \CJK@prePunct  {JIS}{A2}{A9}
  \CJK@postPunct {JIS}{A2}{}
  \CJK@prePunct  {JIS}{A4}{}
  \CJK@postPunct {JIS}{A4}{A1, A3, A5, A7, A9,
                           C3, E3, E5, E7, EE}
  \CJK@prePunct  {JIS}{A5}{}
  \CJK@postPunct {JIS}{A5}{A1, A3, A5, A7, A9,
                           C3, E3, E5, E7, EE,
                           F5, F6}

  \CJK@prePunct   {KS}{A1}{AE, B0, B2, B4, B6, B8, BA, BC,
                           CB, CC, CD, D7, EC}
  \CJK@postPunct  {KS}{A1}{A2, A3, A4, A5, A6,
                           AF, B1, B3, B5, B7, B9, BB, BD,
                           C6, C7, C8, C9, ED}
  \CJK@prePunct   {KS}{A3}{A3, A4, A8, C0, DB, DC, FB}
  \CJK@postPunct  {KS}{A3}{A1, A5, A9, AC, AE, BA, BB, BF, DD, FD}

  \xdef\CJK@uniPunct{30, FE, FF}

  \CJK@prePunct {UTF8}{30}{08, 0A, 0C, 0E, 10, 12, 14, 16, 18, 1A, 1D, 1F, 36}
  \CJK@postPunct{UTF8}{30}{01, 02, 05, 06,
                           09, 0B, 0D, 0F, 11, 15, 17, 19, 1B, 1E,
                           41, 43, 45, 47, 49, 63, 83, 85, 87, 8E,
                           9B, 9C, 9D, 9E,
                           A1, A3, A5, A7, A9, C3, E3, E5, E7, EE, F5, F6,
                           FB, FC, FD, FE}
  \CJK@prePunct {UTF8}{FE}{59, 5B, 5D, 5F, 60, 69, 6B}
  \CJK@postPunct{UTF8}{FE}{50, 51, 52, 54, 55, 56, 57, 5A, 5C, 5E, 6A}
  \CJK@prePunct {UTF8}{FF}{03, 04, 08, 20, 3B, 5B, E0, E1, E5, E6}
  \CJK@postPunct{UTF8}{FF}{01, 05, 09, 0C, 0E, 1A, 1B, 1F, 3D, 5D,
                           61, 63, 64, 65, 67, 68, 69, 6A, 6B, 6C, 6D, 6E, 6F,
                           70, 9E, 9F}
\endgroup


% traditional Chinese characters in Big 5 encoding scheme

\@namedef{CJK@Bg5@enc}{
  \ifx\CJKpreproc \@undefined
    \let\CJKuppercase \uppercase
    \let\uppercase \relax

    \PackageWarningNoLine{CJK}{
      \protect\uppercase\space disabled for Big 5 encoding}

    \@ifundefined{Bg5text}{
      \newenvironment{Bg5text}{
        \catcode`\\=12
        \catcode`\{=12
        \catcode`\}=12
        \def\/{/}
        \def\({(}
        \def\){)}
        \catcode`\/=0
        \catcode`\(=1
        \catcode`\)=2}{}}{}

    \CJK@loadEncoding{Bg5}
  \else
    \CJK@loadEncoding{Bg5pp}

    \let\CJK@@@char \CJK@char@
    \let\CJK@@@charx \CJK@charx@
    \let\CJK@@@punctchar \CJK@punctchar@
    \let\CJK@@@punctcharx \CJK@punctcharx@
  \fi

  \chardef\CJK@min "040%    % don't forget `0' before the number,
  \chardef\CJK@max "0FE}    %   otherwise german.sty will not work.


% simplified Chinese characters in GuoBiao encoding scheme.

\@namedef{CJK@GB@enc}{
  \CJK@loadEncoding{standard}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \CJK@namegdef{A3}##1{\CJK@punctcharx{A3}{01}{02}{27}{##1}}

  \edef\CJK@punctEnc{GB}}

% traditional Chinese characters in GuoBiao encoding scheme.

\@namedef{CJK@GBt@enc}{
  \CJK@loadEncoding{standard}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \CJK@namegdef{A3}##1{\CJK@punctcharx{A3}{01}{02}{27}{##1}}

  \edef\CJK@punctEnc{GB}}


% Japanese characters in JIS encoding scheme.

\@namedef{CJK@JIS@enc}{
  \CJK@loadEncoding{standard}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \CJK@namegdef{A2}##1{\CJK@punctchar{A2}{01}{ -67}{##1}}
  \CJK@namegdef{A4}##1{\CJK@punctchar{A4}{02}{-135}{##1}}
  \CJK@namegdef{A5}##1{\CJK@punctchar{A5}{02}{ -41}{##1}}

  \edef\CJK@punctEnc{JIS}}


% Hangul syllables and Hanja KS encoding.
%
% the increased \tolerance compensates the lack of \CJKglue for Hangul
%     syllables.

\@namedef{CJK@KS@enc}{
  \DeclareRobustCommand{\mj}{%                     % from hLaTeX
    \edef\CJK@shape{mj}}
  \DeclareRobustCommand{\gt}{
    \edef\CJK@shape{gt}}
  \DeclareRobustCommand{\gs}{
    \edef\CJK@shape{gs}}
  \DeclareRobustCommand{\gr}{
    \edef\CJK@shape{gr}}
  \DeclareRobustCommand{\dr}{
    \edef\CJK@shape{dr}}

  \DeclareRobustCommand{\hgt}{%                    % from hjTeX
    \edef\CJK@shape{hgt}}
  \DeclareRobustCommand{\hmj}{
    \edef\CJK@shape{hmj}}
  \DeclareRobustCommand{\hol}{
    \edef\CJK@shape{hol}}
  \DeclareRobustCommand{\hpg}{
    \edef\CJK@shape{hpg}}

  \mj

  \CJK@loadEncoding{KS}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \edef\CJK@punctEnc{KS}
  \tolerance \CJKtolerance}


% CJK characters in UTF 8 encoding scheme

\@namedef{CJK@UTF8@enc}{
  \CJK@loadEncoding{UTF8}

  \chardef\CJK@min "080
  \chardef\CJK@max "0BF}


% pmC compatibility: traditional Chinese characters in Big 5 encoding scheme.

\@namedef{CJK@pmC-Bg5@enc}{
  \ifx\CJKpreproc \@undefined
    \let\CJKuppercase \uppercase
    \let\uppercase \relax

    \PackageWarningNoLine{CJK}{
      \protect\uppercase\space disabled for Big 5 encoding}

    \@ifundefined{Bg5text}{
      \newenvironment{Bg5text}{
        \catcode`\\=12
        \catcode`\{=12
        \catcode`\}=12
        \def\/{/}
        \def\({(}
        \def\){)}
        \catcode`\/=0
        \catcode`\(=1
        \catcode`\)=2}{}}{}

    \DeclareRobustCommand{\pmCsmall}{
      \CJK@loadEncoding{pmCsmall}
      \CJK@namegdef{A2}####1{\CJK@punctchar{A2}{a2}{0}{####1}}
      \CJK@let}
  \else
    \DeclareRobustCommand{\pmCsmall}{
      \CJK@loadEncoding{pmCsmpp}
      \CJK@namegdef{A2}####1.{\CJK@punctchar{A2}{a2}{0}{####1}}
      \CJK@let

      \let\CJK@@@char \CJK@char@
      \let\CJK@@@punctchar \CJK@punctchar@}

  \fi

  \DeclareRobustCommand{\pmCbig}{
    \PackageError{CJK}{
      No big font for pmC Big 5 encoding available}{}}

  \chardef\CJK@min "040
  \chardef\CJK@max "0FE

  \edef\CJK@punctEnc{Bg5}

  \pmCsmall}

% pmC compatibility: simplified Chinese characters in GuoBiao encoding scheme.

\@namedef{CJK@pmC-GB@enc}{
  \DeclareRobustCommand{\pmCsmall}{
    \CJK@loadEncoding{pmCsmall}
    \CJK@namegdef{A3}####1{\CJK@punctchar{A3}{a3}{0}{####1}}
    \CJK@let}
  \DeclareRobustCommand{\pmCbig}{
    \CJK@loadEncoding{pmCbig}
    \CJK@namegdef{A3}####1{\CJK@punctchar{A3}{a3}{-128}{####1}}
    \CJK@let}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \edef\CJK@punctEnc{GB}

  \pmCsmall}

% pmC compatibility: traditional Chinese characters in GuoBiao encoding
%     scheme.

\@namedef{CJK@pmC-GBt@enc}{
  \DeclareRobustCommand{\pmCsmall}{
    \CJK@loadEncoding{pmCsmall}
    \CJK@namegdef{A3}####1{\CJK@punctchar{A3}{a3}{0}{####1}}
    \CJK@let}
  \DeclareRobustCommand{\pmCbig}{
    \CJK@loadEncoding{pmCbig}
    \CJK@namegdef{A3}####1{\CJK@punctchar{A3}{a3}{-128}{####1}}
    \CJK@let}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \edef\CJK@punctEnc{GB}

  \pmCsmall}

% pmC compatibility: Japanese characters in JIS encoding scheme.

\@namedef{CJK@pmC-JIS@enc}{
  \DeclareRobustCommand{\pmCsmall}{
    \CJK@loadEncoding{pmCsmall}
    \CJK@namegdef{A2}####1{\CJK@punctchar{A2}{a2}{0}{####1}}
    \CJK@namegdef{A4}####1{\CJK@punctchar{A4}{a4}{0}{####1}}
    \CJK@namegdef{A5}####1{\CJK@punctchar{A5}{a5}{0}{####1}}
    \CJK@let}
  \DeclareRobustCommand{\pmCbig}{
    \CJK@loadEncoding{pmCbig}
    \CJK@namegdef{A2}####1{\CJK@punctchar{A2}{a2}{-128}{####1}}
    \CJK@namegdef{A4}####1{\CJK@punctchar{A4}{a4}{-128}{####1}}
    \CJK@namegdef{A5}####1{\CJK@punctchar{A5}{a5}{-128}{####1}}
    \CJK@let}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \edef\CJK@punctEnc{JIS}

  \pmCsmall}

% pmC compatibility: Korean Jamos, Hangul and Hanja in KS encoding scheme.

\@namedef{CJK@pmC-KS@enc}{
  \DeclareRobustCommand{\pmCsmall}{
    \CJK@loadEncoding{pmCsmall}
    \CJK@namegdef{A3}####1{\CJK@punctchar{A3}{a3}{0}{####1}}
    \CJK@let}
  \DeclareRobustCommand{\pmCbig}{
    \CJK@loadEncoding{pmCbig}
    \CJK@namegdef{A3}####1{\CJK@punctchar{A3}{a3}{-128}{####1}}
    \CJK@let}

  \chardef\CJK@min "0A1
  \chardef\CJK@max "0FE

  \edef\CJK@punctEnc{KS}

  \pmCsmall}

\endinput
