| 1 |
% Special macros for use with MFT output. |
| 2 |
% Adapted to METAPOST sources by Wlodek Bzyl, July 2001. |
| 3 |
|
| 4 |
\ifx\mptmacisloaded\relax\endinput\else\let\mptmacisloaded=\relax\fi |
| 5 |
|
| 6 |
\catcode`\@=11 |
| 7 |
|
| 8 |
\font\tenlogo=logo10 % font used for the METAFONT logo |
| 9 |
\font\tentex=cmtex10 \hyphenchar\tentex=-1 % font used for strings |
| 10 |
\font\sevenit=cmti7 \scriptfont\itfam=\sevenit |
| 11 |
\def\MF{{\tenlogo META}\-{\tenlogo FONT}} |
| 12 |
\def\MP{{\tenlogo META}\-{\tenlogo POST}} |
| 13 |
|
| 14 |
\parindent=0pt |
| 15 |
\thinmuskip=5mu |
| 16 |
\thickmuskip=6mu plus 6mu |
| 17 |
\mathcode`\|="326A |
| 18 |
|
| 19 |
\def\\#1{{\it#1}} % italic type for identifiers |
| 20 |
\def\0#1#2#3{\hbox{\rm\'{}\kern-.2em\it#1#2#3\/\kern.05em}} % octal constant |
| 21 |
\def\1#1{\mathop{\hbox{\rm#1}}} % operator, in roman type |
| 22 |
\def\2#1{\mathop{\hbox{\mftbf#1\/\kern.05em}}} % operator, in bold type |
| 23 |
\def\3#1{\,\mathclose{\hbox{\mftbf#1\/}}} % `fi' and `endgroup' |
| 24 |
\def\4#1{\mathbin{\hbox{\mftbf#1\/}}} % `step' and `at' |
| 25 |
\def\5#1{\hbox{\mftbf#1\/}} % `true' and `nullpicture' |
| 26 |
\def\6#1{\mathbin{\rm#1}} % `++' and `scaled' |
| 27 |
\def\7{\hbox\bgroup\mft@nocats\frenchspacing\mft@finstring} % string token |
| 28 |
\def\8#1{\mathrel{\mathcode`\.="8000 \mathcode`\-="8000 |
| 29 |
#1\unkern}} % `..' and `--' |
| 30 |
\def\9{\hfill$\%} % comment separator |
| 31 |
\def\?#1{\mathopen{#1}\;} % `:', `::', and `||:' |
| 32 |
\def\frac#1/#2{\leavevmode\kern.1em |
| 33 |
\raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em |
| 34 |
/\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}} |
| 35 |
|
| 36 |
\mathchardef\AM="2026 % ampersand |
| 37 |
\let\BL=\medskip % space for empty line |
| 38 |
\mathchardef\BS="026E % backslash |
| 39 |
\mathchardef\HA="0222 % hat ("005E not as good) |
| 40 |
\def\PS{\mathbin{+{-}+}} % pythagorean subtraction |
| 41 |
\def\SH{\raise.7ex\hbox{$\scriptstyle\#$}} % sharp sign for sharped units |
| 42 |
\mathchardef\TI="007E % tilde |
| 43 |
|
| 44 |
\chardef\other=12 |
| 45 |
\def\mft@noc@ts{\catcode`\\=\other \catcode`\{=\other |
| 46 |
\catcode`\}=\other \catcode`\$=\other \catcode`\&=\other |
| 47 |
\catcode`\#=\other \catcode`\~=\other |
| 48 |
\catcode`\_=\other \catcode`\^=\other} |
| 49 |
\def\mft@nocats{\mft@noc@ts \catcode`\%=\other} |
| 50 |
\def\mft@finstring"#1"{\tentex"#1"\egroup} |
| 51 |
|
| 52 |
\newbox\mft@shorthyf \setbox\mft@shorthyf=\hbox{-\kern-.05em} |
| 53 |
\mathchardef\period=`\. |
| 54 |
{\catcode`\-=\active \global\def-{\copy\mft@shorthyf\mkern3.9mu} |
| 55 |
\catcode`\.=\active \global\def.{\period\mkern3mu}} |
| 56 |
|
| 57 |
\def\mftbf{\fam\bffam |
| 58 |
\def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}% |
| 59 |
\tenbf} |
| 60 |
|
| 61 |
\def\join#1${} % say %%\join in .mf file to join lines together |
| 62 |
\def\]{\hskip0pt plus 1filll\ } % say % comment\] to get comment flush left |
| 63 |
|
| 64 |
{\obeyspaces \global\let =\ } % don't skip spaces which begin a line |
| 65 |
|
| 66 |
\def\mft@verbatimtex{\begingroup |
| 67 |
\def\par{\leavevmode\endgraf}% don't skip empty lines |
| 68 |
\mft@nocats \obeyspaces \obeylines \tt} |
| 69 |
|
| 70 |
% the percent sign in btex .. etex group is a comment character. |
| 71 |
\def\mft@btex{\begingroup \mft@noc@ts \obeyspaces \tt} |
| 72 |
|
| 73 |
% Names `\mftbeginV', `\mftbeginB', and `\mftend' are hard-wired into MFT |
| 74 |
|
| 75 |
\outer\def\mftbeginV#1{\5{#1}$\mftverbatimtex} |
| 76 |
\outer\def\mftbeginB#1{\5{#1}$\mftbtex} |
| 77 |
\def\mftend#1{$\5{#1}} |
| 78 |
|
| 79 |
\outer\def\mftverbatimtex{\let\par=\endgraf \mft@verbatimtex \parskip=\z@ |
| 80 |
\mft@finish} |
| 81 |
\outer\def\mftbtex{\mft@btex \mft@finish} |
| 82 |
|
| 83 |
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character |
| 84 |
|obeylines % end of line is active |
| 85 |
|gdef|mft@finish#1\mftend{#1|endgroup|mftend}} |
| 86 |
|
| 87 |
\catcode`\@=12 |
| 88 |
|
| 89 |
\endinput |