summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/t2/cyrplain/plainenc.tex
blob: f94590490fedf51c72bb8f70847d853f192d5d73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
% This is the file plainenc.tex of the T2 package.
% Copyright 1997-1999, 2003 Werner Lemberg, Vladimir Volovich
%  and any individual authors listed elsewhere in package files.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This file defines some commands for Plain TeX, so that it is able to
% read (and interpret accordingly) some LaTeX files (unchanged), such as
% inputenc.sty, font encoding definition files (lcyenc.def, t2aenc.def,
% t1enc.def, etc.), and various input encoding definition files
% (koi8-r.def, latin1.def, etc.).
%
% These definitions are the `minimal' possible.  Probably, some
% extensions will be needed.

%\ProvidesFile{plainenc.tex}[1999/12/15 v0.1 inputenc support for Plain TeX]
\ifx\inputencoding\undefined\else\expandafter\endinput\fi
\chardef\atcatcode=\catcode`\@ \catcode`\@=11

% load definitions from BABEL's plain.def (\adddialect should now be defined)
\ifx\adddialect\undefined\let\adddialect\relax\let\protect\relax\fi
\input plain.def

\def\NeedsTeXFormat#1[#2]{}
\def\ProvidesFile#1{%
  \begingroup
    \catcode`\ 10 %
    \@ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}}
\def\@providesfile#1[#2]{%
    \wlog{File: #1 #2}%
    \expandafter\xdef\csname ver@#1\endcsname{#2}%
  \endgroup}
\let\ProvidesPackage\ProvidesFile % better than #1[#2] -> {}
%\def\DeclareOption#1#2{\def\@OptionBody{#2}}
%\def\ProcessOptions{\@OptionBody}
\def\DeclareOption#1#2{}
\def\ProcessOptions{}
\newlinechar`\^^J
\def\MessageBreak{^^J}

\let\@empty\empty
\long\def\@gobbletwo#1#2{}
\let\@inmathwarn\@gobble

\def\PackageWarning#1#2{\immediate\write16{^^JPackage #1 Warning: #2\on@line.^^J}}
\def\PackageWarningNoLine#1#2{\PackageWarning{#1}{#2\@gobble}}
\def\on@line{ on input line \the\inputlineno}
\def\PackageError#1#2#3{\begingroup\let\protect\string
  \errmessage{Package #1 Error: #2.^^J}\endgroup}
\def\@latex@error#1{\PackageError{plainenc}{#1}{}}
\def\@latex@info#1{\wlog{Info: #1}}

\def\DeclareFontEncoding#1#2#3{%
  \expandafter\let\csname#1-cmd\endcsname\@current@cmd
% \expandafter\let\csname#1-tmcmd\endcsname\@current@tmcmd
  \def\LastDeclaredEncoding{#1}}
% special math setup is unneeded if only one font encoding is used
\def\@current@cmd#1{%
   \ifx\protect\@typeset@protect
   \else
      \noexpand#1\expandafter\@gobble
   \fi}
\def\DeclareFontSubstitution#1#2#3#4{}
\def\DeclareErrorFont#1#2#3#4#5{}
\def\DeclareSymbolFont#1#2#3#4#5{}
\def\SetSymbolFont#1#2#3#4#5#6{}
\def\DeclareSymbolFontAlphabet#1#2{}
\def\DeclareMathAlphabet#1#2#3#4#5{}
\def\SetMathAlphabet#1#2#3#4#5#6{}
\def\DeclareMathSymbol#1#2#3#4{% simplified definition
 \count@=#4 \advance\count@ "7000 \mathchardef#1\count@}

\def\@unexpandable@protect{\noexpand\protect\noexpand}
%\let\protect\@typeset@protect

\def\protected@edef{%
   \let\@@protect\protect
   \let\protect\@unexpandable@protect
   \afterassignment\restore@protect
   \@edef}
\def\protected@xdef{%
   \let\@@protect\protect
   \let\protect\@unexpandable@protect
   \afterassignment\restore@protect
   \@xdef}
\def\restore@protect{\let\protect\@@protect}

\let\@edef\edef
\let\@xdef\xdef

% redefine \input to be compatible with LaTeX (for inputenc.sty)
\ifx\@@input\@undefined\let\@@input\input\fi
\def\input{\@ifnextchar\bgroup\@iinput\@@input}
\def\@iinput#1{\@@input#1 } % This is a simplified definition

% this is used in cyrillic encoding definition files
\def\@ifundefined#1{%
  \expandafter\ifx\csname#1\endcsname\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\long\def\@secondoftwo#1#2{#2}

% support for uppercase/lowercase
\let\@uppercase\uppercase
\let\@lowercase\lowercase
\newtoks\@uclctoks
\DeclareRobustCommand\uppercas@{\afterassignment\upperc@se\@uclctoks}
\DeclareRobustCommand\lowercas@{\afterassignment\lowerc@se\@uclctoks}
\def\upperc@se{{%
  \def\i{I}\def\j{J}%
  \def\reserved@a##1##2{\let##1##2\reserved@a}%
  \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
  \protected@edef\reserved@a{\@uppercase\expandafter{\the\@uclctoks}}%
  \reserved@a}}
\def\lowerc@se{{%
  \def\reserved@a##1##2{\let##2##1\reserved@a}%
  \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
  \protected@edef\reserved@a{\@lowercase\expandafter{\the\@uclctoks}}%
  \reserved@a}}
\def\@uclclist{\oe\OE\o\O\ae\AE\dh\DH\dj\DJ\l\L\ng\NG\ss\SS\th\TH
\cyra\CYRA\cyrabhch\CYRABHCH\cy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SN
\cyrsftsn\CYRSFTSN\cyrsh\CYRSH\cyrshch\CYRSHCH\cyrshha\CYRSHHA
\cyrt\CYRT\cyrtdsc\CYRTDSC\cyrtetse\CYRTETSE\cyrtshe\CYRTSHE
\cyru\CYRU\cyrushrt\CYRUSHRT\cyrv\CYRV\cyrw\CYRW\cyry\CYRY
\cyrya\CYRYA\cyryat\CYRYAT\cyryhcrs\CYRYHCRS\cyryi\CYRYI\cyryo
\CYRYO\cyryu\CYRYU\cyrz\CYRZ\cyrzdsc\CYRZDSC\cyrzh\CYRZH
\cyrzhdsc\CYRZHDSC}
\def\PROTECT{%
  \let\uppercase\uppercas@\let\lowercase\lowercas@
  \let\edef\protected@edef\let\xdef\protected@xdef}
\def\UNPROTECT{%
  \let\uppercase\@uppercase\let\lowercase\@lowercase
  \let\edef\@edef\let\xdef\@xdef}
\PROTECT

\let\org@write\write
\let\org@immediate\immediate
\DeclareRobustCommand\write{\afterassignment\write@a\count@}
\def\immediate#1{\ifx#1\write\def\immediate@{\org@immediate}\fi\org@immediate#1}
\let\immediate@\@empty
\long\def\write@a#1{%
  \begingroup
    \let\thepage\relax
    \let\protect\@unexpandable@protect
%   \@edef\reserved@a{\expandafter\noexpand\immediate@\org@write\the\count@{#1}}%
%   \reserved@a
    \immediate@\org@write\the\count@{#1}%
  \endgroup
  \let\immediate@\@empty}

% make handling of protected commands within whatsits correct:
\let\org@shipout\shipout
\def\shipout#1#2{\begingroup\setbox0=#1{#2}\let\protect\noexpand\org@shipout\box0\endgroup}

% avoid problems in references with russian letters (e.g. in Texinfo)
% (experimental code):
%\def\DeclareTextSymbol#1#2#3{%
%   \@dec@text@cmd\chardef@hack#1{#2}#3\relax
%}
%\def\chardef@hack#1#2{%
%  \bgroup
%    \lccode`\0=#2
%    \lowercase{
%  \egroup
%    \let#1=0
%    }
%  \show#1
%}

% for inputenc files
\def\makeatletter{\catcode`\@11\relax}
\def\makeatother{\catcode`\@12\relax}

\ifx\Orb\undefined
  \message{^^J* Please get newer version of plain.tex from^^J%
  * CTAN:systems/knuth/lib/plain.tex^^J* Aborting.^^J^^J}\end
\fi
\def\textcircled#1{{\ooalign{\hfil\raise.07ex\hbox{#1}\hfil\crcr\Orb}}}
%\let\textlatin\rm

\def\fontencoding#1{\makeatletter
  \UNPROTECT % \lowercase for \DeclareTextComposite
  \@lowercase{\input{#1enc.def}}%
  \PROTECT
  \@edef\cf@encoding{\@uppercase{\def\noexpand\cf@encoding{#1}}}%
  \cf@encoding
  \makeatother}
\input inputenc.sty
\let\org@inputencoding\inputencoding
\def\inputencoding#1{\UNPROTECT % \uppercase, \edef
  \org@inputencoding{#1}%
  \PROTECT}

% definitions of some LaTeX macros used in enc.def and .def files
\def\sh@ft#1{\dimen@.00#1ex\multiply\dimen@\fontdimen1\font\kern-.0156\dimen@}
\chardef\@xxxii=32
\def\hb@xt@{\hbox to}
\def\@tabacckludge#1{\expandafter\@changed@cmd
  \csname\string#1\endcsname\relax}
\DeclareRobustCommand{\ensuremath}{%
  \ifmmode
    \expandafter\@firstofone
  \else
    \expandafter\@ensuredmath
  \fi}
\long\def\@ensuredmath#1{$\relax#1$}
\def\TextSymbolUnavailable#1{\@latex@error{%
  Command \protect#1 unavailable in encoding \cf@encoding}}
\def\textbullet{{\tensy\char15}}
\def\textperiodcentered{{\tensy\char1}}
%\font\tensmc=cmcsc10
%\DeclareTextCommandDefault{\textregistered}{\textcircled{\tensmc r}}
\DeclareTextCommandDefault{\texttrademark}{\textsuperscript{TM}}
\DeclareTextCommandDefault{\SS}{SS}
\DeclareTextCommandDefault{\textordfeminine}{\textsuperscript{a}}
\DeclareTextCommandDefault{\textordmasculine}{\textsuperscript{o}}
\DeclareRobustCommand*\textsuperscript[1]{%
  {\m@th\ensuremath{^{\hbox{\sevenrm#1}}}}}
\DeclareRobustCommand{\nobreakspace}{\leavevmode\nobreak\ }
%\DeclareRobustCommand{\pounds}{%
%   \ifmmode\mathsterling\else\textsterling\fi}
%\def\mathsterling{\mathit{\mathchar"7024}}
%\def\mathit#1{{\it#1}}
\def\frac#1#2{{\begingroup#1\endgroup\over#2}}
\def\@height{height} \def\@depth{depth} \def\@width{width}
\def\hmode@bgroup{\leavevmode\bgroup}

% a helper command
\def\makerobust#1{\expandafter\let\csname\expandafter
  \@gobble\string#1 \endcsname#1%
  \@edef#1{\noexpand\protect\expandafter\noexpand\csname\expandafter
  \@gobble\string#1 \endcsname}}

\catcode`\@=\atcatcode \let\atcatcode\undefined

\endinput