% $Id: rcs-doc.sty,v 1.4 1995/08/02 12:09:06 schrod Exp $
%----------------------------------------------------------------------

%
% tags for the documentation of rcs style option
%


\ProvidesPackage{rcs-doc}


%
% Configuration of RCS fields
%

% keywords in style are prefixed by `Style', in documentation by `Doc'.
\let\RcsHandleStyleDate=\RcsHandleDate	% transform StyleDate value
\let\RcsHandleDocDate=\RcsHandleDate	% transform DocDate field

% the revision of rcs.sty is needed by the documentation
\expandafter\RCS \rcs@loaded		% creates \RCSStyleRevision

% name of the author
%
% CAVEAT: Don't define another author name without changing the text
% in the user manual where \rcsAuthor is explained!
\rcsAuthor{schrod}{Joachim Schrod}


%
% new tags
%

\def\rcsField#1{\textsf{#1}}		% name of a RCS field (ie, RCS keyword)
\def\Log{\rcsField{Log}}		% The `Log' keyword, needed often
\def\Date{\rcsField{Date}}		% The `Date' keyword, needed often


%
% \macroCall[p]{\\split \[Revision\(: \)1.1\( \]:\) \{\} \\end_value}
%
% \[...\] is param of caller, \(...\) is arg (delimiter) for \split
%	empty arg delimiter must be input as `\(\|\)'
%	may not be nested, as shown above
% in \macroCall arg: `_' and ` ' are other characters
%		     \\, \{, and \} produce characters `\', `{' and `}'
%		     \| is invisible text
% The optional arg is the character to mark the delimiter. By using
% [p] one can mark args with `\(...\)'!

\newtoks\@macroCall

\def\macroCall{%
    \@ifnextchar[%			% ] (Emacs)
	\macro@call
	{\macro@call[d]}%
    }
\def\macro@call[#1]{%
    \def\delimChar{#1}%
    \begingroup
	\catcode`\ =\CatOther
	\catcode`\_=\CatOther
	\afterassignment\showExample
	\global\@macroCall
    }

\newcount\delimCount
\def\showExample{%
    \endgroup
    \leavevmode
    \vtop{%
	\reset@font \ttfamily
	\let\[\relax	\let\]\relax
	\let\(\relax	\let\)\relax
	\chardef\\=`\\	\chardef\{=`\{	\chardef\}=`\}
	\def\|{\hskip 1sp}%		% must be >0pt, but invisible
	\baselineskip\z@skip
	\lineskip 2pt
	\delimCount\z@
	\hbox{\expandafter\showParam \the\@macroCall \endValue}%
	\hbox{\the\@macroCall}%		% the example itself
	\hbox{\expandafter\showDelimiter \the\@macroCall \(\)\endValue}%
	\hrule height \z@
	}%
    }


\def\showParam #1\[#2\]#3\endValue{%
    \hphantom{#1}%
    \setbox\z@ \hbox{#2}%
    \vbox{\hsize \wd\z@
	\centerline{\tt \#1}%
	\vskip 3pt
	\hrule
	\@@line{\hss \vrule height 3pt \hskip\hsize \vrule \hss}%
	}%
    \setbox\z@ \hbox{#3}%
    \vbox{\hsize \wd\z@
	\centerline{$s$}%
	\vskip 3pt
	\@@line{\cleaders \hbox{$\mkern 1mu.\mkern 1mu$}\hfill}\nointerlineskip
	\@@line{\hskip\hsize \vrule height 3pt \hss}%
	}%
    }

\def\showDelimiter #1\(#2\)#3\endValue{%
    \hphantom{#1}%
    \advance\delimCount \@ne
    \setbox\z@ \hbox{#2}%
    \ifdim \wd\z@=\z@
    \else
	\vtop{\hsize\wd\z@
	    \@@line{\hss \vrule depth 3pt \hskip\hsize \vrule \hss}%
	    \hrule
	    \vskip 3pt
	    \centerline{$\delimChar_{\the\delimCount}$}%
	    }%
	\showDelimiter #3\endValue
    \fi
    }



\endinput



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Local Variables:
mode: plain-TeX
TeX-master: t
TeX-brace-indent-level: 4
indent-tabs-mode: t
TeX-auto-untabify: nil
End:
