% 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