summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/babel/bbplain.dtx
blob: ba2aad20de285d77d3bdd088fd8fa4578f087254 (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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
% \iffalse meta-comment
%
% Copyright 1989-2005 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of the Babel system.
% --------------------------------------
% 
% It 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 work has the LPPL maintenance status "maintained".
% 
% The Current Maintainer of this work is Johannes Braams.
% 
% The list of all files belonging to the Babel system is
% given in the file `manifest.bbl. See also `legal.bbl' for additional
% information.
% 
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
% \fi
% \CheckSum{795}
%
% \iffalse
%<*dtx>
\ProvidesFile{bbplain.dtx}
       [2004/02/19 v1.0r Babel support for plain-based formats]
%</dtx>
%
%% File `bbplain.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2004
%%           by Johannes Braams
%
%% Please report errors to: J.L. Braams
%%                          babel at braams.cistron.nl
%
%    This file is part of the babel system, it provides the source
%    code for the extra definitions needed to be able to use babel
%    with a plain-based format.
%<*filedriver>
\documentclass{ltxdoc}
\font\manual=logo10 % font used for the METAFONT logo, etc.
\newcommand*\MF{{\manual META}\-{\manual FONT}}
\newcommand*{\babel}{\textsf{babel}}
\newcommand*{\langvar}{$\langle \it lang \rangle$}
\newcommand*{\note}[1]{}
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\Lopt}[1]{\textsf{#1}}
\newcommand*{\file}[1]{\texttt{#1}}
\begin{document}
 \DocInput{bbplain.dtx}
\end{document}
%</filedriver>
% \fi
%
% \GetFileInfo{bbplain.dtx}
% \StopEventually{}
% \changes{bbplain-1.0n}{1998/06/08}{Added the source for the format
%    wrapper files} 
%
%  \section{Not renaming \file{hyphen.tex}}
%    As Don Knuth has declared that the filename \file{hyphen.tex} may
%    only be used to designate \emph{his} version of the american
%    English hyphenation patterns, a new solution has to be found in
%    order to be able to load hyphenation patterns for other languages
%    in a plain-based \TeX-format. 
%    When asked he responded:
%    \begin{quote}
%      That file name is "sacred", and if anybody changes it they will
%      cause severe upward/downward compatibility headaches.
%
%      People can have a file localhyphen.tex or whatever they like,
%      but they mustn't diddle with hyphen.tex (or plain.tex except to
%      preload additional fonts). 
%    \end{quote}
%
%    The files \file{bplain.tex} and \file{blplain.tex} can be used as
%    replacement wrappers around \file{plain.tex} and
%    \file{lplain.tex} to acheive the desired effect, based on the
%    \pkg{babel} package. If you load each of them with ini\TeX, you
%    will get a file called either \file{bplain.fmt} or
%    \file{blplain.fmt}, which you can use as replacements for
%    \file{plain.fmt} and \file{lplain.fmt}.
%
%    As these files are going to be read as the first thing ini\TeX\
%    sees, we need to set some category codes just to be able to
%    change the definition of |\input|
%    \begin{macrocode}
%<*bplain|blplain>
\catcode`\{=1 % left brace is begin-group character
\catcode`\}=2 % right brace is end-group character
\catcode`\#=6 % hash mark is macro parameter character
%    \end{macrocode}
%    Now let's see if a file called \file{hyphen.cfg} can be found
%    somewhere on \TeX's input path by trying to open it for
%    reading... 
%    \begin{macrocode}
\openin 0 hyphen.cfg
%    \end{macrocode}
%    If the file wasn't found the following test turns out true.
%    \begin{macrocode}
\ifeof0
\else
%    \end{macrocode}
%    When \file{hyphen.cfg} could be opened we make sure that
%    \emph{it} will be read instead of the file \file{hyphen.tex}
%    which should (according to Don Knuth's ruling) contain the
%    american English hyphenation patterns and nothing else.
%
%    We do this by first saving the original meaning of |\input| (and
%    I use a one letter control sequence for that so as not to waste
%    multi-letter control sequence on this in the format).
%    \begin{macrocode}
  \let\a\input
%    \end{macrocode}
%    Then |\input| is defined to forget about its argument and load
%    \file{hyphen.cfg} instead.
%    \begin{macrocode}
  \def\input #1 {%
    \let\input\a
    \a hyphen.cfg
%    \end{macrocode}
%    Once that's done the original meaning of |\input| can be restored
%    and the definition of |\a| can be forgotten.
%    \begin{macrocode}
    \let\a\undefined
  }
\fi
%</bplain|blplain>
%    \end{macrocode}
%    Now that we have made sure that \file{hyphen.cfg} will be loaded
%    at the right moment it is time to load \file{plain.tex}.
%    \begin{macrocode}
%<bplain>\a plain.tex
%<blplain>\a lplain.tex
%    \end{macrocode}
%    Finally we change the contents of |\fmtname| to indicate that
%    this is \emph{not} the plain format, but a format based on plain
%    with the \pkg{babel} package preloaded.
%    \begin{macrocode}
%<bplain>\def\fmtname{babel-plain}
%<blplain>\def\fmtname{babel-lplain}
%    \end{macrocode}
%
%    When you are using a different format, based on plain.tex you can
%    make a copy of blplain.tex, rename it and replace \file{plain.tex}
%    with the name of your format file.
%
%  \section{Support for formats based on \textsc{plain}\TeX}
%
%    The following code duplicates or emulates parts of \LaTeXe\ that
%    are needed for \babel.
%
% \changes{bbplain-1.0f}{1996/07/09}{Consistently use \cs{@undefined}
%    instead of \cs{undefined}} 
% \changes{bbplain-1.0f}{1996/07/09}{added \cs{@empty}}
% \changes{bbplain-1.0h}{1996/10/07}{Only load the necessary parts
%    into the format, let this file be read agian by babel.def} 
%    \begin{macrocode}
%<*code>
\ifx\adddialect\@undefined
%    \end{macrocode}
%    When |\adddialect| is still undefined we are making a
%    format. In that case only the first part of this file is needed. 
%    \begin{macrocode}
  \def\@empty{}
%    \end{macrocode}
%    We need to define |\loadlocalcfg| for plain users as the
%    \LaTeX\ definition uses |\InputIfFileExists|.
% \changes{bbplain-1.0c}{1995/07/26}{Added definition of
%    \cs{loadlocalcfg}}
% \changes{bbplain-1.0d}{1996/01/08}{Also reset category codes after
%    loading the configuration file as \cs{AtEndOfPackage} is
%    undefined in this case} 
%    \begin{macrocode}
  \def\loadlocalcfg#1{%
    \openin0#1.cfg
    \ifeof0
      \closein0
    \else
      \closein0
      {\immediate\write16{*************************************}%
       \immediate\write16{* Local config file #1.cfg used}%
       \immediate\write16{*}%
       }
      \input #1.cfg\relax
    \fi
%    \end{macrocode}
%    We have to execute \cs{@endofldf} in this case
%    \begin{macrocode}
    \@endofldf
    }
%    \end{macrocode}
%
% \changes{bbplain-1.0c}{1995/11/08}{Moved the \cs{dump} code here from
%    \file{babel.dtx}}
%
% \changes{bbplain-0.1}{1991/10/31}{Added redefinition of \cs{dump} to
%    add a message to \cs{everyjob}}
%    We want to add a message to the message \LaTeX$\:$2.09 puts in
%    the |\everyjob| register. This could be done by the following
%    code: 
%    \begin{verbatim}
%    \let\orgeveryjob\everyjob
%    \def\everyjob#1{%
%      \orgeveryjob{#1}%
%      \orgeveryjob\expandafter{\the\orgeveryjob\immediate\write16{%
%          hyphenation patterns for \the\loaded@patterns loaded.}}%
%      \let\everyjob\orgeveryjob\let\orgeveryjob\@undefined}
%    \end{verbatim}
%    The code above redefines the control sequence \cs{everyjob}
%    in order to be able to add something to the current contents of
%    the register. This is necessary because the processing of
%    hyphenation patterns happens long before \LaTeX\ fills the
%    register.\\
%    There are some problems with this approach though.
%  \begin{itemize}
%    \item When someone wants to use several hyphenation patterns with
%    \SliTeX\ the above scheme won't work. The reason is that \SliTeX\
%    overwrites the contents of the |\everyjob| register with its own
%    message.
%    \item Plain \TeX\ does not use the |\everyjob| register so the
%    message would not be displayed.
%  \end{itemize}
%    To circumvent this a `dirty trick' can be used. As this code is
%    only processed when creating a new format file there is one
%    command that is sure to be used, |\dump|. Therefore the original
%    |\dump| is saved in |\org@dump| and a new definition is supplied.
%    \begin{macrocode}
  \let\orig@dump=\dump
  \def\dump{%
%    \end{macrocode}
%    To make sure that \LaTeX$\:$2.09 executes the
%    |\@begindocumenthook| we would want to alter |\begin{document}|,
%    but as this done too often already, we add the new code at the
%    front of |\@preamblecmds|. But we can only do that after it has
%    been defined, so we add this piece of code to |\dump|.
% \changes{bbplain-1.0c}{1995/11/19}{Add execution of
%    \cs{@begindocumenthook} to \cs{@preamblecmds}} 
% \changes{bbplain-1.0i}{1997/01/02}{\cs{document} is not a
%    \LaTeX2.09-only command; AMS\TeX defines it too; now use
%    \cs{@ztryfc} to detect \LaTeX2.09} 
% \changes{bbplain-1.0j}{1997/01/07}{Add the definition of
%    \cs{@begindocumenthook} to the \LaTeX2.09 format} 
%    \begin{macrocode}
    \ifx\@ztryfc\@undefined
    \else
      \toks0=\expandafter{\@preamblecmds}
      \edef\@preamblecmds{\noexpand\@begindocumenthook\the\toks0}
      \def\@begindocumenthook{}
    \fi
%    \end{macrocode}
%    This new definition starts by adding an instruction to write a
%    message on the terminal and in the transcript file to inform the
%    user of the preloaded hyphenation patterns.
% \changes{bbplain-1.0f}{1996/07/09}{Use \cs{toks8} instead of
%    \cs{patterns@loaded}} 
%    \begin{macrocode}
    \everyjob\expandafter{\the\everyjob%
      \immediate\write16{\the\toks8 loaded.}}%
%    \end{macrocode}
%    Then everything is restored to the old situation and the format
%    is dumped.
%    \begin{macrocode}
    \let\dump\orig@dump\let\orig@dump\@undefined\dump}
  \expandafter\endinput
\fi
%    \end{macrocode}
%    The rest of this file is not processed by ini\TeX\ but during the
%    normal document run.
%    A number of \LaTeX\ macro's that are needed later on.
% \changes{bbplain-1.0n}{1998/06/10}{Added \cs{@secondoftwo}}
% \changes{bbplain-1.0q}{1999/09/16}{Added \cs{@ifundefined}}
%    \begin{macrocode}
\long\def\@firstofone#1{#1}
\long\def\@firstoftwo#1#2{#1}
\long\def\@secondoftwo#1#2{#2}
\def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
\def\@star@or@long#1{%
  \@ifstar
  {\let\l@ngrel@x\relax#1}%
  {\let\l@ngrel@x\long#1}}
\let\l@ngrel@x\relax
\def\@car#1#2\@nil{#1}
\def\@cdr#1#2\@nil{#2}
\let\@typeset@protect\relax
\long\def\@gobble#1{}
\edef\@backslashchar{\expandafter\@gobble\string\\}
\def\strip@prefix#1>{}
\def\g@addto@macro#1#2{{%
    \toks@\expandafter{#1#2}%
    \xdef#1{\the\toks@}}}
\def\@namedef#1{\expandafter\def\csname #1\endcsname}
\def\@ifundefined#1{%
  \expandafter\ifx\csname#1\endcsname\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
%    \end{macrocode}
%    \LaTeXe\ has the command |\@onlypreamble| which adds commands to
%    a list of commands that are no longer needed after
%    |\begin{document}|.
%    \begin{macrocode}
\ifx\@preamblecmds\@undefined
  \def\@preamblecmds{}
\fi
\def\@onlypreamble#1{%
  \expandafter\gdef\expandafter\@preamblecmds\expandafter{%
    \@preamblecmds\do#1}}
\@onlypreamble\@onlypreamble
%    \end{macrocode}
%    Mimick \LaTeX's |\AtBeginDocument|; for this to work the user
%    needs to add |\begindocument| to his file.
%    \begin{macrocode}
\def\begindocument{%
  \@begindocumenthook
  \global\let\@begindocumenthook\@undefined
  \def\do##1{\global\let ##1\@undefined}%
  \@preamblecmds
  \global\let\do\noexpand
  }
%    \end{macrocode}
%    
% \changes{bbplain-1.0j}{1997/01/07}{\cs{@begindocumenthook} might
%    already be defined} 
% \changes{bbplain-1.0k}{1997/01/14}{missing \cs{@undefined} added}
%    \begin{macrocode}
\ifx\@begindocumenthook\@undefined
  \def\@begindocumenthook{}
\fi
\@onlypreamble\@begindocumenthook
\def\AtBeginDocument{\g@addto@macro\@begindocumenthook}
%    \end{macrocode}
%    We also have to mimick \LaTeX's |\AtEndOfPackage|. Our
%    replacement macro is much simpler; it stores its argument in
%    |\@endofldf|.
%    \begin{macrocode}
\def\AtEndOfPackage#1{\g@addto@macro\@endofldf{#1}}
\@onlypreamble\AtEndOfPackage
\def\@endofldf{}
\@onlypreamble\@endofldf
%    \end{macrocode}
%    \LaTeX\ needs to be able to switch off writing to its auxiliary
%    files; plain doesn't have them by default.
%  \changes{bbplain-1.0m}{1997/04/28}{Set \cs{if@filesw} to 
%    \cs{iffalse} only for plain \TeX}
% \changes{bbplain-1.0n}{1997/09/11}{Repaired typo and added missing
%    \cs{endcsname}}
%    \begin{macrocode}
\ifx\if@filesw\@undefined
  \expandafter\let\csname if@filesw\expandafter\endcsname
    \csname iffalse\endcsname
\fi
%    \end{macrocode}
%    Mimick \LaTeX's commands to define control sequences.
% \changes{bbplain-1.0e}{1996/02/22}{Provide a more complete emulation
%    of \cs{DeclareRobustCommand} and \cs{newcommand}} 
%    \begin{macrocode}
\def\newcommand{\@star@or@long\new@command}
\def\new@command#1{%
  \@testopt{\@newcommand#1}0}
\def\@newcommand#1[#2]{%
  \@ifnextchar [{\@xargdef#1[#2]}%
                {\@argdef#1[#2]}}
\long\def\@argdef#1[#2]#3{%
  \@yargdef#1\@ne{#2}{#3}}
\long\def\@xargdef#1[#2][#3]#4{%
  \expandafter\def\expandafter#1\expandafter{%
    \expandafter\@protected@testopt\expandafter #1%
    \csname\string#1\expandafter\endcsname{#3}}%
  \expandafter\@yargdef \csname\string#1\endcsname
  \tw@{#2}{#4}}
\long\def\@yargdef#1#2#3{%
  \@tempcnta#3\relax
  \advance \@tempcnta \@ne
  \let\@hash@\relax
  \edef\reserved@a{\ifx#2\tw@ [\@hash@1]\fi}%
  \@tempcntb #2%
  \@whilenum\@tempcntb <\@tempcnta
  \do{%
    \edef\reserved@a{\reserved@a\@hash@\the\@tempcntb}%
    \advance\@tempcntb \@ne}%
  \let\@hash@##%
  \l@ngrel@x\expandafter\def\expandafter#1\reserved@a}
\let\providecommand\newcommand
%    \end{macrocode}
%    
%    \begin{macrocode}
\def\DeclareRobustCommand{\@star@or@long\declare@robustcommand}
\def\declare@robustcommand#1{%
   \edef\reserved@a{\string#1}%
   \def\reserved@b{#1}%
   \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
   \edef#1{%
      \ifx\reserved@a\reserved@b
         \noexpand\x@protect
         \noexpand#1%
      \fi
      \noexpand\protect
      \expandafter\noexpand\csname
         \expandafter\@gobble\string#1 \endcsname
   }%
   \expandafter\new@command\csname
      \expandafter\@gobble\string#1 \endcsname
}
\def\x@protect#1{%
   \ifx\protect\@typeset@protect\else
      \@x@protect#1%
   \fi
}
\def\@x@protect#1\fi#2#3{%
   \fi\protect#1%
}
%    \end{macrocode}
%
%    The following little macro |\in@| is taken from latex.ltx; it
%    checks whether its first argument is part of its second
%    argument. It uses the boolean |\in@|; allocating a new boolean
%    inside conditionally executed code is not possible, hence the
%    construct with the temporary definition of |\bbl@tempa|.
% \changes{bbplain-1.0o}{1998/07/02}{Added definition of \cs{in@}}
%    \begin{macrocode}
\def\bbl@tmpa{\csname newif\endcsname\ifin@}
\ifx\in@\@undefined
  \def\in@#1#2{%
    \def\in@@##1#1##2##3\in@@{%
      \ifx\in@##2\in@false\else\in@true\fi}%
    \in@@#2#1\in@\in@@}
\else
  \let\bbl@tmpa\@empty
\fi
\bbl@tmpa
%    \end{macrocode}
%
%    \LaTeX\ has a macro to check whether a certain package was loaded
%    with specific options. The command has two extra arguments which
%    are code to be executed in either the true or false case.
%    This is used to detect whether the document needs one of the
%    accents to be activated (\Lopt{activegrave} and
%    \Lopt{activeacute}). For plain \TeX\ we assume that the user
%    wants them to be active by default. Therefore the only thing we
%    do is execute the third argument (the code for the true case).
% 
%    \begin{macrocode}
\def\@ifpackagewith#1#2#3#4{%
  #3}
%    \end{macrocode}
%    The \LaTeX\ macro |\@ifl@aded| checks whether a file was
%    loaded. This functionality is not needed for plain \TeX\ but we
%    need the macro to be defined as a no-op.
% \changes{bbplain-1.0p}{1999/04/27}{Added \cs{@ifl@aded} as a no-op}
%    \begin{macrocode}
\def\@ifl@aded#1#2#3#4{}
%    \end{macrocode}
%
% \changes{bbplain-1.0e}{1996/01/15}{Added the \cs{newcommand} code}
%    For the following code we need to make sure that the commands
%    |\newcommand| and |\providecommand| exist with some sensible
%    definition. They are not fully equivalent to their \LaTeXe\
%    versions; just enough to make things work in plain~\TeX
%    environments.
%
% \changes{bbplain-1.0k}{1997/01/14}{\cs{newcount} is an \cs{outer}
%    command, can't use it inside an \cs{if} construct} 
% \changes{bbplain-1.0l}{1997/01/19}{Mixed up the definition of 
%    \cs{@tempcntb}}
%    \begin{macrocode}
\ifx\@tempcnta\@undefined
  \csname newcount\endcsname\@tempcnta\relax
\fi
\ifx\@tempcntb\@undefined
  \csname newcount\endcsname\@tempcntb\relax
\fi
%    \end{macrocode}
%    To prevent wasting two counters in \LaTeX$\:$2.09 (because
%    counters with the same name are allocated later by it) we reset
%    the counter that holds the next free counter (|\count10|).
%    \begin{macrocode}
\ifx\bye\@undefined
 \advance\count10 by -2\relax
\fi
\ifx\@ifnextchar\@undefined
  \def\@ifnextchar#1#2#3{%
    \let\reserved@d=#1%
    \def\reserved@a{#2}\def\reserved@b{#3}%
    \futurelet\@let@token\@ifnch}
  \def\@ifnch{%
    \ifx\@let@token\@sptoken
      \let\reserved@c\@xifnch
    \else
      \ifx\@let@token\reserved@d
        \let\reserved@c\reserved@a
      \else
        \let\reserved@c\reserved@b
      \fi
    \fi
    \reserved@c}
  \def\:{\let\@sptoken= } \:  % this makes \@sptoken a space token
  \def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
\fi
\def\@testopt#1#2{%
  \@ifnextchar[{#1}{#1[#2]}}
\def\@protected@testopt#1{%%
  \ifx\protect\@typeset@protect
    \expandafter\@testopt
  \else
    \@x@protect#1%
  \fi}
\long\def\@whilenum#1\do #2{\ifnum #1\relax #2\relax\@iwhilenum{#1\relax
     #2\relax}\fi}
\long\def\@iwhilenum#1{\ifnum #1\expandafter\@iwhilenum
         \else\expandafter\@gobble\fi{#1}}
%    \end{macrocode}
%    Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
%    environment. 
%    \begin{macrocode}
\def\DeclareTextCommand{%
   \@dec@text@cmd\providecommand
}
\def\ProvideTextCommand{%
   \@dec@text@cmd\providecommand
}
\def\DeclareTextSymbol#1#2#3{%
   \@dec@text@cmd\chardef#1{#2}#3\relax
}
\def\@dec@text@cmd#1#2#3{%
   \expandafter\def\expandafter#2%
      \expandafter{%
         \csname#3-cmd\expandafter\endcsname
         \expandafter#2%
         \csname#3\string#2\endcsname
      }%
%   \let\@ifdefinable\@rc@ifdefinable
   \expandafter#1\csname#3\string#2\endcsname
}
\def\@current@cmd#1{%
  \ifx\protect\@typeset@protect\else
      \noexpand#1\expandafter\@gobble
  \fi
}
\def\@changed@cmd#1#2{%
   \ifx\protect\@typeset@protect
      \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
         \expandafter\ifx\csname ?\string#1\endcsname\relax
            \expandafter\def\csname ?\string#1\endcsname{%
               \@changed@x@err{#1}%
            }%
         \fi
         \global\expandafter\let
           \csname\cf@encoding \string#1\expandafter\endcsname
           \csname ?\string#1\endcsname
      \fi
      \csname\cf@encoding\string#1%
        \expandafter\endcsname
   \else
      \noexpand#1%
   \fi
}
\def\@changed@x@err#1{%
    \errhelp{Your command will be ignored, type <return> to proceed}%
    \errmessage{Command \protect#1 undefined in encoding \cf@encoding}}
\def\DeclareTextCommandDefault#1{%
   \DeclareTextCommand#1?%
}
\def\ProvideTextCommandDefault#1{%
   \ProvideTextCommand#1?%
}
\expandafter\let\csname OT1-cmd\endcsname\@current@cmd
\expandafter\let\csname?-cmd\endcsname\@changed@cmd
\def\DeclareTextAccent#1#2#3{%
  \DeclareTextCommand#1{#2}[1]{\accent#3 ##1}
}
\def\DeclareTextCompositeCommand#1#2#3#4{%
   \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
   \edef\reserved@b{\string##1}%
   \edef\reserved@c{%
     \expandafter\@strip@args\meaning\reserved@a:-\@strip@args}%
   \ifx\reserved@b\reserved@c
      \expandafter\expandafter\expandafter\ifx
         \expandafter\@car\reserved@a\relax\relax\@nil
         \@text@composite
      \else
         \edef\reserved@b##1{%
            \def\expandafter\noexpand
               \csname#2\string#1\endcsname####1{%
               \noexpand\@text@composite
                  \expandafter\noexpand\csname#2\string#1\endcsname
                  ####1\noexpand\@empty\noexpand\@text@composite
                  {##1}%
            }%
         }%
         \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
      \fi
      \expandafter\def\csname\expandafter\string\csname
         #2\endcsname\string#1-\string#3\endcsname{#4}
   \else
     \errhelp{Your command will be ignored, type <return> to proceed}%
     \errmessage{\string\DeclareTextCompositeCommand\space used on
         inappropriate command \protect#1}
   \fi
}
\def\@text@composite#1#2#3\@text@composite{%
   \expandafter\@text@composite@x
      \csname\string#1-\string#2\endcsname
}
\def\@text@composite@x#1#2{%
   \ifx#1\relax
      #2%
   \else
      #1%
   \fi
}
%
\def\@strip@args#1:#2-#3\@strip@args{#2}
\def\DeclareTextComposite#1#2#3#4{%
   \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
   \bgroup
      \lccode`\@=#4%
      \lowercase{%
   \egroup
      \reserved@a @%
   }%
}
%
\def\UseTextSymbol#1#2{%
%   \let\@curr@enc\cf@encoding
%   \@use@text@encoding{#1}%
   #2%
%   \@use@text@encoding\@curr@enc
}
\def\UseTextAccent#1#2#3{%
%   \let\@curr@enc\cf@encoding
%   \@use@text@encoding{#1}%
%   #2{\@use@text@encoding\@curr@enc\selectfont#3}%
%   \@use@text@encoding\@curr@enc
}
\def\@use@text@encoding#1{%
%   \edef\f@encoding{#1}%
%   \xdef\font@name{%
%      \csname\curr@fontshape/\f@size\endcsname
%   }%
%   \pickup@font
%   \font@name
%   \@@enc@update
}
\def\DeclareTextSymbolDefault#1#2{%
   \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}%
}
\def\DeclareTextAccentDefault#1#2{%
   \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}%
}
\def\cf@encoding{OT1}
%    \end{macrocode}
%    Currently we only use the \LaTeXe\ method for accents for those
%    that are known to be made active in \emph{some} language
%    definition file.
%    \begin{macrocode}
\DeclareTextAccent{\"}{OT1}{127}
\DeclareTextAccent{\'}{OT1}{19}
\DeclareTextAccent{\^}{OT1}{94}
\DeclareTextAccent{\`}{OT1}{18}
\DeclareTextAccent{\~}{OT1}{126}
%    \end{macrocode}
%    The following control sequences are used in \file{babel.def}
%    but are not defined for \textsc{plain} \TeX.
% \changes{bbplain-1.0f}{1996/07/10}{Added \cs{textquotedblright} and
%    \cs{textquoteright}} 
% \changes{bbplain-1.0g}{1996/08/15}{Added \cs{ss} and \cs{i}}
% \changes{bbplain-1.0r}{2000/10/02}{Added \cs{textquotedblleft} and
%    \cs{textquoteleft}} 
%    \begin{macrocode}
\DeclareTextSymbol{\textquotedblleft}{OT1}{92}
\DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
\DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
\DeclareTextSymbol{\textquoteright}{OT1}{`\'}
\DeclareTextSymbol{\i}{OT1}{16}
\DeclareTextSymbol{\ss}{OT1}{25}
%    \end{macrocode}
%    For a couple of languages we need the \LaTeX-control sequence
%    |\scriptsize| to be available. Because plain \TeX\ doesn't have
%    such a sofisticated font mechanism as \LaTeX\ has, we just |\let|
%    it to |\sevenrm|.
% \changes{bbplain-1.0f}{1996/07/10}{Added definition of
%    \cs{scriptsize}} 
%    \begin{macrocode}
\ifx\scriptsize\@undefined
  \let\scriptsize\sevenrm
\fi
%</code>
%    \end{macrocode}
%
\endinput
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}