\newcommand{\xsubsection}[1]{%
\texonly{\subsection{#1}}%
\htmlonly{\strong{#1}\\}%
}

\newcommand{\evalsto}{%
\texonly{$\rightarrow$}%
\htmlonly{\code{->}}%
}

\newcommand{\cvar}[1]{%
\texonly{{\rm\em{#1}}}%
\htmlonly{\code{\var{#1}}}%
}

%%%%%%%%%%%%%%%% Latex prototypes
\texonly{
\newenvironment{protos}{\list{$\bullet$}
{\leftmargin1.2em\rightmargin0pt\itemsep0pt\parsep0pt\partopsep-2pt}}
{\endlist}

% The following is for prototypes that have return types.
%    (foo int int) -> int

\newcommand{\proto}[3]{%
\protonoindex{{#1}}{{#2}}{{#3}}%
\mainschindex{{#1}}}%

\newcommand{\protonoindex}[3]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{({#1}{\it#2\/})} {$\rightarrow$} {\it#3}}}

\newcommand{\cproto}[1]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{{#1}}}}

\newcommand{\cgcproto}[1]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{{#1}}}\hfill\penalty 0%
\hbox{ }\nobreak\hfill\hbox{\rm (may GC)}}

\newcommand{\protonoresultnoindex}[2]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{(\hbox{#1}{\it#2\/})}}}

\newcommand{\protonoresult}[2]{%
\protonoresultnoindex{{#1}}{{#2}}%
\mainschindex{{#1}}}%

\newcommand{\protoresult}[1]{\newline\unskip%
{\hspace*{2em}\code{{$\rightarrow$} {\it#1}}\hfill}}

% Syntax prototypes

\newcommand{\syntaxprotonoresultnoindex}[2]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{(\hbox{#1}{#2})}}\hfill\penalty 0%
\hbox{ }\nobreak\hfill\hbox{\rm syntax}}

\newcommand{\syntaxprotonoresult}[2]{%
\syntaxprotonoresultnoindex{{#1}}{{#2}}\mainschindex{{#1}}}

\newcommand{\syntaxproto}[3]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{(\hbox{#1}{#2})}} {$\rightarrow$} {\it#3}%
\hfill\penalty 0%
\hbox{ }\nobreak\hfill\hbox{\rm syntax}}

% This can be reduced

\newcommand{\pconstproto}[2]{\item\noindent\unskip%
\hbox{\spaceskip=0.5em\code{#1}}\hfill\penalty 0%
\hbox{ }\nobreak\hfill\hbox{\rm #2}}

% Variable prototype
\newcommand{\constproto}[2]{\pconstproto{{#1}}{{#2}}\mainschindex{{#1}}}

\newcommand{\constprotonoindex}[2]{\pconstproto{{#1}}{{#2}}}

}
%%%%%%%%%%%%%%%% end of Latex proto definitions

%%%%%%%%%%%%%%%% HTML prototypes
\htmlonly{
\newenvironment{protos}{\begin{itemize}}{\end{itemize}}

% The following is for prototypes that have return types.
%    (foo int int) -> int

\newcommand{\protonoindex}[3]{%
%\cindex{\code{#1}}%
\item\noindent\code{({#1}{\var{#2}\/})~-->~{\var{#3}}}}

\newcommand{\proto}[3]{%
\protonoindex{{#1}}{{#2}}{{#3}}%
\mainschindex{{#1}}}%

\newcommand{\protonoresultnoindex}[2]{%
%\cindex{\code{#1}}%
\item\noindent\code{({#1}{\var{#2}\/})}}

\newcommand{\protonoresult}[2]{%
\protonoresultnoindex{{#1}}{{#2}}%
\mainschindex{{#1}}}%

\newcommand{\pconstproto}[2]{%
\item\noindent\prototagstart\code{{#1}}\prototag{{#2}}}

% Variable prototype
\newcommand{\constproto}[2]{\pconstproto{{#1}}{{#2}}\mainschindex{{#1}}}

\newcommand{\constprotonoindex}[2]{\pconstproto{{#1}}{{#2}}}

\newcommand{\cproto}[1]{%
\item\noindent\code{{#1}}}

\newcommand{\cgcproto}[1]{%
\item\noindent\prototagstart\code{{#1}}\prototag{(may GC)}}

\newcommand{\syntaxprotonoresult}[2]{%
\syntaxprotonoresultnoindex{{#1}}{{#2}}\mainschindex{{#1}}}

\newcommand{\syntaxprotonoresultnoindex}[2]{%
\item\noindent\prototagstart\code{({#1}{#2})}\prototag{syntax}}

\newcommand{\protoresult}[1]{%
\\{}\noindent\code{\ \ \ \ -->~{\it{#1}}}}

\newcommand{\syntaxproto}[3]{%
\item\noindent\prototagstart\code{({#1}{#2})~-->~{\var{#3}}}\prototag{syntax}}

\newcommand{\prototagstart}{%
\begin{rawhtml}<table border=0 cellspacing=0 cellpadding=0 width=80%>
<tr> <td>\end{rawhtml}}

\newcommand{\prototag}[1]{%
\begin{rawhtml}</td> <td align=right>\end{rawhtml}%
{#1}%
\begin{rawhtml}</td></tr></table>\end{rawhtml}}

}
%%%%%%%%%%%%%%%% end of HTML proto definitions
