% 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 34.5.1, p. IV-70.
% Original source in file "o1.TEX", starting line 532.
\wlog{L: "orcards.tip" ["o1.TEX," l. 532, p. IV-70]}%
% This file DOES NOT belong to format "texip."
\InputD{box-mac.tip}
\InputD{modonead.tip}
\InputD{nlm.tip}
\hsize = 3.0in
\baselineskip = 12pt
\topskip = 10pt plus 10pt
\vsize = 9\baselineskip
\countdef\PageNo = 0
\newcount\CardCount
\CardCount = 0
\def\Card #1{%
   \vfill\eject
   \advance\CardCount by 1
   \noindent
   {\bf #1}
   \par
   \def\CardTitle{#1}%
}
\newdimen\RuleSpace     \RuleSpace = 10pt
\newdimen\BetweenRules  \BetweenRules = 20pt
\newdimen\BaseLineSkipSave
\BaseLineSkipSave = \baselineskip
\newcount\PositionCount
\PositionCount = 0
\def\HeadLine{%
   \line{%
       \strut
       {\it Cards, page \the\PageNo}%
       \hfil
       \tt\jobname
   }%
}
\def\FootLine{%
   \line{\strut*****\hfil*****}%
}
\newbox\OutTopBox
\newbox\OutMidBox
\newbox\OutBotBox
\def\CardOutputRoutine{%
   \NewLineMessage{\string\CardOutputRoutine:
       card number: \the\CardCount,
       PositionCounter: \the\PositionCount,}%
   \NewLineMessage{page number: \the\PageNo,
       \string\outputpenalty: \the\outputpenalty.}%
   \ifnum\outputpenalty < -9999
       \setbox0 = \hbox{\strut}
   \else
       \setbox0 = \line{%
           \strut
           \hfil
           \it
           \CardTitle\space con't\/\dots
       }%
   \fi
   \setbox 2 = \vbox{%
       \offinterlineskip
       \hrule
       \vskip\RuleSpace
       \VboxR to \vsize{\unvbox 255 \vfill}
       \box0
       \vskip\RuleSpace
       \hrule
   }
   \global\setbox
       \ifcase\PositionCount
           \OutTopBox \or
           \OutMidBox \or
           \OutBotBox
       \fi
       = \box2
   \ifnum\PositionCount = 2
       \shipout\vbox{%
           \offinterlineskip
           \VboxR{
               \HeadLine
               \vskip\BaseLineSkipSave

               \box\OutTopBox
               \vskip\BetweenRules
               \box\OutMidBox
               \vskip\BetweenRules
               \box\OutBotBox

               \vskip\BaseLineSkipSave
               \FootLine
           }
       }
   \fi
   \ifnum\outputpenalty = -20000
       \NewLineMessage{\string\supereject\space encountered.}
       \ifnum\PositionCount < 2
           \line{}
           \vfill
           \supereject
       \fi
   \fi
   \ifnum\ModuloOneAdvanceNumCond{\PositionCount}{3} = 0
       \global\advance\pageno by 1
   \fi
}
\output = {\CardOutputRoutine}