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
|
% vim: ts=8 sw=8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File: mlsgalig.tex
% Author: Oliver Corff
% Date: November 1st, 1999
% Version: \VersionRelease
% Copyright: Ulaanbaatar, Beijing, Berlin
%
% Description: The mls pretty-spell subroutine
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\long\def\my@mls@galig#1{%
\t@kenbuffer={}%
\do@mlsgalig#1\ \end@mlsgalig\the\t@kenbuffer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \do@mlsgalig, \dodo@mlsgalig and the outer loop of \evaluate
% are shamelessly stolen from or modelled after Knuth's token
% scanners demonstrated in the TeXbook, exercise 11.5, chapter
% 20 and, most notoriously, appendix D.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\do@mlsgalig{\afterassignment\dodo@mlsgalig\let\next= }
\def\dodo@mlsgalig{\ifx\next\end@mlsgalig \let\next\relax
\else \prettify@mls\let\next\do@mlsgalig\fi
\next}
\def\end@mlsgalig{\end@mlsgalig}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\following@char\empty % ditto
\let\this@char\empty % general char var initialization
%
\newtoks\t@kenbuffer % token buffer collects output
%
\newif\ifShowSpecialMLS % Used for toggling token status
\def\double@quote{''}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The \evaluate construct appears in the TeXbook, disguised
% as \\; see above for sources of inspiration.
%
\def\prettify@mls{\expandafter\if\space \next\ % <- Watch space and `%'!
\let\this@char\space%
\the\t@kenbuffer%
\t@kenbuffer={}%
\this@char%
\else%
\let\this@char\next%
% [[\expandafter\string\this@char]] % <- used for diagnostics only.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char E%
\t@kenbuffer=\expandafter{\the\t@kenbuffer \"a}%
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char O%
\t@kenbuffer=\expandafter{\the\t@kenbuffer \"o}%
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char U%
\t@kenbuffer=\expandafter{\the\t@kenbuffer \"u}%
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char S%
\t@kenbuffer=\expandafter{\the\t@kenbuffer \sh}%
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char G%
\t@kenbuffer=\expandafter{\the\t@kenbuffer \g}%
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char '%
\ifShowSpecialMLS
\t@kenbuffer=\expandafter{\the\t@kenbuffer \fbox{\textsf{FVS1}}}%
\else%
\t@kenbuffer=\expandafter{\the\t@kenbuffer '}%
\fi
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char "%
\ifShowSpecialMLS
\t@kenbuffer=\expandafter{\the\t@kenbuffer \fbox{\textsf{FVS2}}}%
\else%
\t@kenbuffer=\expandafter{\the\t@kenbuffer ''}%
\fi
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char *%
\ifShowSpecialMLS
\t@kenbuffer=\expandafter{\the\t@kenbuffer \fbox{\textsf{*}}}%
\else
\t@kenbuffer=\expandafter{\the\t@kenbuffer *}%
\fi
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char -%
\ifShowSpecialMLS
\t@kenbuffer=\expandafter{\the\t@kenbuffer \fbox{\textsf{MSP}}}%
\else
\t@kenbuffer=\expandafter{\the\t@kenbuffer -}%
\fi
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if\this@char =%
\ifShowSpecialMLS
\t@kenbuffer=\expandafter{\the\t@kenbuffer \fbox{\textsf{MVS}}}%
\else
\t@kenbuffer=\expandafter{\the\t@kenbuffer =}%
\fi
\else%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\the\t@kenbuffer\this@char\t@kenbuffer={}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fi% <- end of evaluate else branch
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
}% End of evaluate definition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\endinput
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The file mlsgalig.tex ends here.
%
% O. Corff, (c) 1999, Ulaanbaatar, Beijing, Berlin
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|