42.5 TOC

<..scrbook toc..>
 <.book et al tocs.>
 \edef\:TOC{%
    \noexpand\ifx [\noexpand\:temp
       \noexpand\expandafter\noexpand\:TableOfContents
    \noexpand\else
       \noexpand\Auto:ent{\ifnum \c@tocdepth >-2 part,\fi
 \expandafter\ifx \csname @chapter\endcsname\relax
    \ifnum \c@tocdepth >\z@  section,\fi
 \else
    \ifnum \c@tocdepth >\m@ne chapter,appendix,addchap,\fi
    \ifnum \z@>\c@tocdepth\else section,\fi
    \ifnum 1>\c@tocdepth \else subsection,\fi
 \fi
 \ifnum 2>\c@tocdepth \else subsection,\fi
 \ifnum 3>\c@tocdepth \else subsubsection,\fi
 \ifnum 4>\c@tocdepth \else paragraph,\fi
 \ifnum 5>\c@tocdepth \else subparagraph,\fi
 UnDFexyz}%
    \noexpand\fi}
 \def\:tableofcontents{\futurelet\:temp\:TOC}
 \def\Auto:ent#1{%
    \edef\auto:toc{\noexpand\:TableOfContents[\ifx \auto:toc\:UnDef
       #1\else \auto:toc \fi]}  \auto:toc
    \global\let\auto:toc\:UnDef }
 
 \def\:tocs{\noexpand\:tableofcontents}
 \pend:defIII\addcontentsline{%
    \def\:temp{##1}\def\:tempa{toc}\ifx \:temp\:tempa
    \gHAdvance\TitleCount  1 \fi }
 \def\@dottedtocline#1#2#3#4#5{\hbox{\def\numberline##1{\e:listof
                 ##1\f:listof}\c:listof#4\d:listof}\ignorespaces}
 \def\@starttoc#1{%
   \begingroup
     \makeatletter   \Configure{cite}{}{}{}{}%
     \def\:temp{#1}\def\:tempa{toc}%
     \a:listof\par
     \@input{\jobname.\ifx \:temp\:tempa 4ct\else #1\fi}%
     \b:listof
     \if@filesw
       \expandafter\expandafter\csname
           newwrite\endcsname\csname tf@#1\endcsname
       \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
     \fi
     \global\@nobreakfalse
   \endgroup}
 
 \NewConfigure{tableofcontents*}[1]{%
    \def\:tempa{#1}\ifx\empty\:tempa
       \ifx \au:StartSec\:UnDef \else \gdef\:StartSec{\au:StartSec}\fi
    \else
       \edef\auto:toc{#1}%
          \ifx \au:StartSec\:UnDef
             \let\au:StartSec\:StartSec
             \def\:StartSec{\:tableofcontents
                \global\let\auto:toc\:UnDef \:StartSec}%
             \pend:def\:tableofcontents{\gdef\:StartSec{\au:StartSec}}%
    \fi  \fi
 }
 -_-_-