% symbols
\def\Kalpha#1{$\rm K\alpha_#1$}
\def\twotheta{$2\theta$}
\def\muVAX{$\mu$VAX--II\ }
\def\rhor{$\rho(r)$}
\def\TAB#1 {\par\leavevmode\hangindent 0.3in
    \hbox to 0.3in{\hss #1\enspace}}
\def\HANG {\par\leavevmode\hangindent 0.3in\noindent\enspace}
\def\!{}	% this defines a line which will be ignored in the help file
\def\<{\endgraf}
\def\>{\endgraf} 
\def\_{\char'137 }
\catcode`\_=\active
\def_{{\tt\char'137}}

% Define fonts for headings
\font\chapfont=cmbx10 scaled 1577
\def\chapsize{15pt}
\font\subfont=cmbx10 scaled 1315
\def\subsize{12pt}
%\font\subsubfont=cmbx10 scacled\magstep1
\font\subsubfont=cmti10 scaled 1095
\def\subsubsize{12pt}
%\font\BIG=cmbx10 scaled 1893
\font\BIG=cmbx10 scaled 1577

\def\qualindent{1.75 in}
\def\normparskip{\parskip=\medskipamount}
\def\qualparskip{\parskip=5 pt}
\parindent=0mm
\hsize=6.8truein
\hoffset=-0.15truein
\vsize=9truein
\voffset=0truein
\topskip=1truecm
\pretolerance=5000
\tolerance=10000

\footline={\hfil}
%\headline={\it\firstmark\hfil\folio}
\def\evenheadline{\it\firstmark\hfil\folio}
\def\oddheadline{\it\folio\hfil\firstmark}
\def\makeheadline{\vbox to 0pt{\vskip-.7truecm
    \ifnum\pageno=1 
    \else
        \ifodd\pageno \line{\oddheadline}\smallskip\hrule
        \else         \line{\evenheadline}\smallskip\hrule
        \fi
    \fi
        \vss}\nointerlineskip}
\def\today{\ifcase\month\or January\or February\or March\or April\or
    May\or June\or July\or August\or September\or October\or November\or
    December\fi\space\number\day, \number\year}

\newcount\chapcount \newcount\subcount \newcount\subsubcount
\chapcount=0 \subcount=0 \subsubcount=0
\def\curchap{\null}

\def\Program#1\par{\progcomtable{#1}\chapter{Program #1}\par}
\def\chapter#1\par{\par\normparskip\leftskip 0pt
    \vskip 0pt plus.5\vsize \goodbreak
    \vskip 0pt plus-.5\vsize \bigskip \bigskip
    \advance \chapcount by 1 \subcount=0 \subsubcount=0
    \immediate\write16{Processing Chapter: #1}%
    \gdef\curchap{{#1}}%
    \mark{\the\chapcount.\enspace#1}%
    {\chapfont \setbox0=\hbox{Chapter \the\chapcount:\enspace}\hangindent=\wd0
        \baselineskip=\chapsize\raggedright
        \noindent \box0 #1\bigskip \nobreak}\chapcontents{#1}}

\def\Command#1\par{\commcomtable{#1}\subrub{Command #1}\par}
\def\subrub#1\par{\par\leftskip 0pt\normparskip
    \vskip 0pt plus.2\vsize \goodbreak
    \vskip 0pt plus-.2\vsize \bigskip
    \advance \subcount by 1 \subsubcount=0
    \mark{\the\chapcount.\the\subcount\enspace\curchap -- #1}%
    {\subfont \setbox0=\hbox{\the\chapcount.\the\subcount\enspace}%
        \baselineskip=\subsize\hangindent=\wd0
        \raggedright \noindent \box0 #1\medskip \nobreak}\subcontents{#1}}

\def\subsubrub#1\par{\par\leftskip 0pt\normparskip
    \vskip 0pt plus.1\vsize \goodbreak
    \vskip 0pt plus-.1\vsize \bigskip
    \advance \subsubcount by 1
    {\subsubfont\setbox0=\hbox%
        {\the\chapcount.\the\subcount.\the\subsubcount\enspace}%
        \baselineskip=\subsubsize\hangindent=\wd0
        \raggedright \noindent \box0 #1\medskip \nobreak}\subsubcontents{#1}}

\def\Parameter{\par\leftskip 0pt\subsub{PARAMETER}\par}
\def\Qualifiers{\par\leftskip 0 pt\subsub{QUALIFIERS}\par}
\def\Qualifier{\par\leftskip 0 pt\subsub{QUALIFIER}\par}
\def\Examples{\par\leftskip 0 pt\subsub{EXAMPLES}\par}
\def\subsub#1\par{\par\leftskip 0pt\normparskip
    \vskip 0pt plus.18\vsize \goodbreak
    \vskip 0pt plus-.18\vsize \bigskip
    {\subsubfont\baselineskip=\subsubsize
        \raggedright \noindent #1\medskip \nobreak}}

\newskip\ttglue{\tt \global\ttglue=.5em plus.25em minus.15em}
\chardef\other=12
\def\ttverbatim{\begingroup \catcode`\\=\other \catcode`\{=\other
    \catcode`\}=\other \catcode`\$=\other \catcode`\&=\other
    \catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
    \catcode`\_=\other \catcode`\^=\other
    \obeyspaces \obeylines \tt}
{\obeyspaces\gdef {\ }}
\def\|{\char'73 }
\catcode`\|=\active
{\obeylines\gdef|{\ttverbatim\spaceskip=\ttglue\let^^M=\ \let|=\endgroup}}

\def\qual#1\par{\par
  \vskip 0pt plus.075\vsize \goodbreak
  \vskip 0pt plus-.075\vsize \bigskip
  \leftskip 0pt\qualparskip\qualcomtable{#1}%
  {\parskip=0pt\setbox0=\vbox{\tt #1\vss}\copy0\vskip -\ht0}
  \vskip -2\parskip   %  I don't know why the 2 seems correct!
  \leftskip\qualindent}

\def\parm#1\par{\bigbreak\par\leftskip 0pt\qualparskip
  \parmcomtable{#1}%
  {\setbox0=\hbox{\tt\parskip=0pt #1\enspace}
  \copy0\ifdim\wd0<\qualindent\vskip -\ht0\vskip -\parskip\fi}
  \vskip -\parskip\leftskip\qualindent}

\def\exam#1\par{\bigbreak\par\leftskip 0pt\qualparskip
  {\setbox0=\hbox{\parskip=0pt #1\enspace}
  \copy0\ifdim\wd0<\qualindent\vskip -\ht0\vskip -\parskip\fi}
  \vskip -\parskip\leftskip\qualindent}

\def\punkter{\leaders\hbox to .75em{\hss.\hss}\hfill}
\def\chapline#1#2#3{\smallskip\noindent#2\enspace#3\punkter#1}
\def\subline#1#2#3{\smallskip\noindent\qquad#2\enspace#3\punkter#1}
\def\subsubline#1#2#3{\smallskip\noindent
        \qquad\qquad#2\enspace#3\punkter#1}

\newwrite\contents
\immediate\openout\contents=\jobname.contents

\newwrite\comtable
\immediate\openout\comtable=\jobname.comtable

\def\chapcontents#1{\edef\next{\write\contents{\noexpand\chapline%
    {\noexpand\the\count0}{\the\chapcount.}{#1}}}\next}
\def\subcontents#1{\edef\next{\write\contents{\noexpand\subline%
    {\noexpand\the\count0}{\the\chapcount.\the\subcount}{#1}}}\next}
\def\subsubcontents#1{\edef\next{\write\contents{\noexpand\subsubline%
{\noexpand\the\count0}{\the\chapcount.\the\subcount.\the\subsubcount}{#1}}}
\next}

\def\progcomtable#1{\immediate\write\comtable{\noexpand\progline{#1}}}
\def\commcomtable#1{\immediate\write\comtable{\noexpand\commline{#1}}}
\def\parmcomtable#1{\immediate\write\comtable{\noexpand\parmline{#1}}}
\def\qualcomtable#1{\immediate\write\comtable{\noexpand\qualline{#1}}}

\long\def\bye{
   \vfil\supereject
   \immediate\closeout\comtable\docomtable
   \vfil\supereject
   \immediate\closeout\contents\docontents
   \vfil\supereject\end}

\def\docomtable{
    \def\progline##1{
      \vskip 0pt plus.5\vsize \goodbreak
      \vskip 0pt plus-.5\vsize \bigskip
      \mark{Summary of Command Formats -- Program ##1}%
      \advance \subcount by 1 \subsubcount=0
      \subcontents{Program ##1}%
      \leftskip 0pt Program ##1\par}
    \def\commline##1{\medskip\leftskip 30pt {\tt ##1}}
    \def\parmline##1{{\tt \enspace {##1}}\par}
    \def\qualline##1{\par\leftskip 50pt {\tt {##1}}\par}
  \chapter{Summary of Command Formats}\par
  \parskip=0pt\parindent=0pt\leftskip 0pt\vglue1cm
  \rm\input \jobname.comtable}

\def\docontents{\pageno=-1\rm\parskip=0pt\parindent=0pt\leftskip 0pt
    \centerline{\bf Table of Contents}
    \vglue1cm
    \input \jobname.contents}
