% =====================================================================
% Macros for typesetting hol reference manual entries
% =====================================================================

% ---------------------------------------------------------------------
% boolean flag for verbose printing of reference manual typesetting
% ---------------------------------------------------------------------

\newif\ifverboseref
\verbosereffalse			  % don't be verbose

% ---------------------------------------------------------------------
% \DOC{<object>}  : start a manual entry for <object> (to be used when
%	            <object> is an UPPER-CASE ML identifier.
% ---------------------------------------------------------------------
\newcommand{\DOC}[1]%
{\bigskip
 {\ifverboseref{\def\_{\string_}\typeout{Typesetting: #1}}\fi}
 \markright{{\protect\small\bf #1}}
 \autoindex{#1@{\tt #1}}
 \begin{flushleft}
 \begin{tabular}{|c|}\hline
 \begin{minipage}{\minipagewidth}
 \bigskip
 {\LARGE\tt #1}
 \bigskip
 \end{minipage}\\ \hline
 \end{tabular}
 \end{flushleft}
 \bigskip
}

% ---------------------------------------------------------------------
% \LDOC{<object>}  : start a manual entry for <object> (to be used when
%		     <object> is a lower-case ML identifier.
% ---------------------------------------------------------------------

\newcommand{\LDOC}[1]%
{\bigskip
 {\ifverboseref{\def\_{\string_}\typeout{Typesetting: #1}}\fi}
 \markright{\bf #1}
 \autoindex{#1@{\tt #1}}
 \begin{flushleft}
 \begin{tabular}{|c|}\hline
 \begin{minipage}{\minipagewidth}
 \bigskip
 {\LARGE\tt #1}
 \bigskip
 \end{minipage}\\ \hline
 \end{tabular}
 \end{flushleft}
 \bigskip
}

% ---------------------------------------------------------------------
% Commands for parts of a \DOC:
%    \SYNOPSIS 
%    \DESCRIBE
%    \FAILURE
%    \EXAMPLE
%    \USES
%    \SEEALSO
% ---------------------------------------------------------------------

\newcommand{\SYNOPSIS}%
{\bigskip{\noindent\large\bf Synopsis}\newline\mbox{}}

\newcommand{\CATEGORIES}%
{\bigskip{\noindent\large\bf Categories}\newline\mbox{}}

\newcommand{\DESCRIBE}%
{\bigskip{\noindent\large\bf Description}\newline\mbox{}}

\newcommand{\FAILURE}%
{\bigskip{\noindent\large\bf Failure}\newline\mbox{}}

\newcommand{\EXAMPLE}%
{\bigskip{\noindent\large\bf Example}\newline\mbox{}}

\newcommand{\USES}%
{\bigskip{\noindent\large\bf Uses}\newline\mbox{}}

\newcommand{\SEEALSO}%
{\bigskip{\noindent\large\bf See also}}

% ---------------------------------------------------------------------
% \ENDDOC = do nothing
% ---------------------------------------------------------------------

\newcommand{\ENDDOC}{}

\makeatletter

\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12              
\catcode`\\=12 |gdef|@xboxverb#1\ENDTHEOREM[#1|ENDTHEOREM]
|endgroup                                                 

\def\@boxverb{\bgroup\leftskip=5mm\parindent\z@
\parfillskip=\@flushglue\parskip\z@
\obeylines\tt \catcode``=13 \@noligs \let\do\@makeother \dospecials}

\def\boxverb{\@boxverb \frenchspacing\@vobeyspaces \@xboxverb}

\def\ENDTHEOREM{\egroup\filbreak}

\def\THEOREM #1 #2 {
 \autoindex{#1@{\tt #1}}
   \vspace{4mm plus2mm minus1mm}
   \noindent {\tt #1}\quad ({\tt #2}) \par \boxverb 
}

\makeatother

\def\none{{\it none}}

