summaryrefslogtreecommitdiff
path: root/info/examples/tex-in-practice/boxrqu.tip
diff options
context:
space:
mode:
Diffstat (limited to 'info/examples/tex-in-practice/boxrqu.tip')
-rw-r--r--info/examples/tex-in-practice/boxrqu.tip118
1 files changed, 118 insertions, 0 deletions
diff --git a/info/examples/tex-in-practice/boxrqu.tip b/info/examples/tex-in-practice/boxrqu.tip
new file mode 100644
index 0000000000..62aaadd22a
--- /dev/null
+++ b/info/examples/tex-in-practice/boxrqu.tip
@@ -0,0 +1,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