% standard macros for CWEB listings (in addition to plain.tex)
% modified for use with "tex2pdf" --- March 1997
% Version 2.0 --- Don Knuth, July 1990
% Version 2.0 [german] --- Carsten Steger, October 1991
% Version 2.0 [german] --- Andreas Scherer, February 1993
% Version 2.7 --- Don Knuth, July 1992
% Version 2.7 [p6c] --- Andreas Scherer, September 1993
% Version 2.8 --- Don Knuth, September 1992
% Version 2.8 [german] --- Carsten Steger, 1993
% Version 2.8 [p7] --- Andreas Scherer, October 1993
% Version 3.0 --- Don Knuth, June 1993
% Version 3.0 [p8e] --- Andreas Scherer, November 1993
% Version 3.1 [p9b] --- Andreas Scherer, January 1994
% Version 3.1 [p9c] --- Andreas Scherer, March 1994
% Version 3.1 [p9d] --- Andreas Scherer, July 1994
% Version 3.2 [p10] --- Andreas Scherer, August 1994
% Version 3.2 [p10b] --- Andreas Scherer, October 1994
% Version 3.3 [p11a] --- Andreas Scherer, December 1994
% Version 3.3 [p11b] --- Andreas Scherer, March 1995
% Version 3.4 [p13] --- Andreas Scherer, August 1995
% Version 3.4 [p14] --- Andreas Scherer, March 1997
% Version 3.42 [p15] --- Andreas Scherer, August 1998
% Version 3.43 [p16] --- Andreas Scherer, October 1998
% Version 3.5 [p17] --- Andreas Scherer, December 1999
% Version 3.61 [p18] --- Andreas Scherer, July 2000
% Version 3.63 [p19] --- Andreas Scherer, January 2001
% Version 3.64 [p20] --- Andreas Scherer, March 2002
% Version 3.64 [p21] --- Andreas Scherer, Octobre 2005
% Version 3.64 [p22] --- Andreas Scherer, March 2016

\ifx\undefined\documentclass\input Xcwebmac.tex
\else\endinput\fi % LaTeX will use other macros

\input dcwebstrings.tex

\def\.#1{\leavevmode\hbox{\tentex % typewriter type for strings
  \ifx\Cstringchars\undefined\else\Cstringchars\fi % special string characters
  \let\\=\BS % backslash in a string
  \let\{=\LB % left brace in a string
  \let\}=\RB % right brace in a string
  \let\~=\TL % tilde in a string
  \let\ =\SP % space in a string
  \let\_=\UL % underline in a string
  \let\&=\AM % ampersand in a string
  \let\^=\CF % circumflex in a string
  \ifx\originalTeX\undefined\else\originalTeX\fi#1\kern.05em}}

\def\postATL#1 #2 {\bf Buchstabe \\{\uppercase{\char"#1}}
   wird getangled als \tentex "#2"\egroup\par}

\gtitle={\.{CWEB} Ausgabe} % this running head is reset by starred sections
\mark{\noexpand\nullsec0{\the\gtitle}}

\def\fin{\par\vfill\eject % this is done when we are ending the index
  \ifpagesaved\null\vfill\eject\fi % output a null index column
  \if L\lr\else\null\vfill\eject\fi % finish the current page
  \ifpdftex \makebookmarks \fi % added in Version 3.68
  \parfillskip 0pt plus 1fil
  \let\topsecno=\nullsec
  \redeffin
  \output={\normaloutput\page\lheader\rheader}
  \setpage
  \def\note##1##2.{\quad{\eightrm##1~\ifacro{\pdfnote##2.}\else{##2}\fi.}}
  \def\I{\par\hangindent 2em}\let\*=*
  \ifacro \let\Xpdf\X
  \ifpdftex \pdfdest name {NOS} fith
    \pdfoutline goto name {NOS} count -\secno {\outsecname}
    \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
      {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
      \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
  \else\ifpdf
    \special{pdf: outline -1 << /Title (\outsecname)
      /Dest [ @thispage /FitH @ypos ] >>}
    \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
      {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
      \special{pdf: outline 0 << /Title (\the\toksE)
        /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
  \fi\fi\fi
  \readsections}
\def\con{\par\vfill\eject % finish the section names
% \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
  \rightskip 0pt \hyphenpenalty 50 \tolerance 200
  \setpage \output={\normaloutput\page\lheader\rheader}
  \titletrue % prepare to output the table of contents
  \pageno=\contentspagenumber
  \redefcon
  \topofcontents \startpdf
  \line{\headerline}
  \let\ZZ=\contentsline
  \readcontents\relax % read the contents info
  \botofcontents \end} % print the contents page(s) and terminate
\def\today{\number\day.~\ifcase\month\or
  Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or
  Juli\or August\or September\or Oktober\or November\or Dezember\fi
  \space\number\year}
\def\hours{\twodigits=\time \divide\twodigits by60 \printtwodigits
  \null\space\sc Uhr\space % distinguish between time and year
  \multiply\twodigits by-60 \advance\twodigits by\time \printtwodigits}
\def\datethis{\def\startsection{\leftline{\sc\today\ um \hours}\bigskip
  \let\startsection=\stsec\stsec}}
  % say `\datethis' in limbo, to get your listing timestamped before section 1
\def\datecontentspage{% changed in version 3.66
  \def\botofcontents{\vfill
   \centerline{\covernote}
   \bigskip
   \leftline{\sc\today\ um \hours}}} % timestamps the contents page
