% 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 30.7.3, p. III-549.
% Original source in file "pp1.TEX", starting line 825.
\wlog{L: "pm-main.tip" ["pp1.TEX," l. 825, p. III-549]}%
% This file DOES NOT belong to format "texip."
\InputD{conval.tip}
\InputD{ts-wind.tip}
\catcode`\@ = 11
\newif\ifPartVerbose
\PartVerbosefalse
\def\InitialParts{%
   \def\@AllPartsOfDocumentList{}%
   \def\@ToProcessList{}%
}
\def\DocPart #1{%
   \ConvertArgsToListAndAppend{\@AllPartsOfDocumentList}{#1}%
   \ifPartVerbose
       {%
           \wlog{\string\DocPart: List now current list of parts
               of this document:}%
           \def\\##1{\wlog{Document part "##1"}}%
           \@AllPartsOfDocumentList
       }%
   \fi
}
\def\ProcessPart #1{%
   \ConvertArgsToListAndAppend{\@ToProcessList}{#1}%
   \ifPartVerbose
   {%
       \wlog{\string\ProcessPart: List of parts which will
           be processed.}%
       \def\\##1{%
           \wlog{Part which will be processed:  "##1"}%
       }%
       \@ToProcessList
   }%
   \fi
}
\def\ProcessNow{%
   \wlog{\string\ProcessNow: Start reading
       all auxiliary files.}%
   \@IgnoreAuxStuff
   \let\@NewLabel = \Saved@NewLabel
   \@ReadInAuxFiles
   \wlog{\string\ProcessNow: Done reading all auxiliary files.}%
   \i@openout\@TmpFileStream = \jobname.\TmpFileNameExtension
   \let\@AllPartsOfDocumentListCopy = \@AllPartsOfDocumentList
   {%
       \def\\{\noexpand\@DoPart}%
       \xdef\@AllPartsOfDocumentListCopy{%
           \@AllPartsOfDocumentListCopy
       }%
   }%
   \@AllPartsOfDocumentListCopy
}
\newif\if@ProcessThisPart
\def\@DoPart #1{%
   \gdef\CurrentPartName{#1}%
   \@ProcessThisPartfalse
   \if\EmptyListConditional{\@ToProcessList}%
       \@ProcessThisParttrue
   \fi
   \if\MemberOfListConditional{\@ToProcessList}{\CurrentPartName}%
       \@ProcessThisParttrue
   \fi
   \if@ProcessThisPart
       \@DoPartProcess
   \else
       \@DoPartNotProcess
   \fi
}
\def\@DoPartProcess{%
   \wlog{\string\@DoPartProcess: process part "\CurrentPartName".}
   \i@openout\@PartAuxStream =
       \CurrentPartName.\AuxFileNameExtension
   \OpenIndexFiles{\CurrentPartName}%
   \input \CurrentPartName.\PartSourceFileNameExtension
   \EvalEveryParsCE
   \vfill\supereject
   \WriteCountersToAuxFile
   \wlog{\string\@DoPart: "\CurrentPartName" was processed.}%
   \i@closeout\@PartAuxStream
   \NameUse{CloseIndexFiles}%
}
\def\@DoPartNotProcess{%
   \wlog{\string\@DoPartNotProcess:
       "\CurrentPartName.\PartSourceFileNameExtension" not
       processed.}%
   \@IgnoreAuxStuff
   \let\@SetCounter = \SetCounter
   \InputCWithAt{\CurrentPartName.\AuxFileNameExtension}
   \@PageNumbersToCounterRegs
}
\def\EndProcessing{%
   \i@closeout\@TmpFileStream
   \@BuildNewSpecialFiles
}
\catcode`\@ = 12