%
% $Id: pseudocode.sty,v 1.4 1998/08/11 20:31:34 ejb Exp $
% $Source: /home/ejb/tex/macros/RCS/pseudocode.sty,v $
% $Author: ejb $
%
% LaTeX pseudocode environment
%
% Within the environment, use \pline to start a line or
% \plab{label} to start a line that you wish to refer to later.
% Use \pscref{label} to refer to it.  Use \> to separate
% indentation levels.  Use \kwd{keyword} for keywords.	Use \cmt
% for a comment character.  Example:
%
% \begin{pseudocode}
% \pline 	 \> \kwd{for} $i \leftarrow 1$ \kwd{to} $n$ \\
%                \> \cmt Print the value of $i$ \\
% \plab{f:print} \> \> \kwd{print} $i$ \\
% \pline         \> \kwd{end} \kwd{for} \\
% \end{pseudocode}
% The print statement occured in line \pscref{f:print}.
%

\newcommand{\kwd}[1]{\textbf{#1}}
\newcommand{\cmt}{\mbox{$\triangleright$~}}

\newcounter{pseudoline}
\newcommand{\pline}{\arabic{pseudoline} \stepcounter{pseudoline}}

\newcommand{\plab}[1]{
\arabic{pseudoline}
\newcounter{#1}
\setcounter{#1}{\value{pseudoline}}
\stepcounter{pseudoline}
}

\newcommand{\pscref}[1]{\arabic{#1}}

\newenvironment{pseudocode}{
\setcounter{pseudoline}{1}
\begin{tabbing} 
000 \= aaa \= aaa \= aaa \= aaa \= aaa \= aaa \= aaa \= aaa \= aaa \= aaa \= \kill
}{\end{tabbing}}
