
%the following settings are adequate for European size a4 paper
\if@twoside
\textwidth 16cm  
\textheight 24 cm  
\topmargin -14mm    
\evensidemargin -5mm 
\oddsidemargin 3mm
\else
\textwidth 16cm  
\textheight 24 cm  
\topmargin -14mm    
\evensidemargin 3mm 
\oddsidemargin 3mm
\fi
%the following settings are adequate for US legal size paper
%\textwidth 16cm  
%\textheight 24 cm  
%\topmargin -14mm    
%\evensidemargin 3mm 
%\oddsidemargin 3mm
\sloppy 

\usepackage{noweb}
\setlength{\codemargin}{\parindent}
\def\nwendcode{\endtrivlist \endgroup } %\filbreak
\nwcodepenalty=0  %\@highpenalty
\let\nwdocspar=\par%\filbreak 

\def\nwendcode{\endtrivlist \endgroup }
\nwcodepenalty=0 
\let\nwdocspar=\par%\filbreak 
\let\nowebsize=\small%selects small font for code
%\nwcodetopsep = 3pt plus 1.2pt minus 1pt   so stehts im Orginal
\nwcodetopsep = 10pt plus .5pt minus .5pt

\newlength{\Lcodetopsep}
\setlength{\Lcodetopsep}{-10pt plus 1.2pt minus 1pt}
\newlength{\Lcodebotsep}
\setlength{\Lcodebotsep}{-12pt plus 1.2pt minus 1pt}
  
\newcommand{\headerline}[1]{
\smallskip\par
\parbox[t]{\textwidth}{{\bf #1}}\par
\nopagebreak
}
%empty line before bracket is crucial 

\newcounter{manctr}
\newenvironment{manual}{
\setcounter{manctr}{1}
\baselineskip 3.0ex   
%\spaceskip  .4em plus .25em minus .25em
%\xspaceskip .65em
\parskip 11pt plus 1pt minus 1pt
\parindent 0pt
\newcommand{\mansection}[1]{
\headerline{\arabic{manctr}. ##1}\stepcounter{manctr}}
\newcommand{\resetmancounter}{\setcounter{manctr}{1}}
}{}


\newcommand{\Lless}{\texttt{<}}
\newcommand{\Lgreater}{\texttt{>}}
\newcommand{\Ltemplateless}{\texttt{<}}
\newcommand{\Ltemplategreater}{\texttt{>}}
\newcommand{\<}{\ensuremath{\mathtt{<}}}
\renewcommand{\>}{\ensuremath{\mathtt{>}}}
\newcommand{\Lle}{\le}
\newcommand{\Lge}{\ge}
\newcommand{\Dplus}{{++}}
\newcommand{\Dminus}{{--}}
\newcommand{\Lass}[1]{\mathrel{{#1}{=}}}
\newcommand{\Lminuseq}{{-}{=}}
\newcommand{\Noteq}{{!}{=}}
%\newcommand{\Leq}{\equiv}
\newcommand{\Leq}{\mathbin {{=}{=}}}
\newcommand{\Larrow}{\rightarrow}
\newcommand{\tildeop}{{\sim}}
\newcommand{\Tildeop}{{\char126}}
\newcommand{\circumflexop}{\hbox{\^{}}}
\newcommand{\DP}{\hspace{.1em}{::}\hspace{-.2em}} % symbol for ::
\newcommand{\nspacedot}{\hspace{-0.09em}}
\newcommand{\nspaceunderscore}{\hspace{-0.13em}}
\newcommand{\Lrquote}{\mbox{'}}
\newcommand{\Llquote}{\mbox{`}}
\newcommand{\KLL}{@$\Lless\Lless$}           % geaendert von \<\<
\newcommand{\KGG}{@$\Lgreater\Lgreater$}
\newcommand{\DLK}{\mbox{\tt [[}}
\newcommand{\DRK}{\mbox{\tt ]]}}
\newcommand{\Ln}{\mbox{$\backslash${\tt n}}} 


\newcommand{\CC}{C\raise.06ex\hbox{\texttt{++}}}
\newcommand{\CCC}{C\raise.08ex\hbox{\texttt{++}}}
\newcommand{\gpp}{g\hbox{\texttt{++}\ }} 
\newcommand{\nat}{\hbox{\rm\vrule\kern-0.045em N}}
\newcommand{\real}{\hbox{\rm\vrule\kern-0.035em R}}

\newlength{\setspacing}
\setlength{\setspacing}{0.05em}
\newcommand{\sset}[1]{\{\hspace{\setspacing}#1\hspace{\setspacing} \}}
\newcommand{\set}[2]{ \left\{\hspace{\setspacing} #1 \mbox{ ; } #2 \hspace{\setspacing} \right\}  }
\newcommand{\range}[2]{[#1 \, .. \, #2]}

\newlength{\Labsspacing}
\setlength{\Labsspacing}{0.01em}
\newcommand{\precond}{{\it Precondition}: }
\newcommand{\Labs}[1]{%
\hbox{$| \hspace{\Labsspacing} #1 \hspace{\Labsspacing} |$}}

\newcommand{\Lvert}{|}
\newcommand{\Litem}[1]{\hbox{$\langle #1 \rangle$}}
\newcommand{\Lchunk}[1]{$\langle${\it #1}$\rangle$}


\newlength{\rowsep} \setlength{\rowsep}{0.7ex} 
%separation in two-row layout
\newlength{\entrysep} \setlength{\entrysep}{0.2ex} 
%additional space between entries

\newlength{\colsep} \settowidth{\colsep}{\ }    

\newlength{\typewidth} \setlength{\typewidth}{0.15\textwidth}    
\newlength{\longtypewidth} \setlength{\longtypewidth}{0.4\textwidth}    

\newlength{\callwidth} \setlength{\callwidth}{.25\textwidth}      

\newlength{\declwidth} \setlength{\declwidth}{0.25\textwidth}  

\newlength{\longcallwidth}
\newlength{\descriptwidth}
\newlength{\createtextwidth}
\newlength{\textminusdescriptwidth}
\newlength{\typepluscallwidth}

\newcommand{\computewidths}{
          \setlength{\createtextwidth}{\textwidth}
          \addtolength{\createtextwidth}{-\declwidth}             

          \setlength{\longcallwidth}{\textwidth} 
          \addtolength{\longcallwidth}{-\typewidth}

         \setlength{\descriptwidth}{\textwidth}
         \addtolength{\descriptwidth}{-\typewidth}
         \addtolength{\descriptwidth}{-\callwidth} 

         \setlength{\textminusdescriptwidth}{\textwidth}
         \addtolength{\textminusdescriptwidth}{-\descriptwidth}

         \setlength{\typepluscallwidth}{\typewidth}
         \addtolength{\typepluscallwidth}{\callwidth}
       }

\newcommand{\setopdims}[2]{
  \setlength{\typewidth}{#1}  %\typewidth=#1cm
  \setlength{\callwidth}{#2}  %\callwidth=#2cm
  \computewidths
}


\computewidths    % initializes all widths


\usepackage{ifthen}
\newlength{\actualcallwidth}
\newlength{\actualtypewidth}
\newlength{\actualtypepluscallwidth}
\newlength{\fnamewidth}
\newlength{\checkwidth}
\newcommand{\returntype}{\,}

\newcommand{\function}[4]{
   \setlength{\checkwidth}{\typewidth}
   \renewcommand{\returntype}{#1}   
   \addtolength{\checkwidth}{\callwidth}
   \addtolength{\checkwidth}{\descriptwidth}
   \ifthenelse{\lengthtest{\checkwidth = \textwidth}}
              {}
              {\typein{WARNING: The invariant 
\typewidth + \callwidth + \descriptwidth = \textwidth is violated. 
Did you change one of the quantities without calling
\protect\computewidths? I do it for you. If the output looks okay
and you changed textwidth after reading in Lweb.sty it is safe to ignore
this warning. Type any character to proceed.}
\computewidths}

       \settowidth{\actualcallwidth}{#2(#3)}        
       \settowidth{\actualtypewidth}{#1}
       \addtolength{\actualcallwidth}{\colsep}
       \addtolength{\actualtypewidth}{\colsep} 
       \ifthenelse{\actualtypewidth > \longtypewidth}
       {\parbox[t]{\textwidth}{#1}\\
       \renewcommand{\returntype}{\ }
        \settowidth{\actualtypewidth}{\returntype}
        \addtolength{\actualcallwidth}{\colsep}
       }
       {} %empty else case
       \ifthenelse{\actualtypewidth > \typewidth}
       {
        \settowidth{\actualtypepluscallwidth}{#1\ #2(#3)}
        \addtolength{\actualtypepluscallwidth}{\colsep}
        \ifthenelse{\actualtypepluscallwidth > \typepluscallwidth}
        {% begin then1
       \settowidth{\fnamewidth}{#1\ #2(}%
       \setlength{\parlistwidth}{\textwidth}%
       \addtolength{\parlistwidth}{-\fnamewidth}%
       \noindent
       \parbox[t]{\textwidth}{%
       \parbox[t]{\fnamewidth}{#1\ #2(}%
       \parbox[t]{\parlistwidth}{\raggedright \sloppy #3)}\vspace{\rowsep}\\%
       \hspace*{\typewidth}\hfill\parbox[t]{\descriptwidth}
       {\sloppy #4 }%
       }%end big parbox       
       }%end then1
       {%else descript on same line
       \parbox[t]{\typepluscallwidth}{#1\ #2(#3)}%  
       \parbox[t]{\descriptwidth}{\sloppy #4 }%
       }% end else descript on same line 
       }% end return type does not fit
       {% else return type fits                      
       \ifthenelse{\actualcallwidth > \callwidth}
      {\settowidth{\fnamewidth}{#2(}%
       \setlength{\parlistwidth}{\longcallwidth}%
       \addtolength{\parlistwidth}{-\fnamewidth}%
       \noindent
       \parbox[t]{\textwidth}{%
       \parbox[t]{\typewidth}{\returntype}\parbox[t]{\fnamewidth}{#2(}%
       \parbox[t]{\parlistwidth}{\raggedright \sloppy #3)}\vspace{\rowsep}\\%
       \hspace*{\typewidth}\hfill\parbox[t]{\descriptwidth}{\sloppy  #4 }%
       }%end big parbox       
      }%end then
      {
       \noindent\parbox[t]{\typewidth}{\fussy \returntype}%
       \parbox[t]{\callwidth}{\raggedright \sloppy  #2(#3)}%\hspace{\colsep} 
       \parbox[t]{\descriptwidth}{\sloppy  #4}%
      }%end else
      }%end return type fits
       \vspace{\entrysep}
       \par
       }

\newcommand{\operator}[3]{%
       \smallskip
       \settowidth{\actualcallwidth}{#2} 
       \settowidth{\actualtypewidth}{#1}
       \addtolength{\actualcallwidth}{\colsep}
       \addtolength{\actualtypewidth}{\colsep} 
       \ifthenelse{\actualtypewidth > \typewidth}
       {%\typeout{WARNING: #1 is too long to fit into the box provided
%for the return type. I adopt another layout style. }
        %\typein{\\Type anything to acknowledge.}
        \settowidth{\actualtypepluscallwidth}{#1\ #2}
        \addtolength{\actualtypepluscallwidth}{\colsep}
        \ifthenelse{\actualtypepluscallwidth > \typepluscallwidth}
        {\parbox[t]{\textwidth}{%
       \parbox[t]{\textwidth}{#1\ #2}\vspace{\rowsep}\\%
       \hspace*{\textminusdescriptwidth}\parbox[t]{\descriptwidth}{\sloppy #3}%
       } %end big parbox
       }
       {%else descript on same line
       \parbox[t]{\typepluscallwidth}{#1\ #2}  
       \parbox[t]{\descriptwidth}{\sloppy #3}%
       }
       }
       {%else return type fits                     
       \ifthenelse{\actualcallwidth > \callwidth}
      {
       \noindent
       \parbox[t]{\textwidth}{%
       \parbox[t]{\typewidth}{\fussy #1}\parbox[t]{\longcallwidth}{\raggedright \sloppy #2}\vspace{\rowsep}\\%
       \hspace*{\textminusdescriptwidth}\parbox[t]{\descriptwidth}{\sloppy #3}%
       } %end big parbox
      }%end then
      {
       \noindent\parbox[t]{\typewidth}{\fussy #1}%\hspace{\colsep}
       \parbox[t]{\callwidth}{\raggedright \sloppy  #2}%\hspace{\colsep}%  
       \parbox[t]{\descriptwidth}{\sloppy #3}%
      }%end else
      }%end outermost else
       \vspace{\entrysep}
       \par
       }



\usepackage{ifthen}
\newlength{\actualdeclwidth} \newlength{\parlistwidth}
\newcommand{\decl}{\,}        % was empty before but creates trouble 2html
\newcommand{\createtype}{\,}  % was empty before but creates trouble 2html
\newlength{\actualtypeplusnamewidth}
\newlength{\createtypewidth}

\newcommand{\create}[4]{
   \setlength{\checkwidth}{\declwidth}   
   \addtolength{\checkwidth}{\createtextwidth}
   \ifthenelse{\lengthtest{\checkwidth = \textwidth}}
              {}
              {\typein{WARNING: The invariant 
\declwidth + \createtextwidth = \textwidth is violated. 
Did you change one of the quantities without calling
\protect\computewidths? I do it for you. If the output looks okay and you
changed textwidth after reading Lweb.sty it is safe to ignore this warning. 
Type any character to proceed.}
\computewidths}
   \ifthenelse{\equal{#3}{}}%
   {\renewcommand{\decl}{#1\ \ #2;}}%
   {\renewcommand{\decl}{#1\ \ #2(#3);}}% end of ifthenelse
   \settowidth{\createtypewidth}{#1}
   \ifthenelse{\createtypewidth > \longtypewidth}
   {\parbox[t]{\textwidth}{#1}\\
    \ifthenelse{\equal{#3}{}}%
    {\renewcommand{\decl}{\hspace*{\typewidth}#2;}}%
    {\renewcommand{\decl}{\hspace*{\typewidth}#2(#3);}}
   }{}
   \settowidth{\actualdeclwidth}{\decl}
   \addtolength{\actualdeclwidth}{\colsep}
   \ifthenelse {\actualdeclwidth > \declwidth}
         {%\typeout{decl is long}
          \ifthenelse{\actualdeclwidth > \textwidth}
             {%\typeout{decl is very long}
              \settowidth{\actualtypeplusnamewidth}{#1\ \ #2(}%
               \setlength{\parlistwidth}{\textwidth}%
               \addtolength{\parlistwidth}{-\actualtypeplusnamewidth}%
               \parbox[t]{\textwidth}{%
               \parbox[t]{\actualtypeplusnamewidth}{#1\ \ #2(}%
                \parbox[t]{\parlistwidth}{\raggedright #3);}%
                \vspace{\rowsep}\\%
               \hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #4 }% 
                                      }%end parbox
             }
             {%\typeout{decl is long}
              \parbox[t]{\textwidth}{%
               \parbox[t]{\textwidth}{\decl}\vspace{\rowsep}\\%
               \hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy  #4 }% 
                                      }%end parbox
             }
       }%end then
       {%\typeout{decl is short}
\parbox[t]{\declwidth}{\decl}\parbox[t]{\createtextwidth}{\sloppy #4 }%
       }%end else
  \vspace{\entrysep}\par
    }


\usepackage{ifthen}
\newlength{\actualdestructwidth}

\newcommand{\destruct}[2]{
        \settowidth{\actualdestructwidth}{$\sim$#1()}
        \ifthenelse {\actualdestructwidth > \declwidth}
           { \noindent
             \parbox[t]{\textwidth}{%
                 \parbox[t]{\textwidth}{$\sim$#1()}\vspace{\rowsep}\\%
                 \hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #2}%
              } 
           }
           {\noindent\parbox[t]{\declwidth}{$\sim$#1()}%
            \parbox[t]{\createtextwidth}{\sloppy #2}%
           }
         \vspace{\entrysep}\par 
       }

\newlength{\firstcolwidth}

\newcommand{\enum}[3]{%
\settowidth{\firstcolwidth}{#1\ \{\ #2\ \}}
\ifthenelse {\firstcolwidth > \declwidth}{
\noindent\parbox[t]{\textwidth}{%
\parbox[t]{\textwidth}{#1\ \{\ #2\ \}}\vspace{\rowsep}\\%
\hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #3}%
}}% else
{\noindent\parbox[t]{\declwidth}{#1\ \{\ #2\ \}}%
\parbox[t]{\createtextwidth}{\sloppy #3}%
}\par}

\newcommand{\typemember}[2]{%
\settowidth{\firstcolwidth}{#1}
\addtolength{\firstcolwidth}{\colsep}
\ifthenelse {\firstcolwidth > \declwidth}{
\noindent\parbox[t]{\textwidth}{%
\parbox[t]{\textwidth}{#1}\vspace{\rowsep}\\%
\hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #2}%
}}
{\noindent\parbox[t]{\declwidth}{#1}%
\parbox[t]{\createtextwidth}{\sloppy #2}%
}\par}

\newcommand{\typedef}[3]{%
\settowidth{\firstcolwidth}{typedef #1 #2}
\ifthenelse {\firstcolwidth > \declwidth}{
\noindent\parbox[t]{\textwidth}{%
\parbox[t]{\textwidth}{typedef #1 #2}\vspace{\rowsep}\\%
\hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #3}%
}}% else
{\noindent\parbox[t]{\declwidth}{typedef #1\ #2\ }%
\parbox[t]{\createtextwidth}{\sloppy #3}%
}\par}

\newcommand{\event}[2]{%
\settowidth{\firstcolwidth}{#1}
\addtolength{\firstcolwidth}{\colsep}
\ifthenelse {\firstcolwidth > \declwidth}{
\noindent\parbox[t]{\textwidth}{%
\parbox[t]{\textwidth}{#1}\vspace{\rowsep}\\%
\hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #2}%
}}
{\noindent\parbox[t]{\declwidth}{#1}%
\parbox[t]{\createtextwidth}{\sloppy #2}%
}\par}




\newlength{\semwidth}
\setlength{\semwidth}{\textwidth}
\newlength{\semindent}
\settowidth{\semindent}{{\bf Semantics}:\ }
\addtolength{\semindent}{\parindent}
\addtolength{\semwidth}{-\semindent}

\newcommand{\semantics}[1]{
\nopagebreak%\hspace{\codemargin}
{\bf Semantics}:\ \parbox[t]{\semwidth}{#1}
\vspace{2ex}

}


\newcommand{\noeffect}{}

\newenvironment{Lcode}{%
%\addtolength{\topsep}{-8pt}% am 11. April zu 2.8 von 2.5ex geandert
\vspace{\Lcodetopsep}
\@begincode  
}{\endtrivlist\vspace{\Lcodebotsep}
%\vspace{0.3ex}  
% Leerzeile ist wichtig?? am 11 April 99 zu 0.3 geaendert von 0.5
}

\newlength{\Lemptyline}
%\setlength{\Lemptyline}{1ex} changed by KM for Book 99
\setlength{\Lemptyline}{0.7ex plus 0.1ex minus 0.1ex} 
\newcount\Lhighpen \Lhighpen=10000
\newcount\Llowpen \Llowpen=-30


