summaryrefslogtreecommitdiff
path: root/info/examples/tip/pm-4.tip
blob: 86721bf4f7644006f7b9136865311ca259eea23b (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
112
113
114
115
116
117
118
119
120
121
122
% 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.5, p. III-555.
% Original source in file "pp1.TEX", starting line 1123.
\wlog{L: "pm-4.tip" ["pp1.TEX," l. 1123, p. III-555]}%
% This file DOES NOT belong to format "texip."
\InputD{robust.tip}
\InputD{input-at.tip}
\InputD{mspaces.tip}
\catcode`\@ = 11
\let\@ex = \expandafter
\def\WriteToAuxSpecial #1#2#3#4#5{% 
    {% 
        \@MakeRobustMacros
        \edef\@WriteTemp{%
            \string\@ForSpecialFile{#1}{#2}{#3}%
        }% 
        \@ex\@ex\@ex\@p@write\@ex{\@WriteTemp}% 
        \edef\@WriteTemp{\EightSpaces{#4}}% 
        \@ex\@ex\@ex\@p@write\@ex{\@WriteTemp}% 
        \@p@write{\EightSpaces{#5}}%
    }% 
}
\def\TableOfContents #1{% 
    \@TableOrListOfSomething{\TocFileNameExtension}{#1}%
}
\def\ListOfFigures #1{% 
    \@TableOrListOfSomething{\LofFileNameExtension}{#1}%
}
\def\ListOfTables #1{% 
    \@TableOrListOfSomething{\LotFileNameExtension}{#1}%
}
\def\@TableOrListOfSomething #1#2{% 
    \wlog{\string\@TableOrListOfSomething (#1: "#2")}% 
    \def\@SomethingFileList{}%
    \if\EmptyStringConditional{#2}%
        \wlog{\EightSpaces (whole document)}% 
        \edef\@SpecialFileBaseName{\jobname}%
        \i@write\@TmpFileStream{% 
            \string\@BuildSpecialFile
                {#1}%
                {\@SpecialFileBaseName.#1}%
        }%
        {%
            \def\\##1{%
                \i@write\@TmpFileStream
                {\string\InputC{##1.\AuxFileNameExtension}}}%
            \@AllPartsOfDocumentList
        }%
    \else
        \wlog{\EightSpaces (some parts only)}% 
        \edef\@SpecialFileBaseName{\CurrentPartName}%
        \i@write\@TmpFileStream{% 
            \noexpand\@BuildSpecialFile
            {#1}% 
            {\@SpecialFileBaseName.#1}% 
        }
        \ConvertArgsToListAndAppend{\@SomethingFileList}{#2}%
        {%
            \def\\##1{% 
                \i@write\@TmpFileStream
                {\string\InputC{##1.\AuxFileNameExtension}}% 
                \if\MemberOfListConditional
                    {\@AllPartsOfDocumentList}{##1}%
                \else
                    \wlog{\string\@TableOrListOfSomething:
                        WARNING: part "##1" does NOT
                        belong to this document!}%
                \fi
            }% 
            \@SomethingFileList
        }%
    \fi
    \i@write\@TmpFileStream{\string\@EndBuildSpecialFile}%
    \InputCWithAt{\@SpecialFileBaseName.#1}%
}
\def\@BuildNewSpecialFiles{% 
    \wlog{\string\@BuildNewSpecialFiles: started.}% 
    \InputAt{\jobname.\TmpFileNameExtension}% 
    \wlog{\string\@BuildNewSpecialFiles: done.}% 
}
\def\@BuildSpecialFile #1#2{% 
    \begingroup
    \@MakeRobustMacros
    \wlog{\string\@BuildSpecialFile: working on "#2".}% 
    \@IgnoreAuxStuff
    \let\@ForSpecialFile = \@ForSpecialFileSave
    \def\@ForSpecialFileExtension{#1}%
    \OpenGenericOStream{#2}%
}
\def\@ForSpecialFileSave #1#2#3#4#5{%
    \if\StringsEqualConditional{#1}{\@ForSpecialFileExtension}%
        \i@write\GenericOStream{%
            \string\EntryInto#1%
            {#2}{#3}% 
        }% 
        \i@write\GenericOStream{% 
            \EightSpaces{#4}%
        }% 
        \i@write\GenericOStream{% 
            \EightSpaces{#5}%
        }% 
    \fi
}%
\def\@EndBuildSpecialFile{% 
    \CloseGenericOStream
    \wlog{\string\@EndBuildSpecialFile: closed file}% 
    \endgroup
}
\catcode`\@ = 12