%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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 <
[email protected]>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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:
[email protected]
%%
\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'.