%%
%% This is file `c40enc.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ucs.dtx  (with options: `c40enc.def')
%% 
%% Copyright 2001 Dominique Unruh  <unruh@ut.ee>
%% Copyright 2013 Wolfgang Jeltsch <wolfgang@cs.ioc.ee>
%% Copyright 2022 David Carlisle https://github.com/LaTeX-Package-Repositories/ucs
%% 
%% This program is provided under the terms of the LaTeX Project Public License with some
%% modifications. See the file LICENSE for information.
%% 
\ProvidesFile{c40enc.def}[2002/11/25 Fontencoding C40 (JIS)]%
\DeclareFontEncoding{C40}{}{}%
\DeclareFontSubstitution{C40}{song}{m}{n}%
\input{cenccmn.tex}%
\expandafter\let\csname C40/song/m/n\endcsname\undefined
\def\cjk@Cforty#1#2#3#4{% Takes JIS0208 codepos in hex
  {%
    \count0="#1#2
    \multiply\count0 by94
    \advance\count0 by"#3#4
    \advance\count0 by-"B3F
    \count1\count0
    \divide\count0 by256
    \multiply\count0 by256
    \advance\count1 by-\count0
    \divide\count0 by256
    %\typeout{C0=\number\count0, C1=\number\count1}%
    \edef\temp@a{\ifnum\count0<10 0\fi\number\count0}%
    \edef\temp@b{\ifx\temp@a\CJK@plane\else
      \def\noexpand\CJK@plane{\temp@a}\noexpand\selectfont\fi
      \char\number\count\@ne\space}%
    %\typeout{C40: \meaning\temp@b}%
    \expandafter}\temp@b%
  }%
\DeclareTextCommand\jischar{C40}[1]{\cjk@Cforty#1}
\DeclareTextCommandDefault\jischar[1]{{\fontencoding{C40}%
    \let\CJK@plane\undefined\cjk@Cforty#1}}
