%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  AlProTex.sty                       2008-06-09-16:59  %
%  Copyright (C) 1992--2008  by Eitan M. Gurari         %
%                                                       %
% This program can redistributed and/or modified under  %
% the terms of the LaTeX Project Public License         %
% Distributed from CTAN archives in directory           %
% macros/latex/base/lppl.txt; either version 1 of the   %
% License, or (at your option) any later version.       %
%                                                       %
% However, you are allowed to modify this program       %
% without changing its name, if you modify its          %
% signature. Changes to the signature can be introduced %
% with a directive of the form                          %
%            \message{signature}                        %
%                                                       %
%                            gurari@cse.ohio-state.edu  %
%                http://www.cse.ohio-state.edu/~gurari  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\immediate\write-1{version 2008-06-09-16:59}

\expandafter\edef\csname :RestoreCatcodes\endcsname{%
   \catcode`\noexpand\noexpand\noexpand \^=\the\catcode`\^%
   \catcode`\noexpand\noexpand\noexpand \_=\the\catcode`\_%
}
\catcode`\^=7  \catcode`\_=8
\expandafter\edef\csname :RestoreCatcodes\endcsname{%
   \csname :RestoreCatcodes\endcsname
   \csname du:cc\endcsname
   \catcode`\noexpand "=\the\catcode`\"%
   \catcode`\noexpand |=\the\catcode`\|%
   \catcode`\noexpand :=\the\catcode`:%
   \catcode`\noexpand @=\the\catcode`@%
   \catcode`\noexpand -=\the\catcode`-%
   \catcode`\noexpand +=\the\catcode`+%
   \catcode`\noexpand /=\the\catcode`/%
   \catcode`\noexpand .=\the\catcode`.%
   \catcode`\noexpand \^^M=\the\catcode`\^^M%
   \catcode`\noexpand \^^I=\the\catcode`\^^I%
   \catcode`\noexpand \%=\the\catcode`\%%
   \let\expandafter\noexpand
      \csname:RestoreCatcodes\endcsname=\noexpand\undefined}
\catcode`\@=11  \catcode`\:=11  \catcode`\"=12  \catcode`\|=12
\def\TagLine[#1]{}     \def\ResetLineCount{}
\def\RefLine[#1]{}     \def\ShowLineCount{}
\def\HideLineCount{}   \def\PauseLineCount{}
\def\ContLineCount{} \def\:InitAlProTex#1,#2//{
   \def\:InitAlProTex{#1}%
   \let\:ModifyOutputCodeO=\ModifyOutputCode
   \def\ModifyOutputCode{\def\Extension{#1}\:ModifyOutputCodeO}
   \ifx \html:addr\:UnDeF    \def\AlProTex{#2}\else
      \ifx \html:addr\empty  \def\AlProTex{#2}\else
                        \def\AlProTex{html,#2}\fi \fi}

\expandafter\:InitAlProTex\AlProTex,//


\def\:temp{\csname newif\endcsname}
\expandafter\ifx \csname :Optionfalse\endcsname\relax
    \expandafter\:temp \csname if:Option\endcsname
\fi
\def\:CheckOption#1{ \def\:temp{#1}
   \:Optionfalse
   \expandafter\:GetOptions\AlProTex,,// }

\def\:GetOptions#1,#2//{  \def\:next{#1}
   \ifx        \:next\empty
   \else \ifx  \:temp\:next   \:Optiontrue   \let\:next=\relax
   \else \def\:next{\:GetOptions#2//}
   \fi  \fi  \:next }
\def\:CntrlChar{`\\}
\catcode`\|=0  |catcode`|\=12
|def|:notex{\}
|catcode`|\=0 |catcode`||=12
\def\:temp{ \catcode`\@=12
   \def\:temp##1{\catcode`\@=11
                 \:CheckOption{##1}} \:temp}
\:temp{@}
\if:Option  \def\:CntrlChar{`\@}
\catcode`\@=12
\def\:notex{@}
\catcode`\@=11
\let\:ModifyAppendCodeII=\ModifyAppendCode
\let\:ModifyShowCodeII=\ModifyShowCode
\let\:ModifyOutputCodeII=\ModifyOutputCode
\def\ModifyAppendCode{\catcode`\@=0   \catcode`\\=12
   \:ModifyAppendCodeII}
\def\ModifyOutputCode{\def\@{@}\:ModifyOutputCodeII}
\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\@{\char64 }}
\else  \ifx \:ModifyAppendCodeII\:undefined
   \:CheckOption{|}   \if:Option
   \def\:CntrlChar{`\|}
\def\:notex{|}
\let\:ModifyAppendCodeII=\ModifyAppendCode
\let\:ModifyShowCodeII=\ModifyShowCode
\let\:ModifyOutputCodeII=\ModifyOutputCode
\def\ModifyAppendCode{\catcode`\|=0   \catcode`\\=12
   \:ModifyAppendCodeII}
\def\ModifyOutputCode{\def\|{|}\:ModifyOutputCodeII}
\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\|{\char124 }}
\else   \ifx \:ModifyAppendCodeII\:undefined
   \:CheckOption{`}   \if:Option
   \def\:CntrlChar{`\`}
\def\:notex{`}
\let\:ModifyAppendCodeII=\ModifyAppendCode
\let\:ModifyShowCodeII=\ModifyShowCode
\let\:ModifyOutputCodeII=\ModifyOutputCode
\def\ModifyAppendCode{\catcode`\`=0   \catcode`\\=12
   \:ModifyAppendCodeII}
\def\ModifyOutputCode{\def\`{`}\:ModifyOutputCodeII}
\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\`{\char96 }}
\else   \ifx \:ModifyAppendCodeII\:undefined
   \:CheckOption{?}   \if:Option
   \def\:CntrlChar{`\?}
\def\:notex{?}
\let\:ModifyAppendCodeII=\ModifyAppendCode
\let\:ModifyShowCodeII=\ModifyShowCode
\let\:ModifyOutputCodeII=\ModifyOutputCode
\def\ModifyAppendCode{\catcode`\?=0   \catcode`\\=12
   \:ModifyAppendCodeII}
\def\ModifyOutputCode{\def\?{?}\:ModifyOutputCodeII}
\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\?{\char63 }}
\fi \fi \fi \fi \fi \fi \fi\:CheckOption{xref}     \if:Option
   \csname newread\endcsname\sdx:file
\immediate\openin\sdx:file=\jobname.sdx
\csname newwrite\endcsname\cdx:file
\immediate\openout\cdx:file=\jobname.cpg
\let\xref:OutputCode=\OutputCode
\def\OutputCode#1{%
   {\Comment{ startcodefragment}{//}%
    \let\ProTexMssg=\:gobble
    \let\xref:ModifyOutputCode=\ModifyOutputCode
    \def\wrt:index##115{\immediate\write\cdx:file }%
    \def\ModifyOutputCode##1{\xref:ModifyOutputCode{##1}\bgroup
       \def\relax####115####215{\egroup
          \expandafter\wrt:index\:WriteCode
    }}%
    \xref:OutputCode#1}%
   \xref:OutputCode#1}

   \expandafter\ifx \csname tmp:cnt\endcsname\relax
   \csname newcount\endcsname\tmp:cnt
\fi
\def\change:cats#1#2#3{%
   \tmp:cnt#1
   \def\no::catcodes{%
      \catcode\tmp:cnt#3
      \ifnum\tmp:cnt<#2
          \advance\tmp:cnt  1  \expandafter\no::catcodes
      \fi }%
   \no::catcodes }

\def\scan:token{\futurelet\:next\check:ch}
\def\check:ch{\ifx \:next\par \expandafter\end
              \else           \expandafter\scan:ch\fi}
\def\scan:ch#1{\relax
   \ifx #1\egroup \index:tok \expandafter\egroup\else
   \ifcat #1a%
      \ifx \index:tok\empty
         \change:cats{48}{57}{11}% 0--9
      \fi
      \edef\index:tok{\index:tok#1}%
      \ifx \index:tok\start:comment
        \let\index:tok=\empty \let~=\scan:comment
        \change:cats{48}{57}{12}% 0--9
      \fi
    \else
       \change:cats{48}{57}{12}% 0--9
       \if \index:tok\empty \else
         \write:index{1
               \sp:id\index:id \space1 \l:idel\index:tok\r:idel }%
         \write:index{2
               \l:idel\index:tok\r:idel \space \sp:id\index:id }%
       \fi
       \let\index:tok=\empty
    \fi   \expandafter~\fi}
\def\sp:id#1{%
   \ifnum #1<10000 \space\fi
   \ifnum #1<1000 \space\fi
   \ifnum #1<100  \space\fi
   \ifnum #1<10   \space\fi
   #1}

\catcode`\@=0 \catcode`\\=12 @relax
             @:CheckOption{html}   @if:Option
@def@scan:comment#1\<#2\>{%
  @def@index:tok{#2}%
  @afterassignment@exit:comment@tmp:cnt=}
             @else
@def@scan:comment#1\<#2\>.{%
  @def@index:tok{#2}%
  @afterassignment@exit:comment@tmp:cnt=}
             @fi
@catcode`@\=0 \catcode`\@=11

\def\start:comment{startcodefragment}
\def\exit:comment#1//{\def\:temp{#1}%
   \ifx \:temp\open:comment
      \index:push
      \edef\index:level{I\index:level}%
       \ifx \prev:comment\index:tok \else
          \code:index{}%
      \fi
      \expandafter\edef\csname L \index:level\endcsname{%
         \expandafter\ifx \csname L \index:level\endcsname\relax \else
                  \csname L \index:level\endcsname,
           \fi  \the\tmp:cnt
      }%
      \let\prev:dir=u%
      \let\prev:comment=\index:tok%
   \else
         \code:index{I}%
      \edef\index:level{\expandafter\:gobble\index:level}%
      \let\prev:dir=d%
      \index:pop\index:pop\index:push
   \fi
   \let\index:tok=\empty \edef\index:id{\the\tmp:cnt}%
   \let~=\scan:token ~}
\def\open:comment{...}
\def\index:id{0}
\def\index:level{}
\let\prev:dir=f
\def\:gobble#1{}



\def\index:push{\edef\pd:mem{\the\tmp:cnt,\pd:mem}}
\def\index:pop{\expandafter\do:pop\pd:mem//}
\def\do:pop#1,#2//{%
   \if !#1!\tmp:cnt=-1 \else  \tmp:cnt=#1\def\pd:mem{#2}\fi}
\def\pd:mem{,}


\def\code:index#1{%
  \if d\prev:dir
    \bgroup
       \edef\index:tok{\l:idel\prev:comment\r:idel\space /\the\tmp:cnt/%
          \expandafter\ifx \csname L #1\index:level\endcsname\relax \else
                  , \csname L #1\index:level\endcsname
            \fi}%
       \write:index{3 \index:tok }%
       \expandafter\ifx \csname L #1\index:level\endcsname\relax \else
         \edef\:tmp{\noexpand\derive:index \space
                    \csname L #1\index:level\endcsname,,}\:tmp
       \fi
     \egroup
     \expandafter\let\csname L #1\index:level\endcsname=\:UnDe
  \fi
}

\def\derive:index#1,{%
   \if !#1!\else
   \write:index{1\sp:id{#1} 2
                \index:tok}\expandafter\derive:index\fi}

\def\write:index{\immediate\write\cdx:file }
\def\l:idel{<}
\def\r:idel{>}

\def\CodeIndex{%
   \immediate\closeout\cdx:file   \def\read:sdx{%
   \ifeof\sdx:file \else
      \immediate\read\sdx:file to\sdx:in  \sdx:in
      \expandafter\read:sdx
   \fi
}\noindent\vrule\vbox{\tt
\hsize=0.8\hsize
\rightskip=3em plus 4em
\leftskip=3em
\parindent=0pt

\ifnum \index:typ<4
  \sdx:in   \fi
 \read:sdx
}%
\immediate\closein\sdx:file
 %
   \immediate\openout\cdx:file=\jobname.cdx
   \bgroup
    \change:cats{0}{255}{12}%
    \change:cats{97}{122}{11}% a--z
    \change:cats{65}{90}{11}%  A--Z
    \change:cats{95}{95}{11}%  _
    \let\index:tok=\empty  \let~=\scan:token
    \expandafter~\input \jobname.cpg \egroup
    \immediate\write16{-- Have \jobname.cdx processed
          into \jobname.sdx --}%
}%

   \let\xref:ModifyShowCode=\ModifyShowCode
\def\ModifyShowCode#1{%
   \xref:ModifyShowCode{#1}%
   \let\xref:ModifyShowLastCode=\ModifyShowLastCode
   \def\ModifyShowLastCode{\xref:ModifyShowLastCode{#1}%
     \def\:BackTitle{\noindent\vrule\vtop{%
\tt
\hsize=0.8\hsize
\rightskip=3em plus 4em
\leftskip=3em
\parindent=0pt
        --\the\:CodeNumber--: \small:index
}}}}
\def\small:index{%
   \ifnum \:CodeNumber<\index:num \else
       \sdx:in
      \ifeof\sdx:file
          \def\index:num{1000000}\gdef\index:typ{4}%
      \else
          \immediate\read\sdx:file to\sdx:in
          \expandafter\get:typ \sdx:in //%
      \fi
      \expandafter\small:index
   \fi}
\def\get:typ#1 {%
   \gdef\index:typ{#1}%
   \ifnum #1>1 \def\index:num{1000000}\expandafter\id:gobble
   \else   \expandafter\get:nm\fi}
\def\id:gobble#1//{}
\def\get:nm#1 #2//{\def\index:num{#1}}
\def\index:num{0}
\let\sdx:in=\empty

\fi
\:CheckOption{basic}     \if:Option
    \def\AlProTex{[[]],<<<>>>,list,title,ClearCode}
    \def\:temp{\catcode`\`=12}
\catcode`\;=0    \catcode`\\=12
;expandafter;catcode ;:CntrlChar=13
;ifnum 92=;:CntrlChar
   ;edef;:notex{;noexpand;::notex;noexpand\;:notex}
;fi
;ifnum 124=;:CntrlChar
   ;edef;:notex{;noexpand;::notex;noexpand|;:notex}
;fi
;ifnum 64=;:CntrlChar
   ;edef;:notex{;noexpand;::notex;noexpand@;:notex}
;fi
;ifnum 96=;:CntrlChar
   ;edef;:notex{;noexpand;::notex;noexpand`;:notex}
;fi
;:temp   ;catcode`;\=0    ;catcode`;;=12 
    \def\::notex#1#2{\let\:notex=\:undefined
                     \let\::notex=\:undefined
       %
       \ifx \documentstyle\:undefined \errmessage{LaTeX is missing}\fi
       \documentstyle{book} \let\cleardoublepage=\clearpage
       \textwidth=469.75499pt   \textheight=643.20255pt
       \topmargin=-0.5in  \oddsidemargin=0pt  \evensidemargin=0pt
       \begin{document}
       \hbadness=10000  \vbadness=10000  \hfuzz=99in \vfuzz=\hfuzz
       \tableofcontents   \begingroup
       %
       \def\:amp{#2}
       \def#1{\begingroup
          \catcode`\ =12   \catcode`\^^M=12    \catcode`\^^I=12
          \expandafter\catcode\:CntrlChar=12   \:doAmp  }
       %
       \def\:doAmp##1{\endgroup
          \if      ##1<  \def\:next####1#1>{\<####1\>}%
\else          \def\:next{##1}%
\ifx \:next\:amp
\else\if ##1c  \def\:next{\:sect\chapter}%
\else\if ##1s  \def\:next{ \vfil\:sect\section}%
\else\if ##1u  \def\:next{ \vfil\:sect\subsection}%
\else\if ##1v  \def\:next{\expandafter\def\csname\string
                             @xverbatim\endcsname########1#2{%
                              ########1\end{verbatim}\egroup}%
                          \bgroup\expandafter\catcode\:CntrlChar=12
                          \begin{verbatim}}%
\else\if ##1o  \def\:next####1#1<####2#1>{\OutputCode####1\<####2\>}%
\else\if ##1n  \def\:next{\ClearCode}%
\else\if ##1e  \def\:next{\endgroup\end{document}}%
\else    \edef\:next{\noexpand\errmessage{\:amp##1?}}%
\fi\fi \fi\fi \fi\fi \fi\fi \fi
\:next   }
       %
       \:NoSpecials{12}{0}{255}
       \catcode`\ =10    \catcode`\^^M=5    \catcode`\^^I=10
       \escapechar=\:CntrlChar
       \expandafter\catcode\:CntrlChar=13  }
   \def\:specialactive{\catcode`\_=13
   \catcode`\~=13   \catcode`\\=13   \catcode`\#=13
   \catcode`\$=13   \catcode`\%=13   \catcode`\^=13
   \catcode`\&=13   \catcode`\{=13   \catcode`\}=13 }

\def\:sect{\begingroup \:specialactive \::sect}

\catcode`\/=0   \catcode`\[=1   \catcode`\]=2
\catcode`\@=6   \catcode`\*=14  \:specialactive

/def/::sect@1@2/par[/endgroup/begingroup
   /def~[/bgroup/tt/char126/egroup]*
   /def\[/bgroup/tt/char92/egroup]*
   /def#[/bgroup/tt/char35/egroup]*
   /def$[/bgroup/tt/char36/egroup]*
   /def%[/bgroup/tt/char37/egroup]*
   /def^[/bgroup/tt/char94/egroup]*
   /def_[/bgroup/tt/char95/egroup]*
   /def&[/bgroup/tt/char38/egroup]*
   /def{[/bgroup/tt/char123/egroup]*
   /def}[/bgroup/tt/char125/egroup]*
   /escapechar=92   @1[@2]/endgroup]

/catcode`/\=0   \catcode`\#=6   \catcode`\$=3   \catcode`\%=14
\catcode`\^=7   \catcode`\&=4   \catcode`\{=1   \catcode`\}=2
\catcode`\_=8   \catcode`\/=12  \catcode`\[=12  \catcode`\]=12
\catcode`\@=11  \catcode`\*=12

\else
   \let\:CntrlChar=\:undefined
   \def\:notex{\let\:notex=\:undefined}
\fi
\:CheckOption{<<<>>>}     \if:Option
\def\:OpenCode#1#2{\def\:OpenCode{#1}\def\:CloseCode{#2}}
\edef\:CloseCode{\noexpand\:OpenCode
  \ifx \CodeDel\:UnDefined{<<<}{>>>}\else \CodeDel\fi }  \:CloseCode
\let\:ModifyAppendCodeI=\ModifyAppendCode
                                   \catcode`\^^M=13
\edef\ModifyAppendCode{%
\catcode`\noexpand\{=12  \catcode`\noexpand\}=12 %
\let\noexpand\::ScanAppend=\noexpand\:ScanAppend %
  \def\noexpand\:ScanAppend\:OpenCode##1^^M##2\:CloseCode{%
                           \noexpand\::ScanAppend{##2}}%
\noexpand\:ModifyAppendCodeI}%
                                             \catcode`\^^M=5
\fi \:CheckOption{[]}
\if:Option \else   \:CheckOption{[[]]}\fi
\def\:temp{}
\if:Option
  \def\:temp{\csname newdimen\endcsname\:BoxDepth}
\def\WindowTitle#1{{\leavevmode
   \leftskip=0em  \rightskip=0em
   \parindent=0em \:BoxDepth=0.4pt
   \setbox0=\hbox{#1}%
   \advance\:BoxDepth by \dp0
   \advance\:BoxDepth by 0.4mm   \raise -\:BoxDepth
   \hbox{\vrule
      \vbox{\hrule          \vskip 0.4mm
            \hbox{\hskip 0.4mm\relax #1\hskip 0.4mm}%
            \vskip 0.4mm    \hrule}%
         \vrule}}}
\let\:ModifyShowCodeIII=\ModifyShowCode
\def\ModifyShowCode#1{\:ModifyShowCodeIII{#1}%
   \def\PortTitle##1{\WindowTitle{\WindowTitle{##1}}}%
   \def\:BackTitle{\hbox{---}}}
\fi   \:temp \:CheckOption{[[]]}
\def\:temp{}
\if:Option
  \let\:ShowCodeI=\:ShowCode
\def\:ShowCode#1{\par\:FrameCode{\:ShowCodeI{#1}}}
\def\:FrameCode#1{\vtop{%
            \advance\hsize by -\leftskip
            \noindent\vrule
            \vtop{\leftskip=0pt    \advance\hsize by -0.8pt
                  \hrule#1\hrule}\vrule}\vskip3pt minus1pt\relax}
\let\:ModifyShowCodeV=\ModifyShowCode
\def\ModifyShowCode#1{\:ModifyShowCodeV{#1}%
           \let\PortTitle=\:PortTitleI
           \def\:BottomTitle{}}
\def\:PortTitleI#1{{\parindent=0pt
           \leftskip=0pt plus 0.5\hsize
           \rightskip=\leftskip #1\par  \vskip-1ex
           \noindent\dotfill\null}}
\let\:ModifyShowLastCodeI=\ModifyShowLastCode
\def\ModifyShowLastCode#1{\:ModifyShowLastCodeI{#1}%
                      \advance\leftskip by -2em   }
\fi   \:temp \:CheckOption{list}  \if:Option
\def\:show{%
   \ifx \:title\empty \def\:show{\ShowCode-}%
   \else              \def\:show{\ShowCode}%
   \fi     \:show}
\fi

\catcode`\-=13 \catcode`\+=13  \if:Option
\def\AfterCode#1{{%
   \def-##1##2{\def\:title{##1}}%
   \let+=\:ignoreII
   #1\relax
   \:show #1}}
\def\:ignoreII#1#2{}
\fi
\catcode`\-=12 \catcode`\+=12

 \:CheckOption{enumerate} \def\:temp{}  \if:Option
   \def\:temp{\csname newcount\endcsname\:LineCount}
   \let\:ModifyShowLastCode=\ModifyShowLastCode
   \def\ModifyShowLastCode{\everypar={\:CountLines
      {\it \:ShowLineCount \quad}}%
      \let\:BottomTitleX=\:BottomTitle
      \def\:BottomTitle{\everypar={}\:BottomTitleX}%
   \:ModifyShowLastCode}
   \def\ResetLineCount{ \global\:LineCount=0 }
   \def\ShowLineCount{\def\:ShowLineCount{\ifnum\:LineCount<100 0\fi
                                          \ifnum\:LineCount<10  0\fi
                                          \the\:LineCount}}
   \def\HideLineCount{\def\:ShowLineCount{}}
   \def\ContLineCount{\def\:CountLines{\global\advance\:LineCount by 1 }}
   \def\PauseLineCount{\def\:CountLines{}}
   \ShowLineCount \ContLineCount
   \def\TagLine[#1]{%
      \edef\:temp{\noexpand\Tag\noexpand{C #1\noexpand}\noexpand{%
                  \the\:LineCount\noexpand}}\:temp}
   \def\RefLine[#1]{\Ref{C #1}}
   \let\:ModifyOutputCodeZ=\ModifyOutputCode
   \def\ModifyOutputCode{\def\RefLine[##1]{}%
      \def\TagLine[##1]{}\:ModifyOutputCodeZ}
\fi
\:temp \:CheckOption{ClearCode}
\if:Option
   \gdef\:EraseCode{}
   \def\ModifyCode#1{%
      \let\clearcode:id=\clearcode::id
      \def\:temp{\gdef\:EraseCode}%
      \expandafter\expandafter\expandafter
      \:temp\expandafter{\:EraseCode~#1}}
   \def\ClearCode{{%
      \def~##1{\global\let##1=\:undefined}%
      \:EraseCode \:CodeNumber=\clearcode::id
\advance\:CodeNumber by 1
\xdef\clearcode::id{\the\:CodeNumber }
}%
      \gdef\:EraseCode{}}
   \let\:ModifyShowCodeVI=\ModifyShowCode
\let\:AfterCodeI=\AfterCode
\let\:RefLineI=\RefLine
\let\:TagLineI=\TagLine
\def\ModifyShowCode#1{\:ModifyShowCodeVI{#1}%
   \def\RefLine[##1]{{\def\clearcode:id{0}\:RefLineI[##1]}}%
   \def\TagLine[##1]{{\def\clearcode:id{0}\:TagLineI[##1]}}%
   \let\clearcode:id=\clearcode::id}
\def\AfterCode#1{\:AfterCodeI{#1}\def\clearcode:id{0}}
\ifx\clearcode:id\:UnDef
   \gdef\clearcode:id{0} \gdef\clearcode::id{0}
\fi

\fi\:CheckOption{LibCode}
\if:Option
\def\LibCode{\bgroup \catcode`\ =9 \catcode`\^^M=9 \catcode`\^^I=9
   \catcode`\,=13   \:LibCode}
\def\:LibCode[#1]{\catcode`\,=12   \:LibC[#1]}
                                      \catcode`\,=13 \catcode`\^^M=13
\def\:LibC[#1]#2(){\egroup                        %
   \def,{ \noexpand\input\space}%
   \edef\:LibFiles{\noexpand\:checkoption , #1 }%
   \def\:next{\let\:xparms=\:parms                %
     \begingroup                                    %
       \let\LibCall=\:LibCall                       %
       \def\AddLibCall####1{}%
       \def\AddNestedLibCall####1{}%
       \def\ifLibEnd{\csname ifx\endcsname\:parms\empty}%
       \csname :LibFiles\endcsname \Comment{}{}%
       \FreeCode\<\:TempFileName\>
       \<\:TempFileName\><<<
         \<lib code\> >>>      %
       \edef\:temp{\noexpand\OutputCodE
          \noexpand\<\:TempFileName\noexpand\>}%
       \:temp  \input \:TempFileName                %
     \endgroup                                      %
     \::LibC }%
   \def\:parms{#2}%
   \let\:xparms=\empty   \::LibC %
   \let\:parms=\:UnDef  \let\:xparms=\:UnDef}%
\def\LibTempFileName#1{\def\:TempFileName{#1}}
\LibTempFileName{lib.lib}
                                     \catcode`\,=12 \catcode`\^^M=9
\def\::LibC{%
   \ifx       \:parms\empty      \let\:next=\relax
   \else\ifx  \:parms\:xparms    \let\:next=\relax
      \:warn{No code for \string\LibCode\space\:parms}
   \fi\fi   \:next}

\def\LibShow#1{{\tt\par--- Include library component #1}}

\def\:LibShow#1{%
  \AddLibCall{#1}%
  \LibShow{#1}}

\def\:LibCall(#1,#2,#3){%
  \xdef\:parms{%
    (#1,#2,#3)%
    \:parms}%
  \def\temp{\global\let}%
  \expandafter\temp\csname#2 \endcsname=\:LibShow
  \gdef\:LibShow##1{%
    \AddNestedLibCall{(#1,#2,#3)}%
    \def\temp{\global\let\:LibShow=}%
    \expandafter\temp\csname#2 \endcsname
  }%
}

\def\:checkoption{%
  \def\:ShowCode##1{}%
  \def\ProTexMssg##1{}%
  %
  \def\ifoption##1{%
     \let\:rparms=\:parms
     \def\parms{}%
     \def\:lparms{}%
     \def\:cond{##1}%
     \def\:type{}%
     \let\:next=\:ifoption  \:next
     \xdef\:parms{\:lparms\parms\:rparms}%
     \csname ifx\endcsname \:type\:cond
       \xdef\:parms{\:lparms\:rparms}%
       \edef\:next{\noexpand\:LibShow{\parms}}%
       \:next
     }%
  %
  \def\:ifoption{%
     \expandafter\:getoption\:rparms()%
     \ifx \:type\:cond    \let\:next=\relax   \fi
   \:next   }%
  %
  \def\:getoption##1(){%
     \def\:temp{##1}%
     \ifx \:temp\empty \let\:next=\relax
     \else              \::getoption##1()\fi }%
  %
  \def\::getoption(##1,##2,##3)##4(){%
     \edef\:lparms{\:lparms\parms}%
     \def\parms{(##1,##2,##3)}%
     \def\:rparms{##4}%
     \def\:type{##2}}%
}
\fi\def\TextIndex#1{}   \def\SecIndex#1{}
\def\ShowIndex{\:warn{\string\ShowIndex?}}

\:CheckOption{ShowIndex}

\def\:temp{}
\catcode`\-=13 \catcode`\+=13

\if:Option
\def\:temp{\csname newcount\endcsname \:IdxCount}
\def\:GetTrc{%
   \immediate\read15 to \:x
   \ifx \:PAR\:x \let\:GetTrc=\relax
   \else \expandafter\:AddEntry\:x \fi
   \:GetTrc}                           \def\:PAR{\par}

\def\:AddEntry#1{\def\:cs{#1}\futurelet\:p\:RemoveField}
\def\:RemoveField{\ifx .\:p \def\:next##1 {\:AppendEntry}
                  \else    \let\:next=\:AppendEntry \fi \:next}

\def\:AppendEntry#1#2#3{\def\:y{#1}%
   \ifx \:y\:NS \AppendCode\:idx{\endgroup
                   \:Section{#2}{#3}\begingroup}%
      \expandafter\let\csname :idx\the\:IdxCount\endcsname=\:idx
      \def\:temp{\Code\:idx{}}%
      \expandafter\expandafter\expandafter\:temp\expandafter
                      {\csname :idx\the\:IdxCount\endcsname}%
      \advance\:IdxCount by 1
   \else\ifx \:y\:V
      \expandafter\ifx \csname :\:Title #2;;:\endcsname\relax
         \expandafter\Code\csname :\:Title #2;;:\endcsname{}{\?{#2}}%
      \fi
      \expandafter\AppendCode\csname :\:Title #2;;:\endcsname{ #3}%
      \:AddIdx{\csname :\:Title #2;;:\endcsname}%
   \else
      \edef\:cs{\expandafter\string\:cs.:}
\edef\:cs{\expandafter\noexpand\csname\:cs\endcsname}
      \ifx      \:y\:DT \expandafter\Code\:cs{}{\tr{#2}}%
      \else\ifx \:y\:ST \expandafter\AppendCode\:cs{ \underbar{#3}}%
                \:AddIdx{\:cs}%
      \else\ifx \:y\:SC \expandafter\AppendCode\:cs{ #3}%
                \:AddIdx{\:cs}%
   \fi\fi\fi\fi\fi}\def\:AddIdx{%
   \def\:y{\AppendCode\:idx}%
   \expandafter\expandafter\expandafter\:y\expandafter}

\def\SecIndex#1{{\let\:refout=\:trcfile  \def\:TagCs{.}%
   \Tag{section}{{#1};;}}}

\def\TextIndex#1{{\let\:refout=\:trcfile  \def\:TagCs{.}%
   \Tag{user}{#1;;}}}

\let\i:ModifyShowCode=\ModifyShowCode
\let\i:ModifyOutputCode=\ModifyOutputCode
\def\ModifyOutputCode{%
   \ifx \:OpenCode\:UnDef \def\TextIndex##1{}%
   \else  \let\TextIndex=\Text:Index \fi
   \i:ModifyOutputCode}
\def\ModifyShowCode{%
   \ifx \:OpenCode\:UnDef \else  \let\TextIndex=\::TextIndex \fi
   \i:ModifyShowCode }
\let\:TextIndex=\TextIndex
\catcode`\[=1  \catcode`\{=12  \catcode`\]=2  \catcode`\}=12
\def\::TextIndex{#1}[\:TextIndex[#1]]
\def\Text:Index{#1}[]
\catcode`\[=12 \catcode`\{=1   \catcode`\]=12 \catcode`\}=2

\def\:V{user}
\def\:DT{DefineTitle}  \def\:ST{ShowTitle}  \def\:SC{ShowCode}
\def\:NS{section}

\def\:Title#1;;#2;;{#1}
\def\:TitleA#1;;#2;;{$\triangleleft\triangleleft$ #1
   $\triangleright\triangleright$}

\def\:Index{\vfil\eject   \Comment{}{}%
   \immediate\closeout\:trcfile
   \def\ModifyShowCode##1{}%
   \def\ModifyAppendCode##1{}%
   \def\ModifyFrontTitle##1{}%
   \def\ModifyShowLastCode##1{##1}%
   \def\AfterCode##1{}%
   \def\:WriteTrc##1{}%
   \let\:TraceDef=\:ignoreII
   \def\:warn##1{}%
   \def\:gobble##1{}%
   \let\CodeId=\:ignoreII
   \def\ModifyOutputCode##1{\def\:FileName{\jobname.xidx}}%
   \Code\:idx{}{\BeforeIndex\begingroup}%
   \:PauseIndex  \immediate\openin15=\:jobname
   \:GetTrc  \AppendCode\:idx{\endgroup}%
   {\def\?##1{\par\noindent{\tt\:Title ##1;;}\hfill}%
    \def\tr##1{\par\noindent{\tt\:TitleA ##1;;}\hfill}%
    \def\:Section##1##2{{\bf\smallskip\noindent{\:Title ##1;;}\hfill
                         ##2\smallskip}}%
    \def\ModifyShowLastCode##1{%
       \leftskip=0pt \rightskip=0pt
       \def\:LastCode{\:idx}%
       \:SetShowIndex}%
     \let\:FrameCode=\empty
     \expandafter   \ShowCode\:minus\:idx   }}


\def\:ignoreII#1#2{}

\def\:SetShowIndex{\def-##1##2{\expandafter\def\csname
       \expandafter\:gobble##2\endcsname{}}%
                   \def+##1##2{##1}}

\def\BeforeIndex{}
\def\:PauseIndex{}
\def\PauseIndex{\def\PauseIndex{\immediate\read16 to \PressReturn}}
\def\ShowIndex{{%
   \let\:SvCode=\Code
   \def\Code##1{\ModifyCode{##1}\:SvCode##1}%
   \ifx \::AddEntry\:undefined
   \else    \let\:AddEntry=\::AddEntry   \fi
   \:Index   \global\let\:idx=\:undefined }%
   \xdef\:jobname{\jobname.trc\the\pageno}%
   \immediate\openout\:trcfile=\:jobname \relax        }

\xdef\:jobname{\jobname.trc}
    \fi    \catcode`\-=12 \catcode`\+=12   \:temp
\:CheckOption{title+}  \if:Option
   \def\:temp{\def\AlProTex}
   \def\temp:{title,}
   \expandafter\expandafter\expandafter\expandafter\expandafter
       \expandafter\expandafter\:temp\expandafter\expandafter
                      \expandafter{\expandafter \temp:\AlProTex}
\fi
\:CheckOption{title}  \if:Option
       \def\:Name#1{<#1\string\>\endcsname}
\def\:DoName#1{\expandafter#1\csname\:Name}

\def\getTitle:env{\catcode`\_=11 }%
\def\<{\bgroup \getTitle:env \cont:title}%
\def\cont:title#1\>{\egroup\edef\CodeInputLineNo{\the\inputlineno}%
  \:DoName\ifx{#1}\relax
      \edef\:temp{\noexpand\Code\:DoName
         \noexpand{#1}\noexpand{#1\noexpand}}%
      \:DoName\let{#1}=\:undefined
   \else  \def\:temp{\:DoName\AppendCode{#1}}\fi\:temp}

                     \catcode`\.=10 \catcode`\ =13
\let\:ModifyShowCodeIV=\ModifyShowCode%
\def\ModifyShowCode{%
..\def\:gobble##1{}%
..\def\<##1\>{{\def {\space}%
...\:DoName\ifx{##1}\relax%
.....\let\AppendCode=\:gobble%
.....\:DoName\Code{##1}{##1}{}\fi%
..\csname\:Name{##1}}}\:ModifyShowCodeIV}%
\def\:OutputCodeI#1\<#2\>{%
...\let\:SaveSp= \def {}%
...\def\:temp{#2}%
...\ifx\:temp\empty.\def\:temp{ProTexOutput}%
...\else.\let\:temp=\empty.\fi%
...\expandafter\ifx.\csname.\:temp#2\endcsname\relax%
...\else.\immediate\write16{---.AlProTex. warning.---.%
......\string\OutputCode#1%
......\string\<#2\string\>\space.temporarily\space.%
......redefines.\:backslash#2}\fi%
...\edef\:FileName{\:temp#2}%
...\let =\:SaveSp%
...\expandafter\def\csname\:FileName\endcsname{\csname\:Name{#2}}%
...\def\:tempa{\:OutputCodeIV#1}%
...\expandafter\:tempa\csname\:FileName\endcsname%
..\endgroup}%
\catcode`\ =10\catcode`\.=12

\let\:OutputCodeIV=\OutputCode
\def\OutputCode{%
   \begingroup
      \def\<##1\>{\csname\:Name{##1}}%
      \let\:WriteTrcI=\:WriteTrc     \def\:gobble##1{}%
      \def\:WriteTrc{\edef\:TagCs{\string\<\expandafter\expandafter
                              \expandafter\:gobble \:TagCs\string\>}%
                   \:WriteTrcI}
      \catcode` =13 \:OutputCodeI}

\def\OutputCodE\<#1.#2\>{{
   \:DoName\def{#1}{\<#1.#2\>}
   \OutputCode[#2]\<#1\>}}

\def\FreeCode\<#1\>{{%
  \def\temp##1{\global\let##1=\:UnDefined}%
  \:DoName\temp{#1}}}

\def\ShowCode#1{%
   \def\:test{#1}%
   \ifx \:test\:minus  \def\:next{\:iname\:ShowCode}\else
      \def\:next{\:iname\:ShowCode#1}\fi
   \:next}

\def\:iname#1#2{\def\:next{#2}\def\:temp{\<}%
   \ifx \:next\:temp
      \def\:next##1\>{\expandafter#1\csname\:Name{##1}}\else
   \def\:next{#1#2}\fi   \:next}

\def\::AddEntry#1{%
   \ifx #1\<    \let\:Next=\:AddEntryA
   \else        \def\:Next{\def\:cs{#1}\:AddEntryB}\fi
   \:Next }

\def\:AddEntryA#1\>{%
   \edef\:cs{\expandafter\noexpand
             \csname#1:.\endcsname}\:AddEntryB}

\def\:AddEntryB{%
   \futurelet\:p\:RemoveField}%
   \def\:RemoveField{\ifx .\:p \def\:next##1 {\:AppendEntry}%
                  \else    \let\:next=\:AppendEntry \fi \:next}

\let\id:WriteTrc=\:WriteTrc
\def\:WriteTrc#1{%
  \def\:temp{#1}\def\:tempa{ShowTitle}\ifx\:temp\:tempa
     \expandafter\def\expandafter\:TagCs\expandafter
         {\:TagCs.\the\:CodeNumber}%
  \fi
  \id:WriteTrc{#1}}

   \:CheckOption{macro} \if:Option   
\let\:saveMusp=\>

\def\>{\ifmmode \expandafter\:saveMusp \else \expandafter\:CodeMacro \fi }

\def\:CodeMacro(#1)#2\<{%
   \begingroup
     \:getcodeprms(\string\1,\string\2,\string\3,\string\4,%
                       \string\5,\string\6,\string\7,\string\8,\string\9)%
     \xdef\:temp{()#2}%
   \endgroup
   \def\:next{#1}%
   \ifx\:next\empty
      \expandafter\ifx\csname\:temp\space :<\endcsname\relax
          \ifx\:EraseCode\:UnDef\else
             \expandafter\:adderase \csname\:temp\space :<\endcsname
          \fi
      \else
         \:warn{Redefine \string\>\:temp\string\<}%
      \fi
      \def\:next{\expandafter\:getpseducode
                    \csname\:temp\space :<\endcsname{#2}}%
   \else
      \begingroup
        \:getcodeprms(#1,,,,,,,,,)%
        \:protectcommands  \ModifyIndirectCode{(#1)#2}%
        \xdef\:next{\csname\:temp\space :<\endcsname}%
      \endgroup
   \fi
   \:next}

\def\:adderase#1{%
  \def\:next{\gdef\:EraseCode}%
  \expandafter\expandafter\expandafter\:next\expandafter{\:EraseCode~#1}%
}

\def\:getpseducode#1#2{\begingroup
  \:defaultcats
  \ModifyAppendCode{}%
  \:getpseducodeI#1{#2}}

\def\:getpseducodeI#1#2#3{\endgroup
  \def#1{\<#2\>{#3}}%
}%

\def\:getpseducodeII{%
  \ifx \:OpenCode\:UndDef
  \else
    \edef\:getpseducodeI{%
       \def\noexpand
          \:getpseducodeI####1####2####3\:OpenCode####4\:CloseCode{%
                             \endgroup
          \def\noexpand\:temp{####3}%
          \noexpand\ifx\noexpand\:temp\noexpand\empty
            \def####1{\noexpand\<####2\noexpand
                             \>\:OpenCode####4\:CloseCode}%
          \noexpand\else
            \errmessage{\string\>()...\string
                            \<...?...\:OpenCode...\:CloseCode}
            \let####1=\noexpand\:UnDef
          \noexpand\fi
       }%
    }%
    \:getpseducodeI
  \fi
  \let\:getpseducodeII=\:UndDef
}
                   \catcode`\ =13 \catcode`\^^M=13 \catcode`\^^I=13
                                 \catcode`\#=14      \catcode`\%=12
\def\:protectcommands{#
\let\<=\relax#
\let\>=\relax#
\let\%=\csname#
\expandafter\let\%NL%\endcsname=\relax#
\let\%=\relax#
\let\ =\relax#
\let^^M=\relax#
\let^^I=\relax#
\ifx\TagLine\:UnDef\else\let\TagLine=\relax\fi#
\ifx\RefLine\:UnDef\else\let\RefLine=\relax\fi#
}
                                 \catcode`\#=6       \catcode`\%=14
                    \catcode`\ =10 \catcode`\^^M=9 \catcode`\^^I=10

\def\ModifyIndirectCode#1{}
\def\:getcodeprms(#1,#2,#3,#4,#5,#6,#7,#8,#9){%
   \def\1{#1}%
   \def\2{#2}%
   \def\3{#3}%
   \def\4{#4}%
   \def\5{#5}%
   \def\6{#6}%
   \def\7{#7}%
   \def\8{#8}%
   \def\9##1,##2){\def\9{##1}}%
   \9#9,)}  \fi
   \:CheckOption{title}\if:Option   \def\TitleAlias#1#2{%
   \expandafter\let\csname C\string#1\endcsname=\<%
   \expandafter\let\csname O\string#1\endcsname=\OutputCode
   \def\<##1\>{\def\:temp{##1}\def\:tempa{#2}%
      \ifx \:temp\:tempa
        \def\:temp{\csname C\string#1\endcsname#1\>}\else
        \def\:temp{\csname C\string#1\endcsname##1\>}\fi \:temp}
   \def\OutputCode##1\<##2\>{\def\:temp{##2}\def\:tempa{#2}%
      \ifx \:temp\:tempa
         \def\:temp{\csname O\string#1\endcsname##1\<#1\>}%
      \else \def\:temp{\csname O\string#1\endcsname##1\<##2\>}\fi
      \:temp}}
  \fi
\fi
\:CheckOption{eline}
\catcode`\%=12
\if:Option
  \let\:ModifyOutputCodeJ=\ModifyOutputCode
  \def\ModifyOutputCode{\def\:Ln{ %^^J}\:ModifyOutputCodeJ}
\fi  \catcode`\%=14
\:CheckOption{ShowFile}
\if:Option
\catcode`\^^I=13\catcode`\ =13\catcode`\^^M=13%
\def\:ObeyIn{\CodeFont\parindent=0pt%
   \parskip=0pt\everypar{}%
   \:NoSpecials{12}{0}{255}\catcode`\ =13%
   \catcode`\^^M=13\catcode`\^^I=13%
   \def^^M{\leavevmode\par}\def^^I{  }%
   \def {\leavevmode\:Sp}}%
\catcode`\^^M=5\catcode`\ =10\catcode`\^^I=10
\expandafter\ifx \csname :Sp\endcsname\relax
  \expandafter\def\csname :Sp\endcsname{ }
\fi
\def\ShowFile#1{{\:ObeyIn    \openin15=#1
  \ifeof15 \:warn{\string\ShowFile{#1}?}\else
    \input #1 \fi \closein15 }}
\else  \def\ShowFile#1{\:warn{\string\ShowFile?}}
\fi\let\Note=\empty   \let\EndNote=\empty

\:CheckOption{NoShow}  \if:Option
   \let\:svShowCode=\:ShowCode
   \def\ShowOn{\let\Note=\empty
               \let\:ShowCode=\:svShowCode}
   \def\ShowOff{\let\Note=\:NoShow
                \def\:ShowCode##1{}}
   \def\:NoShow{\begingroup
      \:NoSpecials{11}{0}{255}\:EndNoShow}
   \catcode`\/=0   \catcode`\\=11
   /def/:EndNoShow#1\EndNote{/endgroup}
   /catcode`/\=0   /catcode`//=12
\fi\:CheckOption{ShowTop}
\catcode`\-=13  \catcode`\+=13
\if:Option
\def\:ShowTop#1{{\par
   \def\ModifyFrontTitle##1{\def\:AppendSign{}}%
   \def\ModifyShowLastCode##1{\let\:save=-%
      \def\:LastCode{#1}%
      \def-####1####2{\let-=\:save}%
      \def+####1####2{{\ShowSep\let+=\:ignoreII ####1}}}%
   \ShowCode#1}}

\def\ShowSep{}
\def\ShowTop{\:iname\:ShowTop}
\def\:ignoreII#1#2{}
\def\:iname#1#2{\def\:next{#2}\def\:temp{\<}%
   \ifx \:next\:temp
      \def\:next##1\>{\expandafter#1\csname\:Name{##1}}\else
   \def\:next{#1#2}\fi   \:next}
\fi
\catcode`\-=12  \catcode`\+=12
\def\LinkPort{\:HRefCode{)\clearcode:id P:}}
\def\LinkWindow{\:HRefCode{)\clearcode:id Z:}}
\def\:HRefCode#1\<#2\>{}
\:CheckOption{info}  \if:Option
   \let\inf:ModifyOutputCode=\ModifyOutputCode
   \def\ModifyOutputCode#1{%
     \inf:ModifyOutputCode{#1}%
     \expandafter\ifx \csname \Extension :cdinfo\endcsname \relax \else
         \edef\:FileName{\:FileName}%
         \expandafter\expandafter\csname \Extension :cdinfo\endcsname
                                           \:FileName!*?: %
     \fi   }
   \def\CodeInfo{\futurelet\:temp\cd:inf}
   \edef\cd:inf{\noexpand\ifx [\noexpand\:temp
                   \let\noexpand\:temp=\noexpand\cdi:nf
      \noexpand\else \def\noexpand\:temp{\noexpand\cdi:nf
                                   [\:InitAlProTex]}\noexpand\fi
      \noexpand\:temp}
   \def\cdi:nf[#1]{\expandafter\def\csname
                             #1:cdinfo\endcsname##1.##2!*?: }
\fi

\ifx \HCode\:UnDef \ifx \Htmltrue\:UnDef
   \def\:temp{\csname newif\endcsname}
   \expandafter\:temp \csname ifHtml\endcsname  \Htmlfalse
\fi

\def\EndLink{\ifx \empty:lnk\empty \HCode{\Hbrakets</\tag:A>}\fi}
\def\:HRef{\ifx [\:temp \expandafter\::HRef
           \else \expandafter\:::HRef \fi }
\def\HT:tag{\ifx -\let:val   \expandafter\H:Tag
            \else            \expandafter\HTa:g\fi }
\def\HTa:g{\H:Tag-}
\def\Link{\let\:attr\empty \futurelet\let:val\HRefT:ag}
\def\HRefT:ag{\ifx -\let:val \expandafter\H:RefTag
              \else          \expandafter\HRefTa:g\fi   }
\def\HRefTa:g{\H:RefTag-}
\def\H:RefTag#1{\futurelet\:temp\:HRefTag}
\def\:HRefTag{\ifx [\:temp \expandafter\::HRefTag
              \else \expandafter\:::HRefTag \fi }

\def\HCode#1{}
\def\H:Tag#1#2{}
\def\::HRef[#1]#2{}
\def\:::HRef#1{}
\def\::HRefTag[#1]#2#3{}
\def\:::HRefTag#1#2{}
\def\:TagHTag#1{}


 \fi
\:CheckOption{html}
   \if:Option  \else \:CheckOption{xhtml}\fi
\if:Option
   \def\WindowTitle#1{\leavevmode\hbox{%
   \disable:
   \expandafter\ifx\csname \clearcode:id W-#1\endcsname\relax
   \let \:temp=\empty
\else
   \edef\:temp{ \HREF:"\expandafter\get:href
                     \csname \clearcode:id W-#1\endcsname -"}%
\fi
\html:addr
\HCode{<\tag:A\:newlnch \NAME:"\expandafter\get:htag\last:haddr -"\:temp
          >}\ttl:del{<.}\HCode{</\tag:A>}%
\expandafter\expandafter\expandafter\global\expandafter\let
                    \csname \clearcode:id W-#1\endcsname=\last:haddr
%
   \expandafter\ifx\csname \clearcode:id :cw:#1\endcsname\relax
   \expandafter\expandafter\expandafter\global
       \expandafter\def\csname \clearcode:id :cw:#1\endcsname{0}%
   \Tag{)\clearcode:id Z:#1}{\last:haddr}%
\fi
\frag:href{)\clearcode:id P:#1}{}#1\HCode{</\tag:A>}%
%
   \:nextlink{\clearcode:id :cw:#1}{.>}%
%
   }}
\def\disable:{\let\rm=\empty \let\tt=\empty
   \let\sl=\empty \let\bf=\empty  \let\it=\empty }
\def\frag:href#1#2{%
   \HCode{<\tag:A\:newlnch \HREF:"%
     \expandafter\ifx \csname  cw:#1\endcsname \relax
        \expandafter\get:href\last:haddr -%
  \else
     \expandafter\expandafter\expandafter\get:href\csname
          cw:#1\endcsname -%
  \fi
"#2>}}
\def\html:PortTitle#1{\hbox{%
  \disable:
  \bgroup  \def\:Sp{\space}%
  \html:addr
  \ifx\:AppendSign\empty
     \HCode{<\tag:A\:newlnch \NAME:"\get:htag\last:haddr-">}%
     \expandafter\expandafter\expandafter\global\expandafter\edef
            \csname \clearcode:id 9:#1\endcsname{0}%
  \else
     \HCode{<\tag:A\:newlnch \HREF:"\expandafter\get:href
             \csname \space\clearcode:id P:#1\endcsname-"
             \NAME:"\get:htag\last:haddr-">}%
  \fi
  \ttl:del{<..}\HCode{</\tag:A>}%
  \expandafter\expandafter\expandafter\global\expandafter\let
                    \csname \space\clearcode:id P:#1\endcsname=\last:haddr
\egroup
%
  \bgroup  \def\:Sp{\space}%
   \ifx\:AppendSign\empty
      \Tag{)\clearcode:id P:#1}{\last:haddr}%
   \fi
   \frag:href{)\clearcode:id Z:#1}{\ifx \:LastCodeLabel\empty \else
   \expandafter\html:codeid\:LastCodeLabel</\tag:A>\fi
%
}%
\egroup
#1\HCode{</\tag:A>}%
%
  \:nextlink{\clearcode:id 9:#1}{..}%
%
  }}
\def\:HRefCode#1\<#2\>{{%
  \let\clearcode:id=\clearcode::id
  \expandafter\ifx\csname
                 cw:#1#2\endcsname\relax
     \HCode{<\tag:A>}\else
     \HCode{<\tag:A\:newlnch \HREF:"}\expandafter\get:href
            \csname  cw:#1#2\endcsname
     -\HCode{">}%
  \fi}}
\def\:nextlink#1#2{%
   \bgroup  \def\:Sp{\space}%
      \def\:lbl{)\the\tmp:cnt :#1}%
      \tmp:cnt=\csname #1\endcsname\space
      \html:addr
      \Tag{\:lbl}{\last:haddr}%
      \advance\tmp:cnt by 1\space
      \expandafter\xdef\csname #1\endcsname{\the\tmp:cnt}%
      \expandafter\ifx\csname  cw:\:lbl\endcsname\relax
         \HCode{<\tag:A\:newlnch
                   \NAME:"\expandafter\get:htag\last:haddr-">}%
      \else
         \HCode{<\tag:A\:newlnch
                     \NAME:"\expandafter\get:htag\last:haddr-"\space
                     \HREF:"\expandafter\expandafter\expandafter
                                \get:href\:LikeRef{\:lbl}-">}%
      \fi
      \ttl:del{#2>}\HCode{</\tag:A>}%
   \egroup
}
\def\:LikeRef#1{\csname  cw:#1\endcsname}
\let\html:ShowCode=\ShowCode
\def\ShowCode{\par \html:ShowCode}
\let\html:ModifyShowCode=\ModifyShowCode
\def\ModifyShowCode#1{%
   \def\%##1\%{\c:protex##1\d:protex}%
   \html:ModifyShowCode{#1}%
   \let\PortTitle=\html:PortTitle
   \let\:FrontTitle=\frnt:ttl
   \def\:BackTitle{\b:protex\par}%
   \let\:CodeSkip=\empty
   \def\:TopTitle##1{{\:FrontTitle{##1}}}%
   \def\:BottomTitle{\:BackTitle}%
   \let\html:ModifyShowLastCode=\ModifyShowLastCode
\ifx\:ModifyShowLastCode\:UnDeF   \def\:CntLines##1{}\else
                                  \def\:CntLines{\:CountLines}\fi
\def\ModifyShowLastCode##1{%
   \ifx \:test\:minus
      \def\:CodeSkip{{\par\parindent=0pt\leftskip=0pt
                      \everypar{}\b:protex\par}%
                      \global\:removeindenttrue}%
      \leavevmode\a:protex\par
   \else   \global\:removeindenttrue   \fi
   \html:ModifyShowLastCode{##1}%
   \everypar{\e:protex \:CntLines {\it \:ShowLineCount \quad}}%
}%
\f:protex
%
   }
\def\frnt:ttl#1{{\htmlprotex:par
      {\expandafter\ifx \csname ListCounter\endcsname\relax
         \else  \:removeindentfalse \fi       \leavevmode}%
      \PortTitle{#1}\:AppendSign}\a:protex
    }%
\def\a:protex{%
%   \ifvmode \csname IgnorePar\endcsname
%   \else    \hfil\break\fi
%   \csname EndP\endcsname
   \HCode{\ifx \:test\:minus  \else <br />\fi
      \html:src<span class="ShowCode"
      style="font-family:monospace;white-space:nowrap;"
 >\html:invisible}%
   \nobreak %  \hskip\leftskip  \hskip\parindent
}
\def\b:protex{\HCode{\html:BackTitle\html:src</span>}}
\def\e:protex{\HCode{<br />\html:invisible}}
\def\c:protex{\HCode{<i>}}
\def\d:protex{\HCode{</i>}}
\def\f:protex{\def\:Sp{\HCode{\string&\#x00A0;}}}
\long\def\c:ShowCode:#1#2#3#4#5#6{\def\a:protex{#1}%
   \def\b:protex{#2}\def\e:protex{#3}\def\c:protex{#4}%
   \def\d:protex{#5}\def\f:protex{\def\:Sp{#6}}}
\def\L:Del{<..}
\def\l:Del{<.}
\def\R:Del{..>}
\def\ttl:del#1{\def\:tempa{#1}%
   \ifx \:tempa\L:Del \L:del
   \else \ifx \:tempa\l:Del \l:del
   \else \ifx \:tempa\R:Del \R:del
   \else \r:del \fi\fi\fi}
\def\HShowCode#1#2#3#4#5{%
   \def\:temp{#1#2}\ifx \:temp\empty \else
     \def\L:del{#1}\def\R:del{#2}\fi
   \def\:temp{#3#4}\ifx \:temp\empty \else
     \def\l:del{#3}\def\r:del{#4}\fi
   \def\:temp{#5}\ifx \:temp\empty \else
     \def\html:BackTitle{#5}\fi
}
\bgroup
\catcode`\_=12
\gdef\:temp{\HShowCode{<..}{..>}{<.}{.>}{-_-_-}} \aftergroup\:temp
\egroup
\let\html:ProTexMssg=\ProTexMssg
\def\ProTexMssg{%
   {\let\:gobble=\empty\def\:TagCs{\:FileName}\:WriteTrc{FileName}}%
   \html:ProTexMssg  }
\catcode`\^^I=13\catcode`\ =13\catcode`\^^M=13%
\def\:ObeyIn{\CodeFont\parindent=0pt%
   \parskip=0pt\everypar{}%
   \:NoSpecials{12}{0}{255}\catcode`\ =13%
   \catcode`\^^M=13\catcode`\^^I=13%
   \def^^M{\leavevmode\e:protex\par}\def^^I{  }%
   \def {\leavevmode\:Sp}}%
\catcode`\^^M=5\catcode`\ =10\catcode`\^^I=10
\expandafter\ifx \csname :Sp\endcsname\relax
  \expandafter\def\csname :Sp\endcsname{ }
\fi
\def\ShowFile#1{{\:ObeyIn    \openin15=#1
  \ifeof15 \:warn{\string\ShowFile{#1}?}\else
    \a:ShowFile\input #1 \b:ShowFile \fi \closein15 }}
\def\a:ShowFile{\ifvmode \csname IgnorePar\endcsname\fi
   \csname EndP\endcsname
   \HCode{<div class="ShowFile"
      style="font-family:monospace;white-space:nowrap;"
 >\html:src\html:invisible}\hfill\break
   \f:protex }
\def\b:ShowFile{\HCode{</div>\html:src}}
\long\def\c:ShowFile:#1#2{\def\a:ShowFile{#1}\def\b:ShowFile{#2}}
\def\html:codeid#1Q#2"#3</\tag:A>{ \NAME:
   "Q#2"}
\ifx \aXrefFile\:UnDef \let\aXrefFile=\empty \fi

\def\CodeId#1#2{\expandafter\ifx
    \csname  cw:)F\aXrefFile \file:id
                    \empty F-\endcsname\relax
  \else\:LikeRef{)F\aXrefFile \file:id\empty F-}\fi
  \:sharp              Q\make:addr{#2}"#1%
  \ifx \CodeInputLineNo\:UnDef \the\inputlineno \else \CodeInputLineNo\fi}
\let\showttl:WriteTrc=\:WriteTrc
\def\:WriteTrc#1{%
  \def\:temp{#1}\def\:tempa{ShowCode}\ifx\:temp\:tempa
     \def\:TagCs{\expandafter\trc:shw\:LastCodeLabel\trc:shw}%
  \else \ifx \id:WriteTrc\:Undef
     \def\:tempa{ShowTitle}\ifx\:temp\:tempa
     \expandafter\def\expandafter\:TagCs\expandafter
         {\:TagCs.\the\:CodeNumber}%
  \fi \fi \fi
  \showttl:WriteTrc{#1}}
\def\trc:shw#1"#2\trc:shw{#2 "#1"}
\ifx \footline\:UnDef \else
   \footline={\hfil}   \headline={\hfil}
\fi
\def\HREF:{ href=}
\def\tag:A{a}
\def\NAME:{ name=}
\def\make:addr#1{%
   \ifnum\clearcode:id>0 \romannumeral\clearcode:id Q\else PrTx\fi
   #1}
\ifx\clearcode:id\:UnDef
     \def\clearcode::id{0}  \def\clearcode:id{0}
\fi
\ifx \html:par\:UnDef \def\html:par{\HCode{<p>}} \fi
\def\html:invisible{<!--x-->\string&\#x00A0;}
\expandafter\ifx\csname htmlprotex:par\endcsname\relax
   \ifx\:removeindenttrue\:UnDef
      \def\:removeindenttrue{\let\:Undef=\:Undef}
   \fi
   \def\htmlprotex:par{{\everypar{}\csname
                HtmlPar\endcsname}\HCode{\html:src}}
\fi
\ifx\html:addr\:UnDeF
   \immediate\write16{--- needs --- tex4ht \jobname\space ---}%
\ifx\tmp:cnt\:UnDeF    \csname newcount\endcsname\tmp:cnt \fi
\def\g:advance#1{\bgroup \def\:temp{#1}%
                 \tmp:cnt=#1\afterassignment\:gplus \advance\tmp:cnt}
\def\:gplus{\expandafter\xdef\:temp{\the\tmp:cnt}\egroup}
\def\html:lbl{1}
\def\html:addr{\xdef\last:haddr{\file:id-\html:lbl}%
     \g:advance\html:lbl by 1\relax }
\ifx  \file:id\:UnDef
   \gdef\file:id{1}
   \global\let\maxfile:id=\file:id
\fi
\hbadness=10000      \vbadness=10000
\:CheckOption{fussy}  \if:Option  \else
   \hfuzz=99in          \vfuzz=\hfuzz
\fi
\hyphenpenalty=1000  \exhyphenpenalty=1000
\def\html:rightskip{\rightskip = 0pt plus 0.5\hsize  minus0.5\hsize }
\html:rightskip
\ifx \ht:special\:UnDef
   \let\ht:special=\special
\fi
\def\HCode#1{\ifx \EndPicture\:UnDef
   \relax\ifvmode\leavevmode\fi\ht:special{t4ht=#1}\fi}
\let\:HCode=\HCode
\let\Hbrakets\empty
\def\NewLineChar{\bgroup \catcode`\^=7 \:NewLineChar}
\def\:NewLineChar#1{\egroup \def\:newlnch{ #1}}
\NewLineChar{^^J}
\def\::HRef[#1]{\get:attr{#1}\::hRef\:::HRef}
\def\::HRefTag[#1]{\get:attr{#1}\::hRefTag\:::HRefTag}
\def\get:attr#1{\edef\:attr{\noexpand\get:atr #1 !*?: }\:attr}
\def\get:atr#1 #2!*?: #3#4{\def\:attr{\space#2}%
   \def\:te:mpa{#1}\ifx \:te:mpa\empty \let\:te:mpa#4\else
   \def\:te:mpa{#3[#1]}\fi \:te:mpa}
\def\H:Tag#1#2{\:TagHTag{#2}\HCode{\Hbrakets<\tag:A\:newlnch
   \NAME:"#2"\empty:lnk>}}
\def\::hRef[#1]#2{%
   \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1#2\relax \NOHREF:{}\else
             \HREF:"#1\if\relax#1\relax \else\:sharp #2\fi"\fi
           \:attr \empty:lnk>}}
\def\:::HRef#1{%
   \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1\relax \NOHREF:{}\else
               \HREF:"\get:hfile{#1}\:sharp #1"\fi \:attr \empty:lnk>}}
\def\::hRefTag[#1]#2#3{%
   \if\relax#3\relax\else\:TagHTag{#3}\fi
   \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1#2\relax \NOHREF:{#3}\else
                 \HREF:"#1\if\relax#2\relax \else\:sharp #2\fi"\fi
               \if\relax#3\relax\else\space \NAME:"#3"\fi
             \:attr \empty:lnk>}}
\def\:::HRefTag#1#2{%
   \if\relax#2\relax\else\:TagHTag{#2}\fi
   \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1\relax \NOHREF:{#2}%
                 \else\HREF:"\get:hfile{#1}\:sharp #1"\fi
               \if\relax#2\relax\else\space  \NAME:"#2"\fi
             \:attr \empty:lnk>}}
\let\empty:lnk=\empty
\def\NOHREF#1{\space}
\def\:TagHTag#1{\ifx -\let:val\else \Tag{)Q\aXrefFile #1}{\file:id}\fi}
\def\get:href{\expandafter\get::href}
\def\get::href#1-#2-{\ifnum #1=\file:id\space         \else
      \:LikeRef{)F\aXrefFile #1\empty F-}\fi
   \:sharp \make:addr{#2}}
\def\get:htag{\expandafter\get::htag}
\def\get::htag#1-#2-{\make:addr{#2}}
\ifx \aXrefFile\:UnDef \let\aXrefFile=\empty \fi

\def\get:hfile#1{%
   \expandafter\ifx\csname
                cw:)Q\aXrefFile #1\endcsname\relax
      \get@hfile{#1}%
   \else
      \expandafter\expandafter\expandafter\get::hfile
          \csname  cw:)Q\aXrefFile #1\endcsname,//%
   \fi  }
\def\get::hfile#1,#2//{%
   \ifnum \file:id=0#1  \else
       \expandafter\ifx
   \csname  cw:)F\aXrefFile #1%
                 \empty F-\endcsname\relax \else
      \:LikeRef{)F\aXrefFile #1\empty F-}%
\fi %
   \fi }
\ifx\get@hfile\:Undef \let\get@hfile=\:gobble \fi
      \let\html:src=\empty
\catcode`\#=12   \def\:sharp{#}   \catcode`\#=6

   \Htmltrue
\fi


\fi\:CheckOption{_^}  \if:Option
\def\du:cc{\catcode`\_=13  \catcode`\^=13  \let\du:cc=\:UnDef}
\let\:sub=_  \let\:sup=^
\catcode`\_=13  \catcode`\^=13
\def_{\ifmmode \:sub \else \string_\fi}
\def^{\ifmmode \:sup \else \string^\fi}
\:CheckOption{html}
   \if:Option  \else \:CheckOption{xhtml}\fi
\if:Option
  \append:def\SUBOn{\def_{\ifmmode \:sub \else \string_\fi}}
  \append:def\SUPOn{\def^{\ifmmode \:sup \else \string^\fi}}
\fi

  \fi\:CheckOption{pdf}
\if:Option
  \ifx \hyper:link\:UnDef   \let\:temp=\hyper:target
\else                     \let\:temp=\:UnDef      \fi
                            \ifx \:temp\:UnDef
\def\hyper:link{\hyperlink}
\def\hyper:target{\hypertarget}
\def\:temp{\ifx\pdfstartlink\:UnDef       
      \let\pdfstartlink\pdfannotlink
  \fi
  \ifx \pdfstartlink\:UnDef
     \long\def\hyper:target##1##2{\special
            {html:<a name="##1">}\special{html:</a>}}%
     \long\def\hyper:link##1##2{\special
            {html:<a href="##1">}##2\special{html:</a>}}%
  \else
     \long\def\hyper:target##1##2{\pdfdest name {##1} xyz}%
     \long\def\hyper:link##1##2{%
        \leavevmode \pdfstartlink  goto name {##1}##2\pdfendlink }    %
  \fi
}
\ifx \hyperlink\:UnDef  \:temp
\else   \ifx \hypertarget\:UnDef \:temp \fi \fi
                            \fi
\let\hyper::WindowTitle=\WindowTitle
\def\WindowTitle#1{\bgroup
   \def\WindowTitle##1{##1}%
   \xdef\:temp{\noexpand\H:WindowTitle{#1}}\egroup \:temp}

\def\H:WindowTitle#1{\leavevmode\hbox{%
   \expandafter\ifx\csname \clearcode:id W-#1\endcsname\relax
       \ttl:del{<.}%
   \else
       \hyper:link{\expandafter\get:href
           \csname \clearcode:id W-#1\endcsname -}{\ttl:del{<.}}%
   \fi
   \html:addr
   \hyper:target{\expandafter\get:htag\last:haddr -}{}%
   \expandafter\expandafter\expandafter\global\expandafter\let
                    \csname \clearcode:id W-#1\endcsname=\last:haddr
   \expandafter\ifx\csname \clearcode:id :cw:#1\endcsname\relax
      \expandafter\expandafter\expandafter\global
          \expandafter\def\csname \clearcode:id :cw:#1\endcsname{0}%
      \Tag{)\clearcode:id Z:#1}{\last:haddr}%
   \fi
   \def\:temp##1{\leavevmode \hbox{$\triangleleft
      \triangleleft$}~##1~\hbox{$\triangleright \triangleright$}}%
   \ifx \:temp    \hyper::WindowTitle \def\hyper::WindowTitle##1{~##1~}\fi
   \hyper::WindowTitle{\frag:href{)\clearcode:id P:#1}{#1}}%
   \:nextlink{\clearcode:id :cw:#1}{.>}%
   }}
\let\hyper::ModifyShowCode=\ModifyShowCode
\def\ModifyShowCode#1{%
   \hyper::ModifyShowCode{#1}%
   \let\H:PortTitle=\PortTitle
   \let\PortTitle=\hyper::PortTitle
   }
\let\hyper::PortTitle=\PortTitle
\def\hyper::PortTitle#1{\hbox{%
  \def\:Sp{ }%
  \bgroup
     \html:addr
     \hyper:target{\get:htag\last:haddr-}{}%
     \ifx\:AppendSign\empty
        \expandafter\expandafter\expandafter\global\expandafter\edef
               \csname \clearcode:id 9:#1\endcsname{0}%
        \ttl:del{<..}%
     \else
        \hyper:link{\expandafter\get:href
             \csname \space\clearcode:id P:#1\endcsname-}{\ttl:del{<..}}%
     \fi
     \expandafter\expandafter\expandafter\global\expandafter\let
             \csname \space\clearcode:id P:#1\endcsname=\last:haddr
  \egroup
  \bgroup
      \ifx\:AppendSign\empty
         \Tag{)\clearcode:id P:#1}{\last:haddr}%
      \fi
      \def\:temp##1{\leavevmode \hbox{$\triangleright
         \triangleright$}~##1~\hbox{$\triangleleft \triangleleft$}}%
      \ifx \:temp\H:PortTitle \def\H:PortTitle##1{~##1~}\fi
            \H:PortTitle{\frag:href{)\clearcode:id Z:#1}{#1}}%
   \egroup
  \:nextlink{\clearcode:id 9:#1}{..>}%
}}
\def\frag:href#1#2{%
   \hyper:link{%
     \expandafter\ifx \csname  cw:#1\endcsname \relax
        \expandafter\get:href\last:haddr -%
  \else
     \expandafter\expandafter\expandafter
                \get:href\csname cw:#1\endcsname -%
  \fi}{#2}}
\def\:nextlink#1#2{%
   \bgroup    \def\:Sp{\space}%
      \def\:lbl{)\the\tmp:cnt :#1}%
      \tmp:cnt=\csname #1\endcsname\space
      \Tag{\:lbl}{\last:haddr}%
      \advance\tmp:cnt by 1\space
      \expandafter\xdef\csname #1\endcsname{\the\tmp:cnt}%
      \expandafter\ifx\csname  cw:\:lbl\endcsname\relax
         \ttl:del{#2}%
      \else
         \hyper:link{\expandafter\expandafter\expandafter
                       \get:href\:LikeRef{\:lbl}-}{\ttl:del{#2}}%
      \fi
   \egroup
}
\let\:sharp=\empty   \def\clearcode::id{0}  \def\clearcode:id{0}
\def\file:id{1}
\def\get:href{\expandafter\get::href}
\def\get::href#1-#2-{\ifnum #1=\file:id\space         \else
      \:LikeRef{)F\aXrefFile#1\empty F-}\fi
   \:sharp \make:addr{#2}}
\def\get:htag{\expandafter\get::htag}
\def\get::htag#1-#2-{\make:addr{#2}}
\def\get:hfile#1{%
   \expandafter\ifx\csname
                cw:)Q\aXrefFile#1\endcsname\relax
      \get@hfile{#1}%
   \else
      \expandafter\expandafter\expandafter\get::hfile
          \csname  cw:)Q\aXrefFile#1\endcsname,//%
   \fi  }
\ifx \aXrefFile\:UnDef \let\aXrefFile=\empty \fi
\def\get::hfile#1,#2//{%
   \ifnum \file:id=0#1  \else
       \expandafter\ifx
   \csname  cw:)F\aXrefFile#1%
                 \empty F-\endcsname\relax \else
      \:LikeRef{)F\aXrefFile#1\empty F-}%
\fi %
   \fi }
\ifx\get@hfile\:Undef \let\get@hfile=\:gobble \fi
\def\L:Del{<..}
\def\l:Del{<.}
\def\R:Del{..>}
\def\ttl:del#1{\def\:tempa{#1}%
   \ifx \:tempa\L:Del \L:del
   \else \ifx \:tempa\l:Del \l:del
   \else \ifx \:tempa\R:Del \R:del
   \else \r:del \fi\fi\fi}
\def\HShowCode#1#2#3#4#5{%
   \def\:temp{#1#2}\ifx \:temp\empty \else
     \def\L:del{#1}\def\R:del{#2}\fi
   \def\:temp{#3#4}\ifx \:temp\empty \else
     \def\l:del{#3}\def\r:del{#4}\fi
   \def\:temp{#5}\ifx \:temp\empty \else
     \def\html:BackTitle{#5}\fi
}
\HShowCode{$\triangleleft\triangleleft$}
          {$\triangleright\triangleright$}
          {$\triangleright\triangleright$}
          {$\triangleleft\triangleleft$}   {}
\ifx\tmp:cnt\:UnDeF    \csname newcount\endcsname\tmp:cnt \fi
\def\g:advance#1{\bgroup \def\:temp{#1}%
                 \tmp:cnt=#1\afterassignment\:gplus \advance\tmp:cnt}
\def\:gplus{\expandafter\xdef\:temp{\the\tmp:cnt}\egroup}
\def\html:lbl{1}
\def\html:addr{\xdef\last:haddr{\file:id-\html:lbl}%
     \g:advance\html:lbl by 1\relax }
\def\make:addr#1{%
   \ifnum\clearcode:id>0 \romannumeral\clearcode:id Q\else PrTx\fi
   #1}

\def\:LikeRef#1{\csname  cw:#1\endcsname}

\fi \def\AlProTex{\:warn{AlProTex already loaded}}
\let\:InitAlProTex=\:undefined
\let\:CheckOption=\:undefined
\let\:GetOptions=\:undefined

\def\:temp{ \let\:temp=\:undefined
   \csname :notex\endcsname \csname :getpseducodeII\endcsname
    \endinput}
\:RestoreCatcodes
\csname :temp\endcsname

