summaryrefslogtreecommitdiff
path: root/info/examples/tip/prot.tip
blob: 771a25fd2ff94e1d91c23a7986bb4040177fdbac (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
% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 29.6.1, p. III-525.
% Original source in file "io2.TEX", starting line 1774.
\wlog{L: "prot.tip" ["io2.TEX," l. 1774, p. III-525]}%
% This file DOES belong to format "texip."
\InputD{doloop.tip}
\InputD{mspaces.tip}
\catcode`\@ = 11
\newif\ifProtWrite
\ProtWritetrue
\newcount\@ProtCount
\newcount\@ProtCountX
\newwrite\@ProtWrite
\def\InitProtWrite{% 
    \ifProtWrite
        \immediate\openout\@ProtWrite = \jobname.prt
    \fi
}
\def\CloseProtWrite{% 
    \immediate\closeout\@ProtWrite
}
\def\WriteProtocol #1#2{%
    \ifProtWrite
        {% 
            \@ProtCount = #1\relax
            \def\@WriteSpace{}%
            \DoLoop{\count1}{1}{1}{\@ProtCount}% 
                {\edef\@WriteSpace{\@WriteSpace\FourSpaces}}%
            \immediate\write\@ProtWrite{\@WriteSpace #2}%
        }%
    \fi
}
\def\BoxToProtocol #1#2#3{% 
    \ifProtWrite
        {%
            \WriteProtocol {#1}{\string\BoxToProtocol: #3}%
            \@ProtCountX = #1\relax
            \advance\@ProtCountX by 1
            \ifvoid #2%
                \WriteProtocol{\@ProtCountX}{Box register #2
                    is void.}%
            \else
                \ifhbox #2%
                    \WriteProtocol{\@ProtCountX}{Box register #2
                        is an hbox.}%
                \else
                    \WriteProtocol{\@ProtCountX}{Box register #2
                        is a vbox.}%
                \fi
            \fi
            \ifvoid #2%
            \else
                \WriteProtocol{\@ProtCountX}% 
                    {Dimensions: (\the\ht#2+\the\dp#2)*\the\wd#2.}%
            \fi
        }%
    \fi
}
\catcode`\@ = 12