%
% Keep the file from being loaded more than once ...
%
\ifx\manName\undefined\else\manItemReset\endinput\fi
%
\catcode`\@=11\relax
\input options.tex
%
% \load@ttslFont sets up a slanted typewriter font used in the title heading.
% if we dont have slanted typewriter, use regular typewriter instead.
%
\if@hasSltt
   \def\load@ttslFont{\font\ttsl=cmsltt10 scaled 1200}%
\else
   \message{Substituting font cmtt10 for cmsltt10}%
   \def\load@ttslFont{\font\ttsl=cmtt10 scaled 1200}%
\fi
%
% \load@stdFonts loads the standard math fonts
%
\def\load@stdFonts{
   \font\sixmi=cmmi6
      \skewchar\sixmi='177
   \font\sixsy=cmsy6
      \skewchar\sixsy='60
   \font\egtmi=cmmi8
      \skewchar\egtmi='177
   \font\egtsy=cmsy8
      \skewchar\egtsy='60
   \font\ninmi=cmmi9
      \skewchar\ninmi='177
   \font\ninsy=cmsy9
      \skewchar\ninsy='60
   \font\tenmi=cmmi10
      \skewchar\tenmi='177
   \font\tensy=cmsy10
      \skewchar\tensy='60
   \font\twlmi=cmmi10 at 12pt
      \skewchar\twlmi='177
   \font\twlsy=cmsy10 at 12pt
      \skewchar\twlsy='60
   \font\tenex=cmex10
}
%
% \load@mainFonts{RM}{BF}{IT}{SL}{TT}
%    loads the 9, 10, and 12 point fonts for \rm, \bf, \it, \sl, and \tt,
%    using the 5 10-point parent fonts specified in the argument list.
%
\def\load@mainFonts#1#2#3#4#5{%
   % nine point ...
   \font\ninrm=#1 scaled 900%
   \font\ninbf=#2 scaled 900%
   \font\ninit=#3 scaled 900%
   \font\ninsl=#4 scaled 900%
   \font\nintt=#5 scaled 900%
   % ten point ...
   \font\tenrm=#1 scaled 1000%
   \font\tenbf=#2 scaled 1000%
   \font\tenit=#3 scaled 1000%
   \font\tensl=#4 scaled 1000%
   \font\tentt=#5 scaled 1000%
    % twelve point ...
   \font\twlrm=#1 scaled 1200%
   \font\twlbf=#2 scaled 1200%
   \font\twlit=#3 scaled 1200%
   \font\twlsl=#4 scaled 1200%
   \font\twltt=#5 scaled 1200%
}
%
% \load@cmrFonts loads the fonts used for the \cmr font style
%
\def\load@cmrFonts{%
   \load@mainFonts{cmr10}{cmbx10}{cmti10}{cmsl10}{cmtt10}%
   % specials ...
   \font\sf=cmss10 scaled 1200%
   \font\sfbf=cmssbx10 scaled 1200%
   \font\sfsl=cmssi10 scaled 1200%
   \load@ttslFont
}
%
% \load@cmssFonts loads the sans-serif fonts used for the \cmss font style
%
\def\load@cmssFonts{%
   \if@hasSltt
      \load@mainFonts{cmss10}{cmssbx10}{cmssi10}{cmssi10}{cmsltt10}%
   \else
      \load@mainFonts{cmss10}{cmssbx10}{cmssi10}{cmssi10}{cmtt10}%
   \fi
   % specials ...
   \font\sf=cmss10 scaled 1200%
   \font\sfbf=cmssbx10 scaled 1200%
   \font\sfsl=cmssi10 scaled 1200%
   \load@ttslFont
}
%
% \loadTimesFonts loads the fonts used for the \times font style
%
\def\loadTimesFonts{%
   \if@hasPsFonts
      \load@mainFonts{ptmr}{ptmb}{ptmri}{ptmro}{cmtt10}%
      % specials ...
      \font\sf=helv scaled 1200%
      \font\sfbf=helvb scaled 1200%
      \font\sfsl=helvi scaled 1200%
      \load@ttslFont
   \else
      \message{No PostScript fonts: "times" replaced with "cmr"}%
      \load@cmrFonts
   \fi
}
%
% \setFamily sets the fonts for a particular font family; font families
%    are used in math mode. 
%
\def\setFamily#1#2#3#4{%
   \textfont#1=#2 \scriptfont#1=#3 \scriptscriptfont#1=#4%
}
%
% \setFonts is a support routine for making the necessary font bindings
%
\def\setFonts{
%  Uncomment to suppress hyphenation of \tt. Warning: this will cause
%  a bunch of overfull boxes.
%  \hyphenchar\nintt=-1%
%  \hyphenchar\tentt=-1%
%  \hyphenchar\twltt=-1%
%  \hyphenchar\ttsl=-1%
   \def\rm{\fam0\twlrm}
   \setFamily0\twlrm\ninrm\ninrm
   \setFamily1\twlmi\egtmi\sixmi
   \setFamily2\twlsy\egtsy\sixsy
   \setFamily3\tenex\tenex\tenex
   \def\bf{\fam\bffam\twlbf}%
   \setFamily\bffam\twlbf\ninbf\ninbf
   \def\it{\fam\itfam\twlit}%
   \setFamily\itfam\twlit\ninit\ninit
   \def\sl{\fam\slfam\twlsl}%
   \setFamily\slfam\twlsl\ninsl\ninsl
   \def\tt{\fam\ttfam\twltt}%
   \setFamily\ttfam\twltt\nintt\nintt
   \input Cmode.tex % redefine C-mode because \tt may have changed
   \rm
}
%
% Notes on assigning variables:
%    \newtoks\varname
%    within a macro def, \varname={#1}
%    \the\varname invokes the stuff
%
\newdimen\margin
\newdimen\textIndent
\newdimen\textHalfIndent
\margin=.75truein
\textIndent=.5truein
\textHalfIndent=.25truein
\newbox\argbox
\newdimen\argwidth
\newdimen\argwidthbase
\argwidthbase=1ex
\argwidth=\argwidthbase\multiply\argwidth by 14
%
% pageFootCentre and pageFootLeft aren't really used any more.
%
\newtoks\pageFootCentre
\newtoks\pageFootLeft
\newtoks\pageHeadLeft
\newtoks\pageHeadRight
\newif\ifindexOpen
%
% Read in the relase number from releaseNum.tex
%
{\newread\rnumfile
\openin\rnumfile = releaseNum.tex%
\catcode`\^^M=9\global\read\rnumfile to \releaseNum
\closein\rnumfile
}
%
% The macro \today is taken from the TeX book; it gives the current date
%
\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
}
\let\manIfTeX=\iftrue
\let\manIfNroff=\iffalse
\let\manElse=\else
\let\manFi=\fi

\def\\{\char`\\}
\def\manOpenIndex{%
   \openout 1=\jobname.idx%
   \indexOpentrue
}
\def\manInset#1{%
   \begingroup
      \par
      \advance\leftskip by .5truein%
      \advance\rightskip by .5truein%
      \relax #1% 
      \par
   \endgroup
}
\def\manInput#1{%
   {\let\end=\relax \input #1 }%
}
\def\TT{\tt}
\def\filefont{\tt}
\def\manName#1{{#1}%
   \ifindexOpen
   \write 1{\noexpand\item{\noexpand\tt #1}, {\number\pageno}}%
   \fi
}
%
% \manFont is no longer used
%
\def\manFont#1{}
%
% \manFontStyle{STYLE} allows the user to specify a font style. At
%    the moment, STYLE must be one of "cmr", "cmss", or "times". 
%
\newtoks\mfstoks
\def\loadfntscmr{%
   \load@stdFonts
   \load@cmrFonts
   \setFonts
}
\def\loadfntscmss{%
   \load@stdFonts
   \load@cmssFonts
   \setFonts
}
\def\loadfntstimes{%
   \load@stdFonts
   \loadTimesFonts
   \setFonts
}
\def\manFontStyle#1{%
   \mfstoks=\expandafter{\csname loadfnts#1\endcsname}%
   \expandafter\ifx\the\mfstoks\undefined
      \message{Warning: \noexpand\manFonstStyle{#1} unrecognized - ignored}%
   \else
      \the\mfstoks
   \fi
}
\def\manTitle#1#2{%
   \pageHeadRight={{#1}({#2})}%
}
\def\manPageInfo#1#2#3{%
   \pageHeadLeft={#1}%
   \pageFootLeft={#2}%		% pageFootLeft and pageFootCenter
   \pageFootCentre={#3}%	% are not currently used.
}
\catcode`\_=\active
\def\manBegin{\begingroup
   \par\vfill\supereject
%  \advance\voffset by .5truein
%  \advance\hoffset by .4truein
   \parindent=0pt%
   \advance\leftskip by \margin
   \parskip=5ptplus1pt
   \def\makeheadline{%
      \vbox to 0pt{\vskip -30pt% std version: -22.5pt
      \line{\vbox to 8.5pt{}\the\headline}% same as std
      \vskip 2pt% to put a little space before the line
      \nointerlineskip
      \hbox to \hsize{% the line between the headline and the page
			\hskip\margin\hskip-\textIndent% line it up
			\leaders\hrule height .4pt depth 0pt\hfill% the line
		      }%
      \vss}\nointerlineskip% same as std
   }
   \headline={%
      \hskip\margin\hskip-\textIndent
      {\sfsl \the\pageHeadLeft}%
      \hfil
      {\ttsl \the\pageHeadRight}%
      }
   \footline={%
      \hskip\margin\hskip-\textIndent
      {\sfsl \releaseNum, \today}%
      \hfil
      {\the\pageno}%
      }
   \catcode`\_=\active
   \def_{\ifmmode\sb\else{\char95}\fi}
   \def\~{\char`\~}%
}
\catcode`\_=8
\def\manEnd{%
   \par\vfill\supereject\endgroup
}
\def\manSection#1{%
   \bigskip\par\noindent\hskip -\textIndent{\sfbf#1}\par
}
\def\manSubSection#1{%
   \bigskip\par\noindent
   \hskip -\textHalfIndent{\sfbf#1}\par
}
\def\manItemIndent#1{%
   \argwidth=\argwidthbase\multiply\argwidth by #1\relax
}
\def\manItemReset{%
   \argwidth=\argwidthbase\multiply\argwidth by 14\relax
}
\def\manItem#1{%
   \par\noindent
%  \smallskip
   \setbox\argbox=\hbox{{#1}\quad}%
   \hangindent=\argwidth \hangafter=1
   \noindent
   \ifdim\wd\argbox > \argwidth
% uncomment the \hfil\break to drop down a line on overwide #1
      \box\argbox \hfil\break
   \else
      \hbox to \argwidth{\box\argbox\hfill}%
   \fi
   \ignorespaces
}
\def\lineBreak{\hfil\break}
%
% Set the default font style to cmr
%
\manFontStyle{cmr}% Default font setting is cmr.
%
\catcode`\@=12\relax
%
