% this is pmCs  Poor Man's Chinese with simplified characters
% this software is placed in the public domain 12/3/1990
% by Thomas B. Ridgeway and the Humanities and Arts Computing Center
%
% declare pmCs fonts     stand by . . . this may take a while
\font\cfaB=wccsa1
\font\cfaC=wccsa2
\font\cfaD=wccsa3
\font\cfaE=wccsa4
\font\cfaF=wccsa5
\font\cfaG=wccsa6
\font\cfaH=wccsa7
\font\cfaI=wccsa8
\font\cfaJ=wccsa9
\font\cfaa=wccsaa
\font\cfab=wccsab
\font\cfac=wccsac
\font\cfad=wccsad
\font\cfae=wccsae
\font\cfaf=wccsaf
\font\cfbA=wccsb0
\font\cfbB=wccsb1
\font\cfbC=wccsb2
\font\cfbD=wccsb3
\font\cfbE=wccsb4
\font\cfbF=wccsb5
\font\cfbG=wccsb6
\font\cfbH=wccsb7
\font\cfbI=wccsb8
\font\cfbJ=wccsb9
\font\cfba=wccsba
\font\cfbb=wccsbb
\font\cfbc=wccsbc
\font\cfbd=wccsbd
\font\cfbe=wccsbe
\font\cfbf=wccsbf
\font\cfcA=wccsc0
\font\cfcB=wccsc1
\font\cfcC=wccsc2
\font\cfcD=wccsc3
\font\cfcE=wccsc4
\font\cfcF=wccsc5
\font\cfcG=wccsc6
\font\cfcH=wccsc7
\font\cfcI=wccsc8
\font\cfcJ=wccsc9
\font\cfca=wccsca
\font\cfcb=wccscb
\font\cfcc=wccscc
\font\cfcd=wccscd
\font\cfce=wccsce
\font\cfcf=wccscf
\font\cfdA=wccsd0
\font\cfdB=wccsd1
\font\cfdC=wccsd2
\font\cfdD=wccsd3
\font\cfdE=wccsd4
\font\cfdF=wccsd5
\font\cfdG=wccsd6
\font\cfdH=wccsd7
\font\cfdI=wccsd8
\font\cfdJ=wccsd9
\font\cfda=wccsda
\font\cfdb=wccsdb
\font\cfdc=wccsdc
\font\cfdd=wccsdd
\font\cfde=wccsde
\font\cfdf=wccsdf
\font\cfeA=wccse0
\font\cfeB=wccse1
\font\cfeC=wccse2
\font\cfeD=wccse3
\font\cfeE=wccse4
\font\cfeF=wccse5
\font\cfeG=wccse6
\font\cfeH=wccse7
\font\cfeI=wccse8
\font\cfeJ=wccse9
\font\cfea=wccsea
\font\cfeb=wccseb
\font\cfec=wccsec
\font\cfed=wccsed
\font\cfee=wccsee
\font\cfef=wccsef
\font\cffA=wccsf0
\font\cffB=wccsf1
\font\cffC=wccsf2
\font\cffD=wccsf3
\font\cffE=wccsf4
\font\cffF=wccsf5
\font\cffG=wccsf6
\font\cffH=wccsf7
\font\cffI=wccsf8
%
% a flag to show whether 1st byte of 2-byte pair has been read
\newif\ifchifontset
\chifontsetfalse % no, it hasn't yet been read
%
% our fonts are portmanteaus containing two different sizes,
%     set up machinery for picking one or another size
\newif\ifbigC
\bigCfalse % no, we are not printing big Chinese now
\def\cglue{\hskip0pt plus.5pt}
\newcount\Cchar
%
\def\cchar#1{\Cchar=#1\ifbigC\advance\Cchar by -128\fi\char\the\Cchar}
% define a general macro for handling Chinese characters
\def\chichar#1#2{\ifchifontset\cchar{#1}\restorefont\discretionary{}{}{}\cglue\chifontsetfalse\else\chifontsettrue\edef\restorefont{\the\font}#2\fi}
% define a special macro for those characters which can only be 2nd of 2 bytes
\def\chichr#1{\ifchifontset\cchar{#1}\restorefont\chifontsetfalse\else\message{!pmC! character #1 out of context!}\fi}
% define macros for the individual characters
%   each character sets a) a current font, or b) its character in the current font
%   depending on ifchifontset
% do chinese within a local group so that other schemes for
%    using chars in range 128+ might be used elsewhere
%
\def\chiactive{
\catcode`\^^a0=\active
\catcode`\^^a1=\active
\catcode`\^^a2=\active
\catcode`\^^a3=\active
\catcode`\^^a4=\active
\catcode`\^^a5=\active
\catcode`\^^a6=\active
\catcode`\^^a7=\active
\catcode`\^^a8=\active
\catcode`\^^a9=\active
\catcode`\^^aa=\active
\catcode`\^^ab=\active
\catcode`\^^ac=\active
\catcode`\^^ad=\active
\catcode`\^^ae=\active
\catcode`\^^af=\active
\catcode`\^^b0=\active
\catcode`\^^b1=\active
\catcode`\^^b2=\active
\catcode`\^^b3=\active
\catcode`\^^b4=\active
\catcode`\^^b5=\active
\catcode`\^^b6=\active
\catcode`\^^b7=\active
\catcode`\^^b8=\active
\catcode`\^^b9=\active
\catcode`\^^ba=\active
\catcode`\^^bb=\active
\catcode`\^^bc=\active
\catcode`\^^bd=\active
\catcode`\^^be=\active
\catcode`\^^bf=\active
\catcode`\^^c0=\active
\catcode`\^^c1=\active
\catcode`\^^c2=\active
\catcode`\^^c3=\active
\catcode`\^^c4=\active
\catcode`\^^c5=\active
\catcode`\^^c6=\active
\catcode`\^^c7=\active
\catcode`\^^c8=\active
\catcode`\^^c9=\active
\catcode`\^^ca=\active
\catcode`\^^cb=\active
\catcode`\^^cc=\active
\catcode`\^^cd=\active
\catcode`\^^ce=\active
\catcode`\^^cf=\active
\catcode`\^^d0=\active
\catcode`\^^d1=\active
\catcode`\^^d2=\active
\catcode`\^^d3=\active
\catcode`\^^d4=\active
\catcode`\^^d5=\active
\catcode`\^^d6=\active
\catcode`\^^d7=\active
\catcode`\^^d8=\active
\catcode`\^^d9=\active
\catcode`\^^da=\active
\catcode`\^^db=\active
\catcode`\^^dc=\active
\catcode`\^^dd=\active
\catcode`\^^de=\active
\catcode`\^^df=\active
\catcode`\^^e0=\active
\catcode`\^^e1=\active
\catcode`\^^e2=\active
\catcode`\^^e3=\active
\catcode`\^^e4=\active
\catcode`\^^e5=\active
\catcode`\^^e6=\active
\catcode`\^^e7=\active
\catcode`\^^e8=\active
\catcode`\^^e9=\active
\catcode`\^^ea=\active
\catcode`\^^eb=\active
\catcode`\^^ec=\active
\catcode`\^^ed=\active
\catcode`\^^ee=\active
\catcode`\^^ef=\active
\catcode`\^^f0=\active
\catcode`\^^f1=\active
\catcode`\^^f2=\active
\catcode`\^^f3=\active
\catcode`\^^f4=\active
\catcode`\^^f5=\active
\catcode`\^^f6=\active
\catcode`\^^f7=\active
\catcode`\^^f8=\active
\catcode`\^^f9=\active
\catcode`\^^fa=\active
\catcode`\^^fb=\active
\catcode`\^^fc=\active
\catcode`\^^fd=\active
\catcode`\^^fe=\active
\catcode`\^^ff=\active
}
\def\inactive{
\catcode`\^^a0=12
\catcode`\^^a1=12
\catcode`\^^a2=12
\catcode`\^^a3=12
\catcode`\^^a4=12
\catcode`\^^a5=12
\catcode`\^^a6=12
\catcode`\^^a7=12
\catcode`\^^a8=12
\catcode`\^^a9=12
\catcode`\^^aa=12
\catcode`\^^ab=12
\catcode`\^^ac=12
\catcode`\^^ad=12
\catcode`\^^ae=12
\catcode`\^^af=12
\catcode`\^^b0=12
\catcode`\^^b1=12
\catcode`\^^b2=12
\catcode`\^^b3=12
\catcode`\^^b4=12
\catcode`\^^b5=12
\catcode`\^^b6=12
\catcode`\^^b7=12
\catcode`\^^b8=12
\catcode`\^^b9=12
\catcode`\^^ba=12
\catcode`\^^bb=12
\catcode`\^^bc=12
\catcode`\^^bd=12
\catcode`\^^be=12
\catcode`\^^bf=12
\catcode`\^^c0=12
\catcode`\^^c1=12
\catcode`\^^c2=12
\catcode`\^^c3=12
\catcode`\^^c4=12
\catcode`\^^c5=12
\catcode`\^^c6=12
\catcode`\^^c7=12
\catcode`\^^c8=12
\catcode`\^^c9=12
\catcode`\^^ca=12
\catcode`\^^cb=12
\catcode`\^^cc=12
\catcode`\^^cd=12
\catcode`\^^ce=12
\catcode`\^^cf=12
\catcode`\^^d0=12
\catcode`\^^d1=12
\catcode`\^^d2=12
\catcode`\^^d3=12
\catcode`\^^d4=12
\catcode`\^^d5=12
\catcode`\^^d6=12
\catcode`\^^d7=12
\catcode`\^^d8=12
\catcode`\^^d9=12
\catcode`\^^da=12
\catcode`\^^db=12
\catcode`\^^dc=12
\catcode`\^^dd=12
\catcode`\^^de=12
\catcode`\^^df=12
\catcode`\^^e0=12
\catcode`\^^e1=12
\catcode`\^^e2=12
\catcode`\^^e3=12
\catcode`\^^e4=12
\catcode`\^^e5=12
\catcode`\^^e6=12
\catcode`\^^e7=12
\catcode`\^^e8=12
\catcode`\^^e9=12
\catcode`\^^ea=12
\catcode`\^^eb=12
\catcode`\^^ec=12
\catcode`\^^ed=12
\catcode`\^^ee=12
\catcode`\^^ef=12
\catcode`\^^f0=12
\catcode`\^^f1=12
\catcode`\^^f2=12
\catcode`\^^f3=12
\catcode`\^^f4=12
\catcode`\^^f5=12
\catcode`\^^f6=12
\catcode`\^^f7=12
\catcode`\^^f8=12
\catcode`\^^f9=12
\catcode`\^^fa=12
\catcode`\^^fb=12
\catcode`\^^fc=12
\catcode`\^^fd=12
\catcode`\^^fe=12
\catcode`\^^ff=12
}
%
\def\endchinese{\endgroup}
%
\chiactive %switch on characters so we can define the macros with them active
\def\beginchinese{\begingroup\chiactive
% make characters used in GB/JIS encoding active so they can become macros
% always end the line after saying \beginchinese
%    any characters on the same line will have already been read with
%    their non-chinese meanings
\def^^a0{\chichar{160}{\cfaA}}%
\def^^a1{\chichar{161}{\cfaB}}%
\def^^a2{\chichar{162}{\cfaC}}%
\def^^a3{\chichar{163}{\cfaD}}%
\def^^a4{\chichar{164}{\cfaE}}%
\def^^a5{\chichar{165}{\cfaF}}%
\def^^a6{\chichar{166}{\cfaG}}%
\def^^a7{\chichar{167}{\cfaH}}%
\def^^a8{\chichar{168}{\cfaI}}%
\def^^a9{\chichar{169}{\cfaJ}}%
\def^^aa{\chichar{170}{\cfaa}}%
\def^^ab{\chichar{171}{\cfab}}%
\def^^ac{\chichar{172}{\cfac}}%
\def^^ad{\chichar{173}{\cfad}}%
\def^^ae{\chichar{174}{\cfae}}%
\def^^af{\chichar{175}{\cfaf}}%
\def^^b0{\chichar{176}{\cfbA}}%
\def^^b1{\chichar{177}{\cfbB}}%
\def^^b2{\chichar{178}{\cfbC}}%
\def^^b3{\chichar{179}{\cfbD}}%
\def^^b4{\chichar{180}{\cfbE}}%
\def^^b5{\chichar{181}{\cfbF}}%
\def^^b6{\chichar{182}{\cfbG}}%
\def^^b7{\chichar{183}{\cfbH}}%
\def^^b8{\chichar{184}{\cfbI}}%
\def^^b9{\chichar{185}{\cfbJ}}%
\def^^ba{\chichar{186}{\cfba}}%
\def^^bb{\chichar{187}{\cfbb}}%
\def^^bc{\chichar{188}{\cfbc}}%
\def^^bd{\chichar{189}{\cfbd}}%
\def^^be{\chichar{190}{\cfbe}}%
\def^^bf{\chichar{191}{\cfbf}}%
\def^^c0{\chichar{192}{\cfcA}}%
\def^^c1{\chichar{193}{\cfcB}}%
\def^^c2{\chichar{194}{\cfcC}}%
\def^^c3{\chichar{195}{\cfcD}}%
\def^^c4{\chichar{196}{\cfcE}}%
\def^^c5{\chichar{197}{\cfcF}}%
\def^^c6{\chichar{198}{\cfcG}}%
\def^^c7{\chichar{199}{\cfcH}}%
\def^^c8{\chichar{200}{\cfcI}}%
\def^^c9{\chichar{201}{\cfcJ}}%
\def^^ca{\chichar{202}{\cfca}}%
\def^^cb{\chichar{203}{\cfcb}}%
\def^^cc{\chichar{204}{\cfcc}}%
\def^^cd{\chichar{205}{\cfcd}}%
\def^^ce{\chichar{206}{\cfce}}%
\def^^cf{\chichar{207}{\cfcf}}%
\def^^d0{\chichar{208}{\cfdA}}%
\def^^d1{\chichar{209}{\cfdB}}%
\def^^d2{\chichar{210}{\cfdC}}%
\def^^d3{\chichar{211}{\cfdD}}%
\def^^d4{\chichar{212}{\cfdE}}%
\def^^d5{\chichar{213}{\cfdF}}%
\def^^d6{\chichar{214}{\cfdG}}%
\def^^d7{\chichar{215}{\cfdH}}%
\def^^d8{\chichar{216}{\cfdI}}%
\def^^d9{\chichar{217}{\cfdJ}}%
\def^^da{\chichar{218}{\cfda}}%
\def^^db{\chichar{219}{\cfdb}}%
\def^^dc{\chichar{220}{\cfdc}}%
\def^^dd{\chichar{221}{\cfdd}}%
\def^^de{\chichar{222}{\cfde}}%
\def^^df{\chichar{223}{\cfdf}}%
\def^^e0{\chichar{224}{\cfeA}}%
\def^^e1{\chichar{225}{\cfeB}}%
\def^^e2{\chichar{226}{\cfeC}}%
\def^^e3{\chichar{227}{\cfeD}}%
\def^^e4{\chichar{228}{\cfeE}}%
\def^^e5{\chichar{229}{\cfeF}}%
\def^^e6{\chichar{230}{\cfeG}}%
\def^^e7{\chichar{231}{\cfeH}}%
\def^^e8{\chichar{232}{\cfeI}}%
\def^^e9{\chichar{233}{\cfeJ}}%
\def^^ea{\chichar{234}{\cfea}}%
\def^^eb{\chichar{235}{\cfeb}}%
\def^^ec{\chichar{236}{\cfec}}%
\def^^ed{\chichar{237}{\cfed}}%
\def^^ee{\chichar{238}{\cfee}}%
\def^^ef{\chichar{239}{\cfef}}%
\def^^f0{\chichar{240}{\cffA}}%
\def^^f1{\chichar{241}{\cffB}}%
\def^^f2{\chichar{242}{\cffC}}%
\def^^f3{\chichar{243}{\cffD}}%
\def^^f4{\chichar{244}{\cffE}}%
\def^^f5{\chichar{245}{\cffF}}%
\def^^f6{\chichar{246}{\cffG}}%
\def^^f7{\chichar{247}{\cffH}}%
\def^^f8{\chichr{248}}%
\def^^f9{\chichr{249}}%
\def^^fa{\chichr{250}}%
\def^^fb{\chichr{251}}%
\def^^fc{\chichr{252}}%
\def^^fd{\chichr{253}}%
\def^^fe{\chichr{254}}%
\def^^ff{\chichr{255}}}% that was the end of the \def for \beginchinese
% these below might be convenient to use for user-defined characters
%\def^^f9{\chichar{249}{\cffJ}}
%\def^^fa{\chichar{250}{\cffa}}
%\def^^fb{\chichar{251}{\cffb}}
%\def^^fc{\chichar{252}{\cffc}}
%\def^^fd{\chichar{253}{\cffd}}
%\def^^fe{\chichar{254}{\cffe}}
%\def^^ff{\chichar{255}{\cfff}}
\inactive % switch the active characters back off until they are needed





