summaryrefslogtreecommitdiff
path: root/language/typingtex/Convert-RaichleHacked.dir/cv.tex
blob: b49595421561b743f6a6deb716123b493c607bb7 (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
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This is cv.tex a quick and provisional temporary hack of convert.tex 
%% to add the following features:
%% 
%% --- suppress register creation logging
%% 
%% --- standardized I/O (cv.in ==> cv.out) to abreviate dialog
%% 
%% --- reduce logging of linenumbers tenfold to conserve time and eyesight
%% 
%% --- adjust interpretation of configuration file 
%% so that a line of the form (note the left quote!)
%%   `^^xy    <substitution text>   
%% (a) defines expansion of "ZW where Knuth's input filter
%% assigns external code "XY to internal code "ZW.
%% This allows use of the same line 
%% `\^^88 \`a 
%% to have an <agrave> of a Macintosh convert to \`a in cv.out
%% *NO MATTER WHICH* Knuth input filter (xord) may be present.
%% (Direct TeX for the Mac has user adjustable filters.)
%% (b) to avoid \edef type expansion of <substitution text>
%% See "Sanitize" and "Readtable".
%% 
%% --- add \unbrace to prevent damage to kerning etc as necessary.
%% 
%% Thanks to Bernd for code that is clean enough to hack!
%% 
%% L.Siebenmann 1-94 <lcs@matups.matups.fr>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%% This is file `convert.tex' generated
%% on <1991/7/9> with the docstrip utility (v1.1l test). 
%% 
%% The original source file was `convert.doc'.
%% 
%% 
%% Copyright (C) 1991 by Bernd Raichle, all rights reserved. 
%% 
%% IMPORTANT NOTICE: 
%% 
%% You are not allowed to change this file. You may however copy this file 
%% to a different name and then change this copy. 
%% 
%% You are NOT ALLOWED to take money for the distribution or use of this 
%% file (or a changed version) except for some nominal charge for copying etc. 
%% 
%% Error Reports in case of UNCHANGED versions to 
%% 
%% Bernd Raichle 
%% Stettener Str. 73 
%% D-7300 Esslingen 
%% Federal Republic of Germany 
%% Email: raichle@azu.informatik.uni-stuttgart.de 
%% 
\def\fileversion{1.0a}
\def\filedate{91/07/08}
\def\docdate{91/07/08}
\def\moddate{January, 1994}

%% \CheckSum{556}
%% \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         \~}
%%
%% TeX utility `convert' to use with plainTeX or LaTeX v2.09
%% Copyright (C) 1991 by Bernd Raichle, all rights reserved.
\catcode`@=11
 %% suppress Plain's logging of allocations
 \def\wlog#1{\relax} %% revise for latex 3

 %% some header definitions

 \let\EX@\expandafter
 \def\IW@ne{\immediate\write\@ne}

 {\lccode`\$=`\%  \lccode`\*=`\#  \lccode`|=`\\ 
  \lowercase{%
  \gdef\HeaderA{\IW@ne{}%
  \IW@ne{|def|unbrace*1{*1} $$ serves to  get rid of braces }%
  \IW@ne{ $$ as in {|oe}, that might damage kerning.}%
  \IW@ne{}}%
  }}
 
 \EX@\let
  \csname cork2dek.tbl\endcsname\HeaderA
 \EX@\let
  \csname mac2dek.tbl\endcsname\HeaderA
 \EX@\let
  \csname mac2fr7g.tbl\endcsname\HeaderA


\newwrite\@unused
\def\typeout#1{{\let\protect\string\immediate\write\@unused{#1}}}
\def\@strip#1#2 \@gobble{\def #1{#2}}
\def\@defpar{\par}
\def\@iden#1{#1}
\def\@gobble#1{}
\def\typein[#1]#2{\typeout{#2}\read\sixt@@n to#1%
  \ifx #1\@defpar \def#1{}\else
    \@iden{\expandafter\@strip\expandafter #1#1\@gobble\@gobble} \@gobble
  \fi}
\typeout{TeX Utility `convert' version \fileversion\space <\filedate> (br)}
\typeout{English documentation dated <\docdate> (br)}
\typeout{Modified <\moddate> (ls)}
\def\endofjob{%
  \typeout{******************************************}
  \typeout{* Finished. See output in file  cv.out. *}
  \typeout{******************************************}
  \csname @@end\endcsname \end
  }
%\everypar{\errhelp{This TeX utility should not produce any dvi output.}%
%  \errmessage{Internal Error 1. -- Please fix me!}}
 %\nullfont
\def\sorry{%
  \typeout{******************************************}
  \typeout{* Sorry, you need TeX 3 for this Utility *}
  \typeout{******************************************}
  \endofjob}
\newif\iftexthree \texthreetrue
\ifx\undefined\inputlineno
  \texthreefalse
\else
  \count@=\inputlineno
  \ifnum\inputlineno<\z@
    \texthreefalse
  \else\ifnum\inputlineno=\count@
    \texthreefalse
  \fi\fi
 \fi
 \iftexthree \else \expandafter\sorry\fi
 \errorcontextlines=\m@ne
 \input cv.cfg\relax
 \catcode`^=12
 \typeout{}
 \typeout{********************************************************}
 \typeout{ This program converts text-files with 8bit-characters}
 \typeout{ into text-files with TeX's ^^xx syntax or }
 \typeout{ into TeX macros you specify for these characters.}
 \typeout{ ---Input is taken from "cv.in".}
 \typeout{ ---Output goes to "cv.out".}
 \typeout{ ---Configuration in "cv.cfg" revises default translation.}
 \typeout{ Extra translation tables for this run (in order):}
 \typeout{ \space\space\configtables}
 \typeout{********************************************************}
 \typein[\order]{Type <return> to start; any letter first to abort.}
 \def\nibble#1#2\endnibble{\def\nibblet{#1}}
 \expandafter\nibble\order\relax\endnibble
 \expandafter
 \ifcat\nibblet a 
     \expandafter\endofjob
 \fi
 \newcount\convtype
 \convtype=2
 \def\getnumber{\afterassignment\gobblerest\count@=}
 \def\gobblerest#1\lineend{%
        %\showthe\count@\showthe\catcode`\^
     }
 %\loop
 %  \typeout{ Should I convert 8bit characters to...}%
 %  \typeout{ \space 1) ^^x notation or}%
 %  \typein[\conversion]%
 %          { \space 2) macros calls (defined in `convert.tbl')}%
 %  \getnumber\conversion \space 0 \lineend
 %  \convtype=\count@
 %  \fehlertrue
  %\ifnum\convtype>\z@ \ifnum\convtype<\thr@@ \fehlerfalse \fi\fi
 %  \convtype=2 \fehlerfalse
 %  \iffehler
 %    \typeout{ !! Please type 1 or 2 !!}\typeout{}%
 %\repeat
 %\typeout{}
 %\typein[\infilename]{First type the name of your input file:}
 %\typeout{}
 %\typein[\outfilename]{Now type the name of your output file:}
 %\typeout{}
 %\ifx\infilename\outfilename
 %  \typeout{}
 %  \typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
 %  \typeout{! Not possible to read from and write to the same file !}
 %  \typeout{!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
 %  \expandafter\endofjob
 %\fi
 \def\infilename{cv.in}
 \def\outfilename{cv.out}
\newwrite\outstream
 %\ifx\outfilename\empty
 %  \typeout{Output to \jobname.log and online.}
 %  \typeout{------------------------------------------------------------}
 %  \chardef\outstream=\sixt@@n
 %\else
  \immediate\openout\outstream \outfilename \relax
 %\fi


% {\lccode`\$=`\%\lccode`\*=`\#\lccode`\I=`\I\lccode`\|=`\\
% \lowercase
% {\global\toks0={|def|unbrace*1{} $$ auxiliary macro for {|oe} etc.}
% \global\toks2={$$ It erases cerain braces lest they damage kerning etc.}
% }}
%\showthe\toks2
  
  %\endofjob

\catcode`~=7
\catcode`$=\active
\newtoks\currentline \currentline={}
\newcount\Lineno
\newcount\lineno
\ifx\outfilename\empty
  \def\finish@line{\immediate\write\outstream{\the\currentline}%
    \currentline{}\outputpos\z@}
\else
  \def\finish@line{\immediate\write\outstream{\the\currentline}%
    \currentline{}\outputpos\z@\linemessage}
\fi
\def\linemessage{\ifnum\lineno=0\relax\message{\the\Lineno}\fi}
\def\lastlinemessage{\ifnum\lineno=0\relax\else\message{\the\Lineno}\fi}
\newcount\outputpos \outputpos=\z@
\begingroup\lccode`$=32
\lowercase{\endgroup
\def\expand@tab{%
  \count@\outputpos
  \loop \ifnum\count@>7 \advance\count@ -8\repeat
  \loop \ifnum\count@<8 \advance\count@\@ne $\repeat
}
} % end of lowercase
\begingroup \catcode`\~~@=\active
\gdef~~@{\currentline\expandafter{\the\currentline ^^@}%
     \advance\outputpos\thr@@}
\endgroup
\def\defoutstring#1#2#3{\ifnum#1=\z@ \else
  \begingroup \lccode`$=#1\relax
  \lowercase{\endgroup\xdef$}%
    {\currentline\noexpand\expandafter{\noexpand\the\currentline #2}%
    \advance\outputpos\noexpand#3}%
  \fi
}
\def\defout#1#2{\lccode`$=#1\relax
  \lowercase{\gdef$}{#2}}
\def\letout#1#2{\lccode`$=#1\relax
  \lowercase{\global\let$}#2}
\def\hexnum#1{\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or
  8\or 9\or a\or b\or c\or d\or e\or f\fi}
\catcode`*=12
\count@=32
\loop
  \lccode`*=\count@
  \ifnum\count@<127
     \lowercase{\defoutstring\count@*{\@ne}}
     \advance\count@\@ne
\repeat
\defoutstring{127}{^^?}\thr@@
\count@=\@ne \count\thr@@=`A
\loop
  \uccode`*=\count\thr@@
  \ifnum\count@<32
     \uppercase{\defoutstring\count@{^^*}}\thr@@
     \advance\count@\@ne \advance\count\thr@@\@ne
\repeat
\count@=128
\count\@ne=8 \count\tw@=0 % hex-counter
\loop
  \ifnum\count@<\@cclvi
     \defoutstring\count@
        {^^\hexnum{\the\count\@ne}\hexnum{\the\count\tw@}}4
     \advance\count@\@ne
     \ifnum\count\tw@>14
       \count\tw@\z@ \advance\count\@ne \@ne
     \else
       \advance\count\tw@ \@ne
     \fi
\repeat
\newcount\length
\def\getlength{\afterassignment\lengthloop\let\next= }
\def\lengthloop{%
  \ifx\next\empty%\showthe\length
  \else
    \advance\length\@ne
    \expandafter\getlength
  \fi
}
  %
  \def\@Cleanup#1>#2@{#2}
  \def\@Meaning#1{\expandafter\@Cleanup\meaning#1@}
  \def\@Sanitize#1{\def\@Sanholder{#1}%
      \edef\@Sanholder{\@Meaning\@Sanholder}
   }
  %
\def\processline#1 #2\lineend{\length=\z@
  \@Sanitize{#2}%
  \getlength#2\empty \getnumber#1\space -1 \lineend
  \defoutstring\count@{\@Sanholder}\length
}
\newif\ifmore \moretrue

 \def\nibble#1#2\endnibble{\def\nibblet{#1}}
 \def\unbrace#1{#1}
 \def\Unbrace#1{\edef#1{\expandafter\unbrace#1}}
 
\def\readtablehead{\begingroup
  \loop
    \endlinechar\m@ne
    \read\@ne to \curline \relax%\show\curline 
    \endlinechar`~~M
    \ifx\curline\empty % ignore empty lines
    \else
      \Unbrace\curline%%!!!
      \curline\show\curline
      \expandafter\nibble\curline\endnibble
      \show\nibblet
      \def\temp{`}
      \ifx\nibblet\temp\show\gcurline
        \morefalse \global\let\gcurline=\curline
        \show\gcurline
      \fi
    \fi
    \ifeof\@ne \morefalse  \message{xxxxxxxx}\let\readtablebody=\relax \fi
    \ifmore
  \repeat
\endgroup}

\def\readtablebody{\begingroup
 %%% following is replaced by Sanitize
 % \count@=128 %%%\z@ %%%127 %%\z@%!!!!!
 %  \loop
 %    \ifnum\count@<\@cclvi
 %      \ifnum\catcode\count@<9
 %        \catcode\count@ 12
 %      \else\ifnum\catcode\count@=\active
 %        \catcode\count@ 12
 %      \fi\fi
 %     \advance\count@ \@ne
 % \repeat
  %%% start with one \curline in hand
  %\let\curline=\gcurline
  %\show\gcurline
  %\expandafter\processline\curline\lineend
  \loop
    \endlinechar\m@ne
    \read\@ne to \curline
    \endlinechar`~~M
    \ifx\curline\empty % ignore empty lines
    \else
      %%\show\curline%%!!!
      \expandafter\processline\curline\lineend
    \fi
    \ifeof\@ne \morefalse \fi
    \ifmore
  \repeat
\endgroup}

 
  %%% \SIN@0#1@#2@ : Is 1st exp of #1 in 1st exp of #2 ??
   %% Answer in \ifIN@
   %% Further if true, then \Initialtoks@  \Terminaltoks@
   %% contain the parts before and after.
   %% while \Initialtoks@{#2}%
 \newif\ifIN@
 \newtoks\Initialtoks@  \newtoks\Terminaltoks@
 \def\m@rker{\m@@rker}%
 \long\def\DeleteMarker@ #1@@#2\m@rker{\Terminaltoks@{#1}}%
 \def\SIN@{\expandafter\SINN@\expandafter}%
  \long\def\SINN@0#1@#2@{%
    \long\def\NI@##1#1##2##3\ENDNI@
     {\ifx\m@rker##2\IN@false\Initialtoks@\expandafter{#2}%
      \else
        \IN@true
        \Initialtoks@{##1}\DeleteMarker@##2##3%
      \fi}%
    \expandafter\NI@#2@@#1\m@rker\ENDNI@}

 \def\getnexttable{%
   \SIN@0 @\configtables @%
   \ifIN@
     \edef\configtable{\the\Initialtoks@}%
     \edef\configtables{\the\Terminaltoks@}%
     \ifx\configtable\empty\expandafter\getnexttable\fi
   \else
     \let\configtable\configtables
     \let\configtables\empty
   \fi
   }

 \def\Loop@#1\Repeat@{%
    \def\Iterate@{#1\expandafter\Iterate@\fi}%
    \Iterate@} 
 


 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%  ACTION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifnum\convtype=\tw@
 \Loop@
  \getnexttable
  \ifx\empty\configtable
  \else
   \openin\@ne \configtable\relax
   \typeout{* Reading \configtable\space *}
   \ifeof\@ne
      \typeout{I can't find file \configtable -- ignored.}%
   \else
     \catcode`\^=7
      %\showthe\catcode`\\%
     \def\Readtable{%
          %\readtablehead
         \readtablebody\catcode`\\=0 }%
     \afterassignment\Readtable 
     \catcode`\\=12 
     %%%!!!\Readtable here
     \catcode`\^=12
     \closein\@ne
   \fi
  \Repeat@
\fi
\letout{9}\expand@tab
\defout{10}{%
  \typeout{!!--> Found ^J in line \the\Lineno--I'll ignore all ^J.}%
  \letout{10}\relax}
\defout{13}{%
  \typeout{!!--> Found ^M in line \the\Lineno--I'll ignore all ^M.}%
  \letout{13}\relax}
\def\readfile{%
  \read\@ne to\next
  \ifeof\@ne
  \else
    \advance\Lineno\@ne\advance\lineno\@ne
    \ifnum\lineno=10\relax\lineno=\z@\fi
    \next\relax
    \finish@line
    \expandafter\readfile
  \fi
 }
\def\makeactiveandinput{\begingroup
  \count@=\z@
  \loop
    \ifnum\count@<\@cclvi
      \catcode\count@\active
      \advance\count@\@ne
  \repeat
  \endlinechar=-1
  \openin\@ne \infilename\relax
   \EX@\csname\configtable\endcsname
  %\HeaderA
  \ifeof\@ne
    \typeout{No input file \infilename.}%
  \else
    \Lineno\z@\lineno\z@
    \typeout{* Starting to convert "cv.in"  line by line: *}
    \readfile
    \lastlinemessage
    \closein\@ne
  \fi
  \endlinechar=`~~M
  \ifx\outfilename\empty
    \typeout{------------------------------------------------------------}
  \else
    \immediate\closeout\outstream
  \fi
  \endgroup
  \endofjob
}
\makeactiveandinput
\errhelp{This TeX utility should not reach this point.}%
\errmessage{Internal Error 2. -- Please fix me!}
\endinput
%% 
%% End of file `convert.tex'.