\newlinechar `^^J

\def \savecat #1%
    {\expandafter\xdef\csname\string#1savedcat\endcsname{\the\catcode`#1}}
\def \restorecat #1%
    {\catcode`#1=\csname\string#1savedcat\endcsname}
\savecat\@

\catcode`\@ = 11

\def \bold#{\bgroup\bf\let\next = }

\def \ttt#{\bgroup\tt\let\next = }% typewriter

\def \stress #1%
    {\begingroup
     \def \next
         {\def \next
              {\setbox 0 = \hbox {\nexttoken}%
               \ifdim \ht 0< \fontdimen 5 \font
                      \it #1%
               \else
                      \it #1\/%
               \fi}%
          \ifcat A\noexpand \nexttoken
                \next
          \else
                \ifcat 0\noexpand \nexttoken
                        \next
                \else
                        \ifcat \space \noexpand \nexttoken
                        \else
                               %%% \message {?: \meaning \nexttoken}%
                        \fi
                        \it #1\/%
                \fi
          \fi
          \endgroup}%
     \futurelet \nexttoken \next }
\def \oct#1{\hbox{\rm\'{}\kern-.2em\it#1\/\kern.05em}} % octal constant
\def \hex#1{\hbox{\rm\H{}\tt#1}} % hexadecimal constant

\def \oddline#1%
    {\cr
     \noalign{\nointerlineskip}
     \multispan{19}\hrulefill&
     \setbox0=\hbox{\lower 2.3pt\hbox{\hex{#1x}}}\smash{\box0}\cr
     \noalign{\nointerlineskip}}

\def \evenline {\cr\noalign{\hrule}}

\def \chartstrut {\lower4.5pt\vbox to14pt{}}

\def \beginchart#1%
    {$$\postdisplaypenalty=-10000 \global\count@=0 #1
     \halign to\hsize\bgroup
     \chartstrut##\tabskip0pt plus10pt&
     &\hfil##\hfil&\vrule##\cr
     \lower6.5pt\null
     &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}

\def \endchart
    {\raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
     &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$}

\def \:{\setbox0=\hbox{\char\count@}%
        \ifdim\ht0>7.5pt\reposition
        \else\ifdim\dp0>2.5pt\reposition\fi\fi
       \box0\global\advance\count@ by1 }

\def \reposition {\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}

\def \normalchart
    {&\oct{00x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline0
     &\oct{01x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{02x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline1
     &\oct{03x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{04x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline2
     &\oct{05x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{06x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline3
     &\oct{07x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{10x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline4
     &\oct{11x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{12x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline5
     &\oct{13x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{14x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline6
     &\oct{15x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
     &\oct{16x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline7
     &\oct{17x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline}

\outer\def \begindisplay
          {\obeylines\startdisplay}

{\obeylines\gdef\startdisplay#1
  {\catcode`\^^M=5$$#1\halign\bgroup\indent##\hfil&&\qquad##\hfil\cr}}

\outer\def\enddisplay{\crcr\egroup$$}
\def \<#1>{\leavevmode\hbox{$\langle$#1\/$\rangle$}}

\def \pt {\,{\rm pt}} % units of points, in math formulas
\def \in {\,{\rm in}} % units of inches, in math formulas
\def \em {\,{\rm em}} % units of em, in math formulas
\font \chapterfont = cmbx10 at 20pt
\font \titlefont   = cmssbx10 at 17pt
\font \authorfont  = cmssbx10 at 12pt
\font \sectionfont = cmbx10 at 12pt
\font \tocfont     = cmssbx10 at 12pt

\font \tenbxit     = cmbxti10 \def \bfit {\tenbxit}
\font \tenss       = cmss10
\font \tenssbf     = cmssbx10
\font \ninerm      = cmr9
\font \sevenrm     = cmr7
\font \ninebf      = cmbx9
\font \nineit      = cmti9
\font \ninebxit    = cmbxti10 at 8.5pt
\font \ninett      = cmtt9
\font \ninei       = cmmi9
\font \seveni      = cmmi7
\font \ninesy      = cmsy9
\font \nineex      = cmex9
\hoffset = 0.5in % extra space used to print code line numbers
\hsize   = 6.0in % less 0.5 than plain.tex value
\vsize   = 8.9in % default value
\advance \vsize by 0.5\baselineskip
\divide \vsize by \baselineskip
\multiply \vsize by \baselineskip
\def \RCS {\relax}  \def \RCSversion {Experimental}

\newdimen\textsize \textsize=\hsize

\def \pagenumber
    {\folio}

\headline =
    {\hbox to \textsize{\strut%
          \ifnum\pageno>1
              \tenss\filename\hfil Version \RCSversion%
              \hbox to 4em{\hfil\pagenumber}%
          \else
              \hfil\tenss\RCS%
          \fi}\hss}

\footline = {\hfil}
\def \tocline #1#2%
    {\line{{\ignorespaces#1}\leaders\hbox to 3pt{.\hfil}\hfil
     \hbox to 15pt{\hss#2}}}

\def \settocparms #1%
       {\count@=#1
        \ifnum\count@<1
            \def\tocskip
               {\vskip 3pt plus 1in
                \penalty-100
                \vskip 0pt plus -1in^^J}
            \def\tocstyle{\tenssbf}
            \def\tocindent{\z@}
        \else
            \def\tocskip{}
            \def\tocstyle{\tenss}
            \dimen@=20pt \advance\count@ by \m@ne \dimen@=\count@\dimen@
            \edef\tocindent{\the\dimen@}
        \fi}

\def \topofcontents
    {\vskip2\baselineskip
     \leftline{\tocfont Contents}
     \vskip2ex
     \begingroup\rm}

\def \botofcontents
    {\endgroup
     \semifilbreak{0.9}
     \vskip3\baselineskip}

\def \printcontents
    {\topofcontents
     \Input{\jobname.toc}
     \botofcontents}
\def \title #1#2%
    {\vglue4\baselineskip
     \noindent{\rightskip = 0in plus 4em
               \hyphenpenalty = 10000 \exhyphenpenalty = 10000
               \baselineskip = 20pt
               \titlefont#1\par}
     \vskip 0.5\baselineskip
     \hrule height 2pt width \hsize
     \vskip 0.5\baselineskip
     \noindent
     \line{\authorfont #2}
     \vskip2\baselineskip}

\def \startsection#1#2#3#4#5#6%
    {\ifnum#1<2
        \semifilbreak{0.8}
     \fi
     \vskip #3
     \def\titl@{#6}
     \edef\themodtitle{\sanitize\titl@}
     \message{[\themodtitle]}
     \settocparms{#1}
     {\edef\next
          {\noexpand\write\cont{\tocskip\string\tocline%
             {\hskip\tocindent\tocstyle\space\sanitize\themodtitle}%
             {\noexpand\the\pageno}}}%
           \next}% write to toc
     \vbox{\leftskip=#2
           \rightskip=0.5true in plus 4em minus 0.5 true in
           \hyphenpenalty=9999 \exhyphenpenalty=9999
           \noindent#5#6}%
     \nobreak
     \vskip#4}

\def \gobblemeaning#1:->{}
\def \sanitize {\expandafter\gobblemeaning\meaning}

\def \chapter#1%
    {\vfil\eject\startsection{0}{\z@}{\z@}{6ex}{\chapterfont}{#1}}
\def \section#1%
    {\startsection{1}{\z@}{4ex}{2ex}{\sectionfont}{#1}}
\def \subsection#1%
    {\startsection{2}{\z@}{2ex}{1ex}{\tenbf}{#1}}
\def \subsubsection#1%
    {\startsection{3}{\z@}{1ex}{0ex}{\tenit}{#1}}
\def \paragraph#1%
    {\startsection{4}{\z@}{1.5ex}{0ex}{\tenit}{#1}}
{\obeyspaces\global\let = \ } % from texbook, p.381

{\catcode`\`=\active \gdef`{\relax\lq}}
{\catcode`\^^I=\active \gdef^^I{\ \ \ }}

{\obeyspaces\global\def\gobblespace#1{\ifx#1 \else#1\fi}}

\def \setupmodname
    {\catcode`\$=3 \catcode`\&=4%
     \catcode`\#=6 \catcode`\%=14%
     \catcode`\~=13 \catcode`\_=8%
     \catcode`\^=7 \catcode`\ =10%
     \catcode`\^^M=5\relax}

\def \LA {\begingroup\setupmodname$\langle\,$\bfit}
\def \RA {\/$\,\rangle$\endgroup}

\gdef \ttverbatim
     {\begingroup%
      \makeother\\\makeother\{\makeother\}\makeother\$%
      \makeother\&\makeother\#\makeother\%\makeother\~%
      \makeother\_\makeother\^\makeother\"%
      \obeyspaces\obeylines\tt}

\newskip\ttglue
\ttglue=.5em plus.25em minus.15em

{\catcode`\|=\active
 \obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\  \let|=\endgroup}}

\def \CODE%
    {\ttverbatim%
     \let\par=\endgraf%
     \parskip=\z@%
     \leavevmode%
     \ttfinish}% written by web2tex script itself

%%% {\catcode`\| = 0 |catcode`|\ = 12 %
%%% |obeylines |gdef|ttfinish#1<EDOC>{|gobblespace#1|endgroup}}

\def \NO #1% line numbers which appear in the margin
    {\noindent\llap{\ninei #1\qquad}\kern\parindent}

\def \N #1#2% page number -- line number (indexes)
    {$#2_{\oldstyle#1}$}

\def \BEGINCODE
    {\semifilbreak{0.9}
     \bigskip
     \begingroup
     \obeylines}
\def \ENDCODE
    {\endgroup
     \semifilbreak{0.9}}

\def \BEGINDOC
    {\bigskip
     \begingroup
     \catcode`\|=\active}
\def \ENDDOC
    {\endgroup}

\newif \iffullpages

\newdimen \upperbound

\def \semifilbreak #1%
    {\par
     \upperbound = #1\vsize       %% 0.1\vsize \approx 5\baselineskip
     \ifdim\pagetotal > \pagegoal %% page already overfull;
                                  %% left to page builder
     \else
       \ifdim\pagetotal > \upperbound
          \vfill\eject
       \fi
     \fi}
\def \gobble#1{}
\let \wlog = \gobble

\newskip\abovecolumnskip \abovecolumnskip = \bigskipamount
\newskip\belowcolumnskip \belowcolumnskip = \bigskipamount
\newdimen \gutter \gutter = 2pc
\newdimen \c@lumnhsize
\newdimen \pagegoal@limit
\newdimen \htp@rtialpage
\newtoks \previousoutput
\newcount \number@fcolumns
\newbox \@partialpage
\newdimen \singlec@lumnhsize
\newdimen \singlec@lumnvsize
\newtoks \previousoutput
\let \@ndcolumns = \relax
\def \doublecolumns {\@columns2}
\def \triplecolumns {\@columns3}
\def \quadcolumns   {\@columns4}

\def \singlecolumn
    {\@ndcolumns\vskip\belowcolumnskip\nointerlineskip}

\let \endcolumns = \singlecolumn

\def \@columns #1%
    {\@ndcolumns%
     \begingroup
     \global\let\@ndcolumns=\@@endcolumns
     \par % Shouldn't start in horizontal mode.
     \global\previousoutput = \expandafter{\the\output}
     \pagegoal@limit = \pagegoal
     \advance \pagegoal@limit by -5\baselineskip
     \ifdim\pagetotal > \pagegoal@limit
        \vfill\eject
     \else
        \global\output =
              {\global\setbox\@partialpage =
                      \vbox{\unvbox255\vskip\abovecolumnskip}}
     \pagegoal = \pagetotal
     \eject % now expand the \output just above.
     \fi
     \global\number@fcolumns=#1
     \global\c@lumnhsize = \hsize % if \hsize changed, get the new value.
     \global\advance\c@lumnhsize by -#1\gutter
     \global\divide\c@lumnhsize by #1
     \global\output = {\c@lumnoutput}
     \global\singlec@lumnhsize = \hsize
     \global\singlec@lumnvsize = \vsize
     \hsize = \c@lumnhsize
     \htp@rtialpage = \ht\@partialpage
     \advance \htp@rtialpage by 0.5\baselineskip
     \divide \htp@rtialpage by \baselineskip
     \multiply \htp@rtialpage by \baselineskip
     \ht\@partialpage = \htp@rtialpage
     \global\advance\vsize by -\htp@rtialpage
     \global\vsize = #1\vsize }
\def \@columnsplit
    {\dimen0 = \ht255
     \advance \dimen0 by \topskip
     \advance \dimen0 by -\baselineskip
     \divide\dimen0 by \number@fcolumns
     \splittopskip = \topskip
     \begingroup
        \vbadness = 10000
        \loop
          \setbox8=\copy255
          \global\setbox1 = \vsplit8 to \dimen0
          \global\setbox3 = \vsplit8 to \dimen0
          \ifnum\number@fcolumns>2%
            \global\setbox5 = \vsplit8 to \dimen0
          \fi
          \ifnum\number@fcolumns>3%
            \global\setbox7 = \vsplit8 to \dimen0
          \fi
          \ifdim\ht8>\z@ \global\advance\dimen0 by 1pt
        \repeat
     \endgroup
     \global\setbox255 = \vbox{% see the last line on p.417 (wb)
        \unvbox\@partialpage
        \ifnum\number@fcolumns>0%
          \setbox1 = \vbox to \dimen0{\dimen2=\dp1 \unvbox1\kern-\dimen2\vfil}
          \ifnum\number@fcolumns=1%
             \hbox to \singlec@lumnhsize{\box1}
          \fi
        \fi
        \ifnum\number@fcolumns>1%
          \setbox3 = \vbox to \dimen0{\dimen2=\dp3 \unvbox3\kern-\dimen2\vfil}
          \ifnum\number@fcolumns=1%
            \hbox to \singlec@lumnhsize{\box1\hfil\box3}
          \fi
        \fi
        \ifnum\number@fcolumns>2%
          \setbox5 = \vbox to \dimen0{\dimen2=\dp5 \unvbox5\kern-\dimen2\vfil}
          \ifnum\number@fcolumns=3%
            \hbox to\singlec@lumnhsize{\box1\hfil\box3\hfil\box5}
          \fi
        \fi
        \ifnum\number@fcolumns>3%
          \setbox7 = \vbox to \dimen0{\dimen2=\dp7 \unvbox7\kern-\dimen2\vfil}
          \ifnum\number@fcolumns=4%
            \hbox to\singlec@lumnhsize{\box1\hfil\box3\hfil\box5\hfil\box7}
          \fi
        \fi}}

\def \c@lumnoutput
    {\@columnsplit
     \hsize = \singlec@lumnhsize % local to the \output group
     \vsize = \singlec@lumnvsize
     \the\previousoutput
     \global\vsize=\number@fcolumns\singlec@lumnvsize}

\def \@@endcolumns
    {\global\let\@ndcolumns=\relax%
     \par % Shouldn't start in horizontal mode.
     \global\output = {\global\setbox1 = \box255}%
     \pagegoal = \pagetotal
     \eject
     \global\setbox255 = \box1
     \@columnsplit
     \global\vsize = \singlec@lumnvsize
     \global\output = \expandafter{\the\previousoutput}%
     \endgroup
     \unvbox255}
\def \newwrite
    {\alloc@7\write\chardef\sixt@@n} % remove \outer

\def \@nameuse#1%
    {\csname #1\endcsname}

\def \arabic#1{\@arabic{\@nameuse{c@#1}}}
\def \roman#1{\@roman{\@nameuse{c@#1}}}
\def \Roman#1{\@Roman{\@nameuse{c@#1}}}
\def \alph#1{\@alph{\@nameuse{c@#1}}}
\def \Alph#1{\@Alph{\@nameuse{c@#1}}}

\def \@arabic#1{\ifnum #1>0 \number #1\fi}
\def \@roman#1{\romannumeral #1}
\def \@Roman#1{\expandafter\uppercase\expandafter{\romannumeral #1}}
\def \@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi}
\def \@ialph#1%
    {\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or k\or l\or
         m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or
         z\else\@ctrerr\fi}
\def \@Alph#1{\ifcase#1\or A\or B\or C\or D\else\@Ialph{#1}\fi}
\def \@Ialph#1%
    {\ifcase#1\or \or \or \or \or E\or F\or G\or H\or I\or J\or K\or L\or
         M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or
         Z\else\@ctrerr\fi}

\def \pagenumbering#1%
    {\global\pageno \@ne \gdef\thepage{\csname @#1\endcsname\pageno}}

\pagenumbering {arabic}
\newdimen \@savsk
\newcount \@savsf

\def \@bsphack
    {\@savsk\lastskip\ifhmode\@savsf\spacefactor\fi}

\def \@esphack
    {\relax%
     \ifhmode\spacefactor\@savsf
        {}\ifdim \@savsk >\z@ \ignorespaces\fi
     \fi}

\def \makeother #1{\catcode`#1=12\relax}

\def \@sanitize
    {\makeother\ \makeother\\\makeother\$%
     \makeother\&\makeother\#\makeother\^%
     \makeother\_\makeother\%\makeother\~\relax}
\def \makeindex
    {\newwrite\@indexfile
     \immediate\openout \@indexfile = \jobname.idx
     \def\index {\@bsphack\begingroup\@sanitize\@wrindex\@indexfile}
     \message{^^J--> Writing index file \jobname.idx }}
\def \@wrindex#1#2%
    {\let \thepage = \relax%
     \xdef\gtempa
         {\write#1{\string\E{#2}{\thepage}}}%
          \endgroup\gtempa\@esphack}
\def \index
    {\@bsphack\begingroup\@sanitize\@index}
\def \@index#1%
    {\endgroup\@esphack}

\def \makeglossary
    {\newwrite\@glossaryfile
     \immediate\openout\@glossaryfile=\jobname.glo
     \def\glossary{\@bsphack\begingroup\@sanitize\@wrindex\@glossaryfile}
     \message{Writing glossary file \jobname.glo }\fi}
\def \glossary {\@bsphack\begingroup\@sanitize\index}

\def \@idxitem {\par\hangindent 20pt }
\def \subitem {\par\hangindent 20pt \hskip 20pt }
\def \subsubitem {\par\hangindent 20pt \hskip 30pt }

\def \seeterm{see}
\def \see#1#2%
    {{\it \seeterm\/} #1}

\def \Input#1%
    {\openin1 #1
     \ifeof1
       \message{^^J--- I cannot find file #1 }
     \else
       \closein1
       \input #1
       \message{^^J<-- Reading file #1 }
     \fi}

\def \indexspace
    {\relax}

\def \printuserleveldefs
    {\singlecolumn
     \vfill\eject
     \Input{\jobname.und}}
\def \printdefs
    {\singlecolumn
     \vfill\eject
     \Input{\jobname.dnd}}
\def \printchunks
    {\singlecolumn
     \vfill\eject
     \let \pagenumber = \relax
     \Input{\jobname.chn}}

\def \beginuserleveldefs
    {\begingroup
     \textfont0 = \ninerm \scriptfont0 = \sevenrm%
     \textfont1 = \ninei \scriptfont1 = \seveni%
     \textfont2 = \sevensy%
     \textfont3 = \nineex%
     \def \rm {\fam0\ninerm} \rm%
     \def \it {\nineit}%
     \def \bfit {\ninebxit}%
     \def \bf {\ninebf}%
     \def \tt {\ninett}%
     \def \oldstyle {\fam\@ne\ninei}%
     \chardef\\  = "5C%
     \parindent = \z@ \parskip = \z@%
     \hfuzz = \hsize % index pages are wider
     \baselineskip = 11pt \topskip = \baselineskip%
\advance \vsize by 0.5\baselineskip
\divide \vsize by \baselineskip
\multiply \vsize by \baselineskip
     \section{User-level definitions}
     \let\item\@idxitem
     \triplecolumns \tt}
\def \begindefs
    {\begingroup
     \textfont0 = \ninerm \scriptfont0 = \sevenrm%
     \textfont1 = \ninei \scriptfont1 = \seveni%
     \textfont2 = \sevensy%
     \textfont3 = \nineex%
     \def \rm {\fam0\ninerm} \rm%
     \def \it {\nineit}%
     \def \bfit {\ninebxit}%
     \def \bf {\ninebf}%
     \def \tt {\ninett}%
     \def \oldstyle {\fam\@ne\ninei}%
     \chardef\\  = "5C%
     \parindent = \z@ \parskip = \z@%
     \hfuzz = \hsize % index pages are wider
     \baselineskip = 11pt \topskip = \baselineskip%
\advance \vsize by 0.5\baselineskip
\divide \vsize by \baselineskip
\multiply \vsize by \baselineskip
     \section{Definitions}
     \let\item\@idxitem
     \triplecolumns \tt}
\def \beginchunks
    {\begingroup
     \textfont0 = \ninerm \scriptfont0 = \sevenrm%
     \textfont1 = \ninei \scriptfont1 = \seveni%
     \textfont2 = \sevensy%
     \textfont3 = \nineex%
     \def \rm {\fam0\ninerm} \rm%
     \def \it {\nineit}%
     \def \bfit {\ninebxit}%
     \def \bf {\ninebf}%
     \def \tt {\ninett}%
     \def \oldstyle {\fam\@ne\ninei}%
     \chardef\\  = "5C%
     \parindent = \z@ \parskip = \z@%
     \hfuzz = \hsize % index pages are wider
     \baselineskip = 11pt \topskip = \baselineskip%
\advance \vsize by 0.5\baselineskip
\divide \vsize by \baselineskip
\multiply \vsize by \baselineskip
     \parskip = 2\p@ plus 2\p@
     \let\item\@idxitem
     \section{Chunks}
     \bf}

\def \endindex
    {\endgroup}

\def \makeindexes
    {\par
     \newwrite\@userleveldefsfile
     \immediate\openout\@userleveldefsfile=\jobname.udx
     \def\udx{\@bsphack\begingroup\@sanitize\@wrindex\@userleveldefsfile}
     \message{^^J--> Writing index file \jobname.udx }
     \newwrite\@defsfile
     \immediate\openout\@defsfile=\jobname.ddx
     \def\ddx{\@bsphack\begingroup\@sanitize\@wrindex\@defsfile}
     \message{^^J--> Writing index file \jobname.ddx }
     \newwrite\@chunkfile
     \immediate\openout\@chunkfile=\jobname.chk
     \def\chk{\@bsphack\begingroup\@sanitize\@wrindex\@chunkfile}
     \message{^^J--> Writing index file \jobname.chk }}
\newcount\miscount      % number of unknown references
\newif\ifshowmisses

\def \ref #1#2%
    {\xdef\temp{#1}
     \expandafter\dordef\csname#2\endcsname}
\def \dordef #1%
    {\global\let#1\temp}

\Input{\jobname.ref}
\newwrite\refo \immediate\openout\refo=\jobname.ref

\def \pageref #1%
    {\write\refo{\string\ref{\number\pageno}{#1}}}
\def \refpage #1%
    {\expandafter\usedef\csname#1\endcsname}

\def \usedef #1%
    {\ifx#1\relax%
       \ifshowmisses\showmiss #1 \fi%
       \global\advance\miscount by 1 ???%
     \else%
       #1%
     \fi}

\def \showmiss #1%
    {{\escapechar=-1%
     \message{^^J*** WARNING: Undefined reference > #1<}}}

\outer \def \bye
      {\write \cont {\string\restorecat\string\@}
       \closeout\cont
       \ifnum\miscount>0
           \message{^^J!!! \the\miscount\space %
                    undefined reference(s) were present }%
       \fi
       \par\vfill\supereject
       \end}
\raggedbottom
\frenchspacing
\fullpagesfalse
\newwrite \cont
\openout \cont = \jobname.toc
\write \cont {\string\savecat\string\@}
\write \cont {\string\catcode`\string\@=11}

\restorecat\@
