blob: 62aaadd22af5f521edb750314f0ffb3512a8df34 (
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
|
% 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 27.3.2, p. III-424.
% Original source in file "macros7.TEX", starting line 1362.
\wlog{L: "boxrqu.tip" ["macros7.TEX," l. 1362, p. III-424]}%
% This file DOES belong to format "texip."
\InputD{namedef.tip}
\InputD{doloop.tip}
\InputD{newoutfr.tip}
\InputD{mspaces.tip}
\catcode`\@ = 11
\newcount\@BoxRQStart
\newcount\@BoxRQEnd
\newcount\@BoxRQLength
\newcount\@BoxRQCount
\newcount\@BoxRQLast
\newcount\@BoxRQFirst
\def\@LoadBRQCounters #1{%
\if\NameDefinedConditional{@BoxRQ-Start-#1}%
\@BoxRQStart = \NameUse{@BoxRQ-Start-#1}%
\@BoxRQEnd = \NameUse{@BoxRQ-End-#1}%
\@BoxRQLength= \NameUse{@BoxRQ-Length-#1}%
\@BoxRQCount = \NameUse{@BoxRQ-Count-#1}%
\@BoxRQLast = \NameUse{@BoxRQ-Last-#1}%
\@BoxRQFirst = \NameUse{@BoxRQ-First-#1}%
\else
\errmessage{\string\@LoadBRQCounters: no queue "#1".}%
\fi
}
\def\@RestoreBRQCounters #1{%
\NameXdef{@BoxRQ-Start-#1}{\the\@BoxRQStart}%
\NameXdef{@BoxRQ-End-#1}{\the\@BoxRQEnd}%
\NameXdef{@BoxRQ-Length-#1}{\the\@BoxRQLength}%
\NameXdef{@BoxRQ-Count-#1}{\the\@BoxRQCount}%
\NameXdef{@BoxRQ-Last-#1}{\the\@BoxRQLast}%
\NameXdef{@BoxRQ-First-#1}{\the\@BoxRQFirst}%
}
\newcount\@BoxRQTempA \newcount\@BoxRQTempB
\def\SetUpBoxRegisterQueue #1#2{%
\@BoxRQStart = \count14
\advance\@BoxRQStart by 1
\@BoxRQTempA = \@BoxRQStart
\DoLoop{\@BoxRQTempB}{1}{1}{#2}%
{\newboxOF\@WhoCaresBoxRegisterIndexA
\advance\@BoxRQTempA by 1 }
\advance\@BoxRQTempA by -1
\@BoxRQEnd = \@BoxRQTempA
\wlog{\string\SetUpBoxRegisterQueue: queue "#1."}%
\wlog{\EightSpaces Box registers
\the\@BoxRQStart\space through
\the\@BoxRQEnd\space allocated.}%
\wlog{\EightSpaces (#2 registers).}%
\@BoxRQCount = 0
\@BoxRQLength = #2
\@RestoreBRQCounters{#1}%
}
\def\AddBoxToQueue #1#2{%
\@LoadBRQCounters{#1}%
\wlog{\string\AddBoxToQueue: length: \the\@BoxRQLength,
count: \the\@BoxRQCount}%
\ifnum\@BoxRQCount = \@BoxRQLength
\errmessage{\string\AddBoxToQueue: Queue "#1" is full.}%
\else
\ifnum\@BoxRQCount = 0
\@BoxRQLast = \@BoxRQStart
\@BoxRQFirst = \@BoxRQStart
\fi
\global\setbox\@BoxRQLast = #2%
\advance\@BoxRQLast by 1
\ifnum\@BoxRQLast > \@BoxRQEnd
\@BoxRQLast = \@BoxRQStart
\fi
\advance\@BoxRQCount by 1
\@RestoreBRQCounters{#1}%
\fi
}
\def\CopyFirstElementFromQueue #1#2{%
\@LoadBRQCounters{#1}%
\ifnum\@BoxRQCount = 0
\errmessage{\string\CopyFirstElementFromQueue: empty "#1"}%
\else
\setbox #2 = \copy\@BoxRQFirst
\fi
}
\def\DropFirstBoxOfQueue #1{%
\@LoadBRQCounters{#1}%
\ifnum\@BoxRQCount = 0
\errmessage{\string\DropFirstBoxOfQueue: "#1" is empty.}%
\else
\advance\@BoxRQCount by -1
\ifnum\@BoxRQCount = 0
\else
\advance\@BoxRQFirst by 1
\ifnum\@BoxRQFirst > \@BoxRQEnd
\@BoxRQFirst = \@BoxRQStart
\fi
\fi
\fi
\@RestoreBRQCounters{#1}%
}
\def\EmptyBoxRegisterQueueConditional #1{%
TT\fi
\@LoadBRQCounters{#1}%
\ifnum\@BoxRQCount = 0
}
\catcode`\@ = 12
|