<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% QUEUE MACROS for LaTeX2e, version 1.01,
% written by Herman Haverkort, 14 february 1995

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hhqueue}[1995/02/14]

% The \h@@@getfirst and \h@@@enqueue macro's which are defined below are
% modifications of \lop and \rightappenditem which are found in
% Computers &amp; Typesetting by Donald Knuth. The representation of queues
% and lists is like his.

\newtoks\@temptokenb

\def\h@getfirst#1{\expandafter\h@@getfirst\csname #1\endcsname}
\def\h@@getfirst#1#2{%
  \expandafter\h@@@getfirst\expandafter #1\csname hq@#2\endcsname}
\def\h@@@getfirst#1#2{\expandafter\h@@@@getfirst #2\h@qend#2#1}
\def\h@@@@getfirst\\#1#2\h@qend#3#4{\gdef#4{#1}\gdef#3{#2}}

\def\h@delete#1{\expandafter\h@@delete\csname #1\endcsname}
\def\h@@delete#1#2{%
  \expandafter \expandafter
  \expandafter \h@@@delete
  \expandafter \expandafter
  \expandafter {%
  \expandafter #1%
  \expandafter }%
  \csname hq@#2\endcsname}
\def\h@@@delete#1#2{{%
  \let\tempa=#2%
  \def\tempb{#1}%
  \h@@@initqueue#2{}%
  \def\\##1{\def\tempc{##1}\ifx\tempb\tempc\else\h@@@enqueue{##1}#2\fi}%
  \tempa}}
% Some rather tricky macro which is said to be efficient can be found
% in the TeXbook by Donald Knuth, appendix D, section 2.

\def\h@enqueue#1{\expandafter\h@@enqueue\csname #1\endcsname}
\def\h@@enqueue#1#2{%
  \expandafter \expandafter
  \expandafter \h@@@enqueue
  \expandafter \expandafter
  \expandafter {%
  \expandafter #1%
  \expandafter }%
  \csname hq@#2\endcsname}
\def\h@@@enqueue#1#2{%
  \@temptokena=\expandafter{#2}%
  \@temptokenb={\\{#1}}%
  \xdef#2{\the\@temptokena\the\@temptokenb}}

\def\h@ifqempty#1{\expandafter\h@@@ifqempty\csname hq@#1\endcsname}
\def\h@@@ifqempty#1#2#3{\ifx#1\@empty#2\else#3\fi}

\def\h@ifqnonempty#1{\expandafter\h@@@ifqnonempty\csname hq@#1\endcsname}
\def\h@@@ifqnonempty#1#2{\ifx#1\@empty\else#2\fi}

\def\h@initqueue#1{\expandafter\h@@@initqueue\csname hq@#1\endcsname}
\def\h@@@initqueue#1{\gdef#1}

\def\h@processq#1{\@nameuse{hq@#1}}

</pre></body></html>