summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/mex/base/mex1.tex
blob: 77989347ae42ff40c415c7eb159400ea9f87f9a9 (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
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
% This is MEX1.TEX - a part of the Polish plain TeX and LaTeX formats.
% Version 1.05,  18 December 1993
%
% Authors: Marek Ry\'cko & Bogus\l{}aw Jackowski
%
% This macro file belongs to the public domain
% under the conditions specified by the author of TeX:
%
%   ``Macro files like PLAIN.TEX should not be changed in any way,
%     except with respect to preloaded fonts,
%     unless the changes are authorized by the authors of the macros.''
%
%                                           Donald E. Knuth
%
% For details see MEXINFO.ENG or MEXINFO.POL.
%
% INITIAL ASSIGNMENTS:
\catcode`\#=6 % hash mark is macro parameter character
\catcode`\^=7 % circumflex is for superscripts (and for the next line)
\catcode`\^^I=10 % ascii tab is a blank space
\chardef\active=13 \catcode`\~=\active % tilde is active
\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is `\outer\par'
\catcode`@=11 % @ is temporarily a letter

\message{polish auxiliary macros,}
% not available for user

% macros for making operations on sequences:

\def\m@pone%
    #1% one-argument operation (applicable to hexadecimal numbers)
%   #2% a macro of the form `\do A\do C ...'
    {%
    \def\do##1{#1{\P@lcd{##1}}}%
%   #2% execute
    }
\def\m@ptwo%
    #1% two-argument operation (applicable to hexadecimal numbers)
%   #2% a macro of the form `\do Aa\do Cc ...'
    {%
    \def\do##1##2%
        {#1{\P@lcd{##1}}{\P@lcd{##2}}}%
%   #2% execute
    }

% operations on character codes and on pairs of char. codes:
\def\l@t% make letter a character
    #1%
    {\catcode`#1=11 }
\def\@th% make other a character
    #1%
    {\catcode`#1=12 }
\def\@ct% make active a character
    #1%
    {\catcode`#1=\active}

\def\mkl@t% make letter
    #1%
    {\catcode"#1=11 }

\def\P@lsf% space factor of capital letters
    #1%
    {\sfcode"#1=999 }
\def\P@lcase
    #1% UC letter code
    #2% lc letter code
    {\uccode"#1="#1
    \lccode"#2="#2
    \uccode"#2="#1
    \lccode"#1="#2 }
\def\P@lm
    #1% polish character code like 86
    {%
    \mathcode"#1="71#1 %  e.g., \mathcode"86="7186
    }

% prepare reading the `font encoding' of the polish characters:

% the primary meanings of the macros \@Pl and \@qq:

% macro \@Pl for defining the encoding of polish characters:
% syntax & semantics, e.g.:
% \@Pl a a1
%   define a category code of ^^a1 as `letter',
%   define the token /a as a macro expanding to the letter ^^a1,
%   define the token /aa as a macro expanding to uppercase hexadecimal A1

\@th\/% / is of category "other"
\l@t\^^00% character of the code 0 is a letter
\def\prim@Pl% Polish letter encoding
    #1 % letter (e.g., a)
    #2 % hex code (UC or lc) of a polish letter
    {%
    % during the execution of this definition
    % all the codes of `a' and `A' must be `normal'
    \def\defineone{\expandafter\def\csname/#1\endcsname}%
    \def\definetwo{\expandafter\def\csname/#1#1\endcsname}%
        % auxiliary macros for defining something later
        % in the `\uppercase' environment such that #1
        % is not converted to the uppercase
    \uppercase{\def\H@x{#2}}%
    \uppercase{\uccode`\a"#2}%
        % if #2 is a hex number including lowercase
        % letters, then they are first converted to uppercase
        % (one of them may be `a')
        % and then the UC code of `a' becomes temporarily
        % a character of a code "#2
    \ifnum"\H@x=0
        \defineone{^^00}%
            % the letter of the code 0 cannot be created by uppercacing
    \else
        \uppercase{\defineone{a}}%
            % first convert a letter `a' to uppercase
            % which is temporarily a character of a code "#2
            % then define a token /#1 as expanding to this letter
    \fi
    \uccode`\a=`\A
        % restore the original UC value for `a'
    \uppercase{\definetwo{#2}}%
        % if #2 is a hex number including lowercase
        % letters, then they are first converted to uppercase
        % (one of them may be `a')
        % and then the control sequence like /aa is defined
        % as a macro expanding to a two-digit hexadecimal (uppercase)
        % representation of a code of the corresponding
        % polish letter
    \uppercase{\catcode"#2=11 }%
        % assign category `letter' to #2
    }%
\catcode`\^^00=9% character of the code 0 is ignored

\def\prim@qq% quotation mark encoding
    % define /,, token as the hex code of the char ,, (etc.)
    #1#2 % two characters representing a quote: ,, '' << >>
    #3 %    two heahadecimal digits (`af' etc.) (UC or lc)
    {%
    % #1#2 must have categories `other'
    \uppercase{\expandafter\def\csname/#1#2\endcsname{#3}}%
        % first convert #3 to uppercase and then
        % define /,, token as the hex code of the char ,, (etc.)
    }%

% the secondary meanings of the macros \@Pl and \@qq:

\@ct\^^00% character of the code 0 is active
\def\sec@Pl% Polish letter encoding
    #1 % letter (e.g., a)
    #2 % hex code (e.g., a1) (UC or lc) of a polish letter
    %   - define the character of the code a1 as an active character
    %   - define this active character as a macro expanding to the
    %     polish diacritical letter corresponding to a, in the current
    %     font layout)
    {%
    % It is assumed that during the execution of this definition
    % the UC code of `~' is 0
    \def\defineit##1{\edef##1{\csname/#1\endcsname}}%
        % auxiliary macro for defining something later
        % in the `\uppercase' environment such that #1
        % is not converted to the uppercase
    \uppercase{\def\H@x{#2}}%
    \uppercase{\uccode`\~"#2}%
        % if #2 is a hex number including lowercase
        % letters, then they are first converted to uppercase
        % and then the UC code of `~' becomes temporarily
        % a character of a code "#2
    \ifnum"\H@x=0
        \defineit{^^00}%
            % the active char. of the code 0 cannot be created by uppercacing
    \else
        \uppercase{\defineit~}%
            % first convert the active `~' to uppercase
            % which is temporarily a character of a code "#2
            % then define this new active character as a macro
            % expanding to the Polish diacritical
            % letter corresponding to #1 in the current font layout
    \fi
    \uccode`\~=\z@
        % restore the original UC value for `~'
    \uppercase{\catcode"#2\active}%
        % assign category `active' to #2
    }%
\catcode`\^^00=9% character of the code 0 is ignored
\def\sec@qq% quotation mark encoding
    % define /,, token as the hex code of the char ,, (etc.)
    #1#2 % two characters representing a quote: ,, '' << >>
    #3 %    two heahadecimal digits (`af' etc.) (UC or lc)
    {}% do nothing

% auxiliary macros for reading font definitions
% from PLAIN.TEX and LFONTS.TEX files:

% ASSUMPTION:
%
% It's assumed that in the files `plain.tex' and `lfonts.tex'
% the commands `\font' consist of the following components:
%   1. the control sequence \font
%   2. a control sequence (TeX's font identifier)
%   3. the equality sign =
%   4. a (possibly empty) sequence of spaces
%   5. a name of a font consisting of at least two characters

\def\f@n#1=#2#3%
    {%
    \def\thepr@f{#2#3}%
    \of@n#1%
    \ifx\thepr@f\@ldpref % see the MEXCONF.TEX file
      \n@wpref%
    \else
      \thepr@f%
    \fi
    }%

% The command \f@@nt substitutes \font in the LaTeX macro \@getfont
% used for loading font on demand.

\def\f@@nt
    #1% a control sequence name
    % We assume that the macro \@getfont is used in such a way
    % that the fourth parameter to this macro is either
    %   1. a name of a font consisting of at least two characters or
    %   2. a sequence of tokens expanding to a name of a font
    %      such that the first token expands to at least two
    %      first characters of this name.
    % This assumption is satisfied by all standard versions
    % of the LFONTS.TEX file.
    %
    % The token following `\f@@nt#1' is either the first letter
    % of the font name (usually the letter `c' of the `cm...' name)
    % or it is an abbreviation of a font name  (a macro)
    % expanding at the first level to a multicharacter name
    % (e.g., `\@mbi' expanding to `cmmib10').
    {\expandafter\f@@@t\expandafter#1}

\def\f@@@t#1#2#3%
    {%
    \def\thepr@f{#2#3}%
    \global\font#1%
    \ifx\thepr@f\@ldpref % see the MEXCONF.TEX file
      \n@wpref%
    \else
      \thepr@f%
    \fi
    }%

% Macros for redefining font abbreviations like \@mbi and \@mbsy.
% It is assumed that \@mbi and \@mbsy expand to a sequence to at least
% two characters.

\def\redeff@nt#1%
    {\expandafter\redeff@@nt#1\redeff@@@nt#1}
\def\redeff@@nt#1#2#3\redeff@@@nt#4%
    {%
    \def\thepr@f{#1#2}%
    \edef#4%
    {\ifx\thepr@f\@ldpref % see the MEXCONF.TEX file
      \n@wpref%
    \else
      \thepr@f%
    \fi#3}%
    }%

% auxiliary definitions for the lists of characters:
\@th\/% / is of category `other'
\def\P@lcd% Polish code
    % \P@lcd{a} expands on the third level to something like 86
    % (two-digit UC hex representation of code)
    #1% letter
    {\csname/#1#1\endcsname}%

\def\P@lqq% Polish quote
    % \P@lqq,, expands on the third level to two character hexadecimal
    % code of the corresponding character
    #1#2% representation of a quote
    {\csname/#1#2\endcsname}

% lists of Polish characters:
\def\UCP@llist
    {%
    \do A% A with ogonek
    \do C% accented C
    \do E% E with ogonek
    \do L% crossed L
    \do N% accented N
    \do O% accented O
    \do S% accented S
    \do X% accented Z
    \do Z% dotted Z
    }
\def\P@llist
    {%
    \do A% A with ogonek
    \do C% accented C
    \do E% E with ogonek
    \do L% crossed L
    \do N% accented N
    \do O% accented O
    \do S% accented S
    \do X% accented Z
    \do Z% dotted Z
    \do a% tailed a
    \do c% accented c
    \do e% tailed e
    \do l% crossed l
    \do n% accented n
    \do o% accented o
    \do s% accented s
    \do x% accented z
    \do z% dotted z
    }
\def\UClcP@llist
    {%
    \do Aa% A with ogonek
    \do Cc% accented C
    \do Ee% E with ogonek
    \do Ll% crossed L
    \do Nn% accented N
    \do Oo% accented O
    \do Ss% accented S
    \do Xx% accented Z
    \do Zz% dotted Z
    }%

% auxiliary macros for language and font layout definitions:
\def\d@finelanguage
    #1% language name (e.g., `english')
    #2% full language name (if different from #1)
    #3% layout codes
    #4% hyphenation patterns file name
    #5% special notation before reading hyphenation patterns
    {%
    \expandafter\def\csname f@nt#1\endcsname{#3}%
    \donothyph@nate{#1}%
    %
    % `\chardef\...language=...\relax' etc.
    \def\ch@rd{\expandafter\chardef\csname#1language\endcsname}%
    \expandafter\ch@rd\number\count@\relax
    \advance\count@1
    %
    \begingroup
    \let\e\expandafter
    %
    % prepare reading the hyphenation patterns
    \e\toks\e0\e{\r@adpatterns}%
    \toks1{\r@adpatt{#1}{#2}{#4}{#5}}%
    \xdef\r@adpatterns{\the\toks0 \the\toks1 }
    %
    % prepare executing the appropriate `\newlanguage' commands
    % after reading PLAIN or LPLAIN
    \e\toks\e0\e{\n@wlanguages}%
    \e\toks\e1\e{\e\newlanguage\csname#1language\endcsname}%
    \xdef\n@wlanguages{\the\toks0 \the\toks1 }%
    %
    \endgroup
    }
\def\r@adpatt
    % the command used several times by \r@adpatterns:
    % read the hyphenation patterns for the language #1
    #1% name of the language (english, pl, pone, mazovia, latintwo, etc.)
    #2% full language name
    #3% name of the hyphenation patterns file
    #4% special notation like \P@lhyphnotation
    % Only \patterns and \hyphenation are to be defined globally;
    % the rest of changes is to be done only for the time 
    % of reading patterns and exceptions.
    % (Group around the replacement text of \r@adpatt added 18 XII 1993.)
    {{%
    \csname f@nt#1\endcsname % define the #1 encoding
    #4% turn on the special notation
    %
    % define the name to be displayed:
    \uppercase{\def\l@nname{#2}}%
    \ifx\empty\l@nname \uppercase{\def\l@nname{#1}}\fi
    %
    \expandafter\language\csname#1language\endcsname% turn on the language
    \expandafter\if\csname hyph@nat@#1\endcsname T%
        \def\next{\input#3\relax}%
        \def\extram@ssage{}%
    \else
        \def\next{\patterns{}\hyphenation{}}%
        \def\extram@ssage{, empty}%
    \fi
    \message{hyphenation [\l@nname\extram@ssage],}%
    \next
    }}
\def\P@lhyphnotation
    % special notation to be introduced before reading
    % polish hyphenation pattern files
    {%
    \m@ptwo\P@lcase\UClcP@llist% assign UC & lc codes
    \prefixing
    }
\def\donothyph@nate
    #1% language name
    {%
    % do not hyphenate this language unless otherwise specified:
    \expandafter\let\csname hyph@nat@#1\endcsname F%
    }
\def\hyph@nate
    % allow hyphenating this language
    #1% (pl, pone, mazovia, ...)
    {\expandafter\let\csname hyph@nat@#1\endcsname T}%

% The main macros for defining languages.

% The following macros can be used to define languages
% (almost) arbitrary number of times and in any order.

\def\d@finesinglelanguage
    % macro for defining `single-layout languages', i.e., languages,
    % where characters are in the same positions for all fonts:
    #1% language name (e.g., `english')
    #2% language full name
    #3% hyphenation patterns file name
    {%
    \d@finelanguage{#1}{#2}{}{#3}{}%
    %
    % For single-layout languages like English
    % the commands \english and \englishlanguage are synonims.
    % For the English language the following two lines are
    % equivalent to: \let\english\englishlanguage
    \def\l@t{\expandafter\let\csname#1\endcsname}%
    \expandafter\l@t\csname#1language\endcsname%
    }
% define the Polish font layout (language in TeX terms):
\def\d@finelayout
    #1% layout (language) name (pl, pone, mazovia, latin)
    #2% full language name
    #3% layout codes
    {%
    \d@finelanguage{#1}{#2}{#3}{\P@lhyphen}{\P@lhyphnotation}%
    }

\message{prefixing,}
% prefixing and non-prefixing

% In the following section nothing is dependent on particular
% codes of Polish characters in a font.

% The following Polish characters in the Mazovia encoding
% are used in comments:
%                  
% (meaning: /a /c /e /Z)

% there are two possible notations:
%   1. with \prefixing turned on:                     /a /c /e ...
%   2. with \prefixing turned off (\nonprefixing):          ...

% prefixed /a (with active /) expands to a single letter 

\@ct\/
\def\prefixing % / becomes `active' and meaning \P@lch
    {\@ct    \/% make / active
     \let/\P@lch % assign the (Plain or LaTeX) meaning
     \let\pr@fix T}
\@th\/
\def\nonprefixing % / becomes `other'
    {\let\pr@fix F\@th\/}
% we use \let\pr@fix T and \let\pr@fix F instead of \newif-s
% because we are before reading plain

% \normalslash expands to  /  of category `other'
\def\normalslash{/}

% In the forthcoming definitions the following short macro expanding to
% \ifx followed by active / will be useful to make them more efficient:
\@ct\/% / is active
\def\P@lifs% \ifx active-slash
        {\ifx/}
\@th\/% / is "other" again
% we will define a macro expanding to `\ifx/#1/\else...' where the first /
% is active and the remaining ones are of the category `other'

% The active / will be a synonim of the macro \P@lch,
% where \P@lch is equivalent either to \pslash or to \l@slash
% in Plain or in LaTeX, respectively;

% \pslash (for Plain and to-be-protected in LaTeX)
\expandafter\def\expandafter\pslash\expandafter#\expandafter1\expandafter
    {\P@lifs
    % Think about the two lines above as:
    %   \def\pslash#1{\ifx/
    % where the / is active.
    %
    #1\expandafter/% the slash is of category `other'
    \else\ifx#1\pslash\expandafter/% \pslash\pslash
    \else\expandafter\ifx
        \csname
            /%
            \noexpand#1% \noexpand is included in case of active #1
                       % or of /\a where \def\a{anything}
        \endcsname
        \relax % THEN:
        \P@lerr{#1}%
    \else
        \@xpfififi
        \csname/#1\endcsname
    \fi\fi\fi}
\def\@xpfififi{\expandafter\@xpiii}
\def\@xpiii{\expandafter\@xpii\expandafter}%
\def\@xpii{\expandafter\expandafter\expandafter}%
% The \expandafter trickery in the macro replacement text causes
% that in the correct use of the macro / or \pslash
% (// \pslash\pslash /\pslash \pslash/ /a /e /c etc.)
% after typesetting the appropriate character, no tokens from
% the replacement text of this macro are left in the TeX's input
% token list.
\def\P@lerr
    #1% illegal argument
    {\begingroup
    \newlinechar=`\*%
    \errorcontextlines=0 %
    \errhelp={%
    Only the characters:  aeclnosxzAECLNOSXYZ/  can appear after / .*%
    % (We do not mention the possibility of writing /\pslash)
    Proceed, I'll omit both / and the following character.*%
    You can also correct your mistake by typing now `I' followed by*%
    whatever should be in place of the incorrect pair of characters.*%
    For example if you typed `/w' and you meant `w', type `Iw' now.}%
    \errmessage{%
    MeX error: Illegal pair of characters%
    \space\space\noexpand/\noexpand#1\space\space occured}%
    \endgroup}

\@ct\/% / is active
\def\l@slash{\protect\pslash}
% In Plain \P@lch is \pslash, in LaTeX \P@lch is \l@slash.
% Default (in Plain):
\let\P@lch\pslash
\let/\P@lch

% Synonims to ,, '' << >> to be used in math mode:
\def\plqq{\char"\P@lqq,, }% Polish left quote  ,,
\def\prqq{\char"\P@lqq'' }% Polish right quote    ''
\def\flqq{\char"\P@lqq<< }% French left quote  <<
\def\frqq{\char"\P@lqq>> }% French right quote    >>

\message{definitions of languages,}
% initial values (prepare reading language definitions):
\countdef\count@=255 \count@0 % for counting languages
\def\empty{}
\def\r@adpatterns{}
\def\n@wlanguages{\count19=-1 }% starting from 0

% the first (zero in fact) language is English
\d@finesinglelanguage{english}{}{\@nghyphen}%

% definitions of codes in the font layout in the Polish fonts:
% (the hexadecimal digits may be upper or lowercase)

% Each of the following \d@finelayout commands
% includes the definition of a \f@nt<layout> command,
% where <layout> is a font layout name like `pl' `mazovia' etc.

% The \f@nt<layout> command results in executing several times
% a command of the form:      \@Pl <letter> <code>
% and a command of the form:  \@qq <char><char> <code>
%
% There are two meanings of the \@Pl and \@qq commands:
% the primary meanings and the secondary meanings.
%
% The primary meanings of the commands \@Pl and \@qq
% change the `state' of MeX, in the following way:
%
% command of the form: \@Pl <letter> <code>
% (take \@Pl a a1 as an example, i.e., <letter>=a <code>=a1)
%   - define the character of the code a1 as a `letter'
%   - define the control sequence /a as a macro expanding to the
%     letter of the code a1
%   - define the control sequence /aa as a macro expanding to the
%     two-character uppercase hexadecimal code of the corresponding
%     letter, in this case to A1
%
% command of the form: \@qq <char><char> <code>
% (take \@qq ,, ff as an example, i.e., <char>=, <code>=ff)
%   - define the control sequence /,, as a macro expanding to the
%     two-character uppercase hexadecimal code of the corresponding
%     quotation mark, in this case to FF

% The secondary meanings of the commands \@Pl and \@qq are the following:

% command of the form: \@Pl <letter> <code>
% (take \@Pl a a1 as an example, i.e., <letter>=a <code>=a1)
%   - define the character of the code a1 as an active character
%   - define this active character as a macro expanding to the
%     polish diacritical letter corresponding to a, in the current
%     font layout)
%
% command of the form: \@qq <char><char> <code>
%   - do nothing

% the default meaning is primary
% it is redefined for a moment by the macro \layout

\let\@Pl\prim@Pl
\let\@qq\prim@qq

% (The \f@nt... commands are used by the layout switching commands
% -- see the MEX2.TEX file)

% The PL font layout:
% (The codes of the Polish letters in the PL font layout
% equal to the corresponding codes of the Polish letters
% in the Extended Computer Modern font layout;
% This is the standard INTERNAL code of the MeX and LaMeX formats.)

\def\standardf@ntlayout{pl}% might be moved to MEXCONF.TEX
    % after checking out thoroughly if everything is OK.

\d@finelayout{pl}{}
{%
\@Pl A  81  % 
\@Pl C  82  % 
\@Pl E  86  % 
\@Pl L  8a  % 
\@Pl N  8b  % 
\@Pl O  d3  % 
\@Pl S  91  % 
\@Pl X  99  % 
\@Pl Z  9b  % 
%
\@Pl a  a1  % 
\@Pl c  a2  % 
\@Pl e  a6  % 
\@Pl l  aa  % 
\@Pl n  ab  % 
\@Pl o  f3  % 
\@Pl s  b1  % 
\@Pl x  b9  % 
\@Pl z  bb  % 
%
\@qq ,, ff
\@qq '' 22
\@qq << ae
\@qq >> af
}

% the Mazovia font layout:

\d@finelayout{mazovia}{}
{%
\@Pl A  8f  % 
\@Pl C  95  % 
\@Pl E  90  % 
\@Pl L  9c  % 
\@Pl N  a5  % 
\@Pl O  a3  % 
\@Pl S  98  % 
\@Pl X  a0  % 
\@Pl Z  a1  % 
%
\@Pl a  86  % 
\@Pl c  8d  % 
\@Pl e  91  % 
\@Pl l  92  % 
\@Pl n  a4  % 
\@Pl o  a2  % 
\@Pl s  9e  % 
\@Pl x  a6  % 
\@Pl z  a7  % 
%
\@qq ,, ff
\@qq '' 22
\@qq << ae
\@qq >> af
}

% the Latin 2 font layout:

\d@finelayout{latintwo}{latin 2}
{%
\@Pl A  a4  % 
\@Pl C  8f  % 
\@Pl E  a8  % 
\@Pl L  9d  % 
\@Pl N  e3  % 
\@Pl O  e0  % 
\@Pl S  97  % 
\@Pl X  8d  % 
\@Pl Z  bd  % 
%
\@Pl a  a5  % 
\@Pl c  86  % 
\@Pl e  a9  % 
\@Pl l  88  % 
\@Pl n  e4  % 
\@Pl o  a2  % 
\@Pl s  98  % 
\@Pl x  ab  % 
\@Pl z  be  % 
%
\@qq ,, ff
\@qq '' 22
\@qq << ae
\@qq >> af
}

% the (old) P1 font layout:

\d@finelayout{pone}{p1}
{%
\@Pl A  00  % 
\@Pl C  01  % 
\@Pl E  02  % 
\@Pl L  03  % 
\@Pl N  04  % 
\@Pl O  05  % 
\@Pl S  06  % 
\@Pl X  07  % 
\@Pl Z  08  % 
%
\@Pl a  0a  % 
\@Pl c  10  % 
\@Pl e  11  % 
\@Pl l  19  % 
\@Pl n  1b  % 
\@Pl o  1c  % 
\@Pl s  1d  % 
\@Pl x  1e  % 
\@Pl z  1f  % 
%
\@qq ,, 18
\@qq '' 22
\@qq << 1a
\@qq >> 20
}
\count@0 % restore the normal value of the counter

% macro for switching font layouts
% (also turns on the appropriate hyphenation patterns)
\def\layout
    #1% language name (pl, mazovia etc...}
    {%
    % change the `state' of MeX -- remember the new layout:
    \csname f@nt#1\endcsname%
    % assign the category \letter to the Polish characters:
    \m@pone\mkl@t\P@llist
    % possibly define the Polish characters in the internal MeX encoding
    % as active characters expanding to letters in the font codes:
    \edef\currf@ntlayout{#1}%
    \ifx\currf@ntlayout\standardf@ntlayout
        % just leave as it is
    \else
        % define active Polish diacritical characters:
        % first assign the secondary meaning to \@Pl and \@qq
        \let\@Pl\sec@Pl \let\@qq\sec@qq
        % now define the active characters of the internal MeX codes
        % (the same as the codes of the \standardf@ntlayout)
        \csname f@nt\standardf@ntlayout\endcsname%
        % restore the primary meaning of \@Pl and \@qq
        \let\@Pl\prim@Pl \let\@qq\prim@qq
    \fi
    \m@pone\P@lsf\UCP@llist% assign space factor 999 to UC Pol. let.
    \m@ptwo\P@lcase\UClcP@llist% assign UC & lc codes
        % note that UC & lc codes are assigned
        % to the letters according to the FONT layout
        % and not to the active characters expanding to them
        % (so in nonstandard font layouts
        % first expand, then apply \upper-lower-case)
    \m@pone\P@lm\P@llist % assign mathcodes to polish letters
    % change the meaning of `\polish' to one of the languages
    \expandafter\let\expandafter\polish
        \csname#1language\endcsname%
    \language\polish
    }

% No languages are hyphenated
% unless specified otherwise in the configuration file.

\input mexconf % MeX configuration file

% Read (empty or real) hyphenation patterns
% for all defined languages and for all font layouts
% (Prefixing is turned on automatically, then turned off):
\r@adpatterns
\nonprefixing % prefix notation should not be turned on while reading PLAIN
\endinput