\def\filedate{1995/2/6}
\def\fileversion{v1.0}
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tw}
\RequirePackage{moreverb}
\RequirePackage{multicol}
\typeout{Package: `tw' \fileversion \space <\filedate>}
%
\newlength{\tw@width}
%
\newcommand{\twstartcode}{\begingroup\footnotesize}
\newcommand{\twendcode}{\endgroup}
\newcommand{\twmacrodecl}[2]{\par\parindent=0pt\parskip=0pt\label{#2}%
                            {\noindent\sffamily\bfseries Code Chunk: #1}%
                            \index{#1@\textit{#1}|textbf}}
\newcommand{\twmacrouse}[2]{{\rm @\(<\)#1\(>\)%
                            (Macro \ref{#2} on page \pageref{#2})}%
                            \index{#1@\textit{#1}}}
\newcommand{\tw@use}[1]{\index{#1}#1}%
\newcommand{\tw@decl}[1]{\index{#1|textbf}#1}%
\newcommand{\u@line}[1]{\settowidth{\tw@width}{#1}\parbox{\tw@width}%
                        {#1\hspace{-\tw@width}\rule[-2pt]{\tw@width}{.2pt}}}
\newenvironment{twuses}
{
   \parindent=0pt%
   \multicolsep=0pt%
   \let\twuse\tw@use%
   \begin{multicols}{2}[\u@line{\sffamily Uses:}]
   \raggedright
}
{\end{multicols}\smallskip}
%
\newenvironment{twdecls}
{
   \parindent=0pt%
   \multicolsep=0pt%
   \let\twdecl\tw@decl%
   \begin{multicols}{2}[\u@line{\sffamily Declares:}]
   \raggedright
}
{\end{multicols}\smallskip}
%
\newcommand{\tw@Description}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Description:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@SideEffects}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Side Effects:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@ReturnValues}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Return Vals:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@Inputs}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Inputs:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@Outputs}{\end{minipage}\par\smallskip
\parbox[t]{1in}{\hfill Outputs:\hspace*{1em}}\begin{minipage}[t]{3.5in}}
%
\newcommand{\tw@StartCode}{\end{minipage}\par}
\newcommand{\twiscode}{\expandafter\ifx\csname twnocode\endcsname\relax}%
\newcommand{\twisproc}{\expandafter\ifx\csname twnoproc\endcsname\relax}%
%
\twisproc
   \newenvironment{twproc}[1]
   {
      \par
      \parskip=0pt%
      \let\Description\tw@Description%
      \let\SideEffects\tw@SideEffects%
      \let\ReturnValues\tw@ReturnValues%
      \let\Inputs\tw@Inputs%
      \let\Outputs\tw@Outputs%
      \let\StartCode\tw@StartCode%
      \begin{minipage}{4.5in}\textbf{Procedure: #1}}
      {}
\else%
   \newenvironment{twproc}[1]
   {
      \@bsphack
      \let\do\@makeother\dospecials\catcode`\^^M\active
      \let\verbatim@startline\relax
      \let\verbatim@addtoline\@gobble
      \let\verbatim@processline\relax
      \let\verbatim@finish\relax
      \verbatim@
   }
   {\@esphack}
\fi
%
\twiscode
   \newenvironment{twcodechunk}{}{}
\else%
   \newenvironment{twcodechunk}
   {
      \@bsphack
      \let\do\@makeother\dospecials\catcode`\^^M\active
      \let\verbatim@startline\relax
      \let\verbatim@addtoline\@gobble
      \let\verbatim@processline\relax
      \let\verbatim@finish\relax
      \verbatim@
   }
   {\@esphack}
\fi
%
\newcommand{\twparmlist@label}[1]{\mbox{\texttt{#1} - }\hfil}
\newenvironment{twparmlist}
{%
   \begin{list}{}%
         {\setlength{\itemsep}{0pt}%
          \setlength{\parsep}{0pt}%
          \renewcommand{\makelabel}{\twparmlist@label}}%
}%
{\end{list}}

.
