summaryrefslogtreecommitdiff
path: root/systems/generic/mltex/mltrip/mltrip.tex
blob: ac7c3be79c3b9ecb63a79c0eccda9ea47757ec8d (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
% This is `mltrip.tex' for MLTeX v2.2 (as of December 17, 1995).
%
% A test file to check for correct MLTeX implementations similar to
% `trip.tex', Knuth's torture test for TeX.
%
% Copyright (C) 1997 by B. Raichle; all rights are reserved.
%
% MLTeX is copyright (C) 1990-92 by Michael J. Ferguson; all rights are reserved.
% MLTeX Version 2.2 is copyright (C) 1995 by B. Raichle; all rights are reserved.
% The TeX program is copyright (C) 1982 by D. E. Knuth.
% TeX is a trademark of the American Mathematical Society.
%
%
% Usage:
%
%  1. Run iniTeX with the MLTeX extensions on this file.
%     Do not try to use plain-TeX or LaTeX.
%  2. Compare the produced log file with the one provided.
%  3. Take a look at the dvi file and compare it with the
%     description at the end of the log file.
%  4. (optional) Use dvitype to convert the dvi file to the
%     ASCII representation of its contents using these options:
%        Output level = 2
%        Starting page = *          (default)
%        Number of pages = 1000000  (default)
%        Resolution = 7227/100
%        New magnification = 0      (default)
%     Compare the output with the provided file `mltrip.typ'.
%
%
% Needs:
%
%  - MLTeX v2.2
%  - font metric file  cmr10.tfm
%  - dvitype (if you want to compare the dvi files)
%
%
% Changes:
%
%  97/01/06 v1.0a
%           - initial version
%  97/01/08 v1.0b
%           - added error count + \inputlineno test, fixed log output
%  97/01/14 v1.0c
%           - added tests for math character substitution
%
\catcode`\{=1 \catcode`\}=2 \catcode`\$=3 \catcode`\#=6 \catcode`\^=7
\endlinechar=`\^^M\newlinechar=`\^^J \def\space{ } \nonstopmode
%
\def\typeout#1{\immediate\write16{#1}}
\countdef\errorcount=254 \errorcount=0
\def\error#1{\advance\errorcount 1%
  \typeout{^^J^^J\space\space\space ERROR: #1^^J^^J}}
%
\typeout{^^J"Trip" test for MLTeX implementations (1997/01/14 v1.0c [br])^^J}
%
% check for plain-TeX:
% we have to ensure that _no_ fonts are preloaded
\expandafter\ifx\csname active\endcsname\relax \else
  \typeout{Please (Ini)TeX this file, no plain-TeX, no LaTeX!^^J}
  \expandafter
  \endinput\csname @@end\expandafter\endcsname\expandafter\end\fi\relax
% check for MLTeX
\expandafter\ifx\csname charsubdef\endcsname\relax
  \typeout{This test file can only be used with MLTeX!^^J}
  \expandafter\endinput\expandafter\end\fi\relax
% check for MLTeX v2.2
% (former MLTeX versions have initialized \charsubdefmax with 0)
\ifnum\charsubdefmax<0 \else
  \typeout{...ouch, an old MLTeX version!^^J%
           This test file can only be used with MLTeX v2.2 or newer!^^J}
  \expandafter\endinput\expandafter\end\fi\relax
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\typeout{Test font load bug (in MLTeX < v2.2):}
% define substitution of an existing char with a non-existing base char
\charsubdef `\A=`\a 128
% load font (which should be preloaded before!)
\font\test=cmr10 \relax \test
  \textfont0=\test \textfont1=\test
\font\smalltest=cmr10 \relax % our symbols font
\fontdimen22\smalltest=7pt
  \textfont2=\smalltest \scriptfont2=\smalltest
  \scriptscriptfont2=\smalltest
\font\bigtest=cmr10 \relax % our extension font
  \textfont3=\bigtest \scriptfont3=\bigtest
  \scriptscriptfont3=\bigtest
\thinmuskip=18mu plus 18mu
\medmuskip=36mu plus 9mu minus 18mu
\thickmuskip=54mu minus 18mu \relax
%
\hsize=2in \parindent=.5pt \parfillskip=0pt plus1fil\relax
\baselineskip=12pt \topskip=10pt \relax
\tracingonline=1\showboxbreadth=255\showboxdepth=255
\tracinglostchars=1
%%%\tracingcharsubdef=1
\message{done.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\typeout{Test assignments to \string\charsubdefmax:}
\charsubdefmax=-1  % reset because of \charsubdef`\A ...
\begingroup
  %%%\tracingrestores=10
  \count0=\charsubdefmax
  \begingroup \charsubdef 224 =  `\` `a
    \ifnum\charsubdefmax=224 \else
      \error{\string\charsubdefmax\space set incorrectly (1)!}\fi
  \endgroup
  \ifnum\count0=\charsubdefmax \else
    \error{\string\charsubdefmax\space reset incorrectly (1)!}\fi
  % Test of a bug in MLTeX v2.2!
  \begingroup \charsubdef 228 = `\" `a \global\charsubdef 224 = `\` `a
    \ifnum\charsubdefmax=228\else
      \error{\string\charsubdefmax\space set incorrectly (2)!}\fi
  \endgroup
  \ifnum\charsubdefmax=-1 \else % BUG: 224 was expected, not -1!
    \error{\string\charsubdefmax\space reset incorrectly (2)!}\fi
  % ...instead we use a simpler test:
  \begingroup \charsubdef 226 =  `\^ `a \charsubdef 224 =  `\` `a
    \ifnum\charsubdefmax=226 \else
      \error{\string\charsubdefmax\space set incorrectly (3)!}\fi
    \global\charsubdef 228 = `\" `a
  \endgroup
  \ifnum\charsubdefmax=228 \else
    \error{\string\charsubdefmax\space reset incorrectly (3)!}\fi
  % reset former value of \charsubdef and \charsubdefmax
  \global\charsubdef 224=0 0
  \global\charsubdef 228=0 0
  \global\charsubdefmax=\count0
\endgroup
\message{done.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\typeout{Test char substitution, box packing and repacking:}
\charsubdef 224 =  18 `a  % "E0 \`a
\charsubdef 225 =  19 `a  % "E1 \'a
\charsubdef 226 =  94 `a  % "E2 \^a
\charsubdef 228 = 127 `a  % "E4 \"a
% define some substitutions whose characters doesn't exist in cmr10:
\charsubdef 192 = 200 `a
\charsubdef 193 = `a 129
\charsubdef 194 = 128 129
%
\setbox2=\hbox{\char`a}\setbox4=\hbox{\char0}
\message{<2 missing char warnings:}
\setbox0=\hbox{\char224\char192\char193\char194}
\message{>,}
\ifdim\wd0=2\wd2 \else
  \error{box width dimension set incorrectly (1)!}\fi
%
\setbox0=\hbox{\char224}
\ifdim\wd0=\wd2 \else
  \error{box width dimension set incorrectly (2)!}\fi
% re-access character dimensions while substitution is disabled
% (=> warning message, width of \char224 is first char in font, i.e. \char0)
\message{<1 missing substitution warning:}
{\charsubdefmax=0 \global\setbox0=\hbox{\unhbox0}}
\message{>,}
\ifdim\wd0=\wd4 \else
  \error{box width dimension set incorrectly (3)!}\fi
% re-box it again (=> no warning message!)
\setbox0=\hbox{\unhbox0}
\ifdim\wd0=\wd2 \else
  \error{box width dimension set incorrectly (4)!}\fi
%
\message{<2 missing substitution warnings:}
\setbox0=\vbox{\char224 \charsubdefmax=0\par}
\message{>,}
\message{done.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%\typeout{Test math character substitutions:}
%%\setbox0=\hbox{$\mathchar"2E0 % |fetch|
%% \mathaccent"70E1 a % |fetch| + |make_math_accent|
%% \mathaccent"7013 \mathchar"2E2 % |fetch|
%% \mathop{\mathchar"0E4}{}% |fetch|
%% \delimiter"43E03E1 % |var_delimiter|
%% $}\showbox0
%%\message{done.}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\typeout{Test dvi output with substitutions:}
% define correct substitutions
\charsubdef 192 =  18 `a  % \`a
\charsubdef 193 =  19 `a  % \'a
\charsubdef 194 =  94 `a  % \^a
\charsubdef 196 = 127 `a  % \"a
\charsubdef 199 =  24 `c  % \c{c}
% define correct substitutions
\charsubdef 204 =  18 16  % \`\i
\charsubdef 205 =  19 16  % \'\i
\charsubdef 206 =  94 16  % \^\i
\charsubdef 208 = 127 16  % \"\i
\charsubdef 207 =  24 `i  % \c{i}
% define substitutions with non-existing characters
\charsubdef 210 = 128 `a  % \`a
\charsubdef 211 = 128 `a  % \'a
\charsubdef 212 = 128 `a  % \^a
\charsubdef 214 = 128 `a  % \"a
\charsubdef 213 = 128 `c  % \c{c}
% define correct substitutions
\charsubdef 224 =  18 `a  % \`a
\charsubdef 225 =  19 `a  % \'a
\charsubdef 226 =  94 `a  % \^a
\charsubdef 228 = 127 `a  % \"a
\charsubdef 227 =  24 `c  % \c{c}
%
\setbox0=\vbox{%
  \def\row#1 #2 #3 #4 {--\char#1--\hbox{\char#2}--\char#3--\char#4--\par}%
  a-grave:      \row 192 204 210 224 %
  a-acute:      \row 193 205 211 225 %
  a-circonflex: \row 194 206 212 226 %
  a-umlaut:     \row 196 208 214 228 %
  c-cedille:    \row 199 207 213 227 %
}
%
% redefine the correct substitutions 
\charsubdef 204 =  18 `a  % \`a   <= \`\i
\charsubdef 205 =  19 `a  % \'a   <= \'\i
\charsubdef 206 =  94 `a  % \^a   <= \^\i
\charsubdef 208 = 127 `a  % \"a   <= \"\i
\charsubdef 207 =  24 `c  % \c{c} <= \c\i
%
\begingroup
  \message{<Alternating 5 incomplete subst. + 5 missing subst. warnings:}
  \charsubdefmax=223
  \shipout\box0
  \message{>,}
\endgroup
\message{done.}
%
\def\row#1#2#3{\space\space #1: -- \string#2#3 -- \string#2#3-- -- --}
\typeout{^^J^^JTo complete the test:^^J=====================^^J^^J%
1. Compare the log file with the one provided.^^J%
2. Compare the dvi output:^^J%
The dvi file should contain 5 lines of text, each line beginning^^J%
with an ASCII description of the accented character, a colon^^J%
followed by five en-dashes and two accented characters:^^J%
  \row{a-grave}{\`}{a}^^J%
  \row{a-acute}{\'}{a}^^J%
  \row{a-circonflex}{\^}{a}^^J%
  \row{a-umlaut}{\"}{a}^^J%
  \row{c-cedille}{\c}{{c}}^^J%
The spacing between the first accented character and the first^^J%
two en-dashes has to be correct, whereas the en-dash after the^^J%
second accented character has to touch the character!  Otherwise^^J%
your MLTeX implementation is incorrect.^^J}
%
% Test for correct number of lines:
\ifnum 255=\inputlineno \else
  \error{`mltrip.tex' corrupted! (l.\the\inputlineno)}\fi
\ifnum\errorcount>0 \error{There was atleast one error!}\fi
\end\relax \typeout{Can't happen in MLTeX "trip" test!}
%% End of file `mltrip.tex'.