summaryrefslogtreecommitdiff
path: root/info/examples/tip/pm-main.tip
blob: 2ec228749536b4dd8541ceaed04fa527fb23e915 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
% 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