%   latex macros for non-ANSI and ANSI C functions
%   ( edited from CGU Pascal procdefs.tex )

\newcommand{\pardesc}[1]{{\tt #1}}

% slightly modified underscore macro from miw
% original width was .3em
\def\myunderscore{\leavevmode\kern.06em\vbox{\hrule
     height.15ex width.6em}\hskip0.1em}
\let\_=\myunderscore

% ANSI C macros
%
\newcommand{\typedef}[1]{%
\begin{tabbing}
01234567890123456780123\=0123\=01234567890123456789\=01234567890123456789\=0123456789012345\=0123456789012345\= \kill
#1;
\end{tabbing}}

\newcommand{\constdef}[1]{%
\begin{tabbing}
01234567890123456780123\=0123\=01234567890123456789\=01234567890123456789\=0123456789012345\=0123456789012345\= \kill
#1;
\end{tabbing}}

\newcommand{\vardef}[1]{%
\begin{tabbing}
01234567890123456780123\=0123\=01234567890123456789\=01234567890123456789\=0123456789012345\=0123456789012345\= \kill
#1;
\end{tabbing}}
%
% macros for ANSI C function declarations
%
%    \func{type}{names}      % starts a function
%    \param{type}{name}      % sets a parameter
%    \fend                   % ends a function
%
%    \boxingon               % causes subsequent procedures to be preceded
%                            % with their name in a box, flushed right
%    \boxingoff              % switches boxing off (the default)
%
%
\newcount\pno			   % parameter number
\newif\ifboxprocs\boxprocsfalse
\def\boxingon{\boxprocstrue}       % sets boxing ON
\def\boxingoff{\boxprocsfalse}     % sets boxing OFF
\def\procbox#1{\ifboxprocs\begin{flushright}\fbox{\bf\Large #1}\end{flushright}
               \fi}

\newcommand{\func}[2]{%
\ifnum\pno>0\errmessage{Ouch! You forgot a \string\pend, so I'll do one for you.}\pend\fi%
 	    \smallskip\procbox{#2}\begin{tabbing}#1\  {\bf #2}\ignorespaces}
%
\def\param#1#2{\ifnum\pno=0\thinspace(\thinspace\=\else\thinspace,\\\>\fi#1\  \ #2\advance\pno by 
1\ignorespaces}

%
% end a function
%
\newcommand{\fend}{\ifnum\pno>0 \thinspace)\fi\thinspace\end{tabbing}\pno=0}
%
%
