%\iffalse
%<*header>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `rcsinfo' package to use with LaTeX2e.
%%
%% This package is used to extract the revision and file information provided
%% by the RCS revision control system.
%% A PERL-package supporting rcsinfo and LaTeX2HTML is provieded too.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%%                    Viktoriastrasse 15, D-76133 Karlsruhe, Germany
%%                    Juergen.Vollmer@acm.org
%% License:
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%%
%% If you find this software useful, please send me a postcard.
%%
%% $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%\iffalse
% to test the checksum, uncomment    \OnlyDescription
% in the driver
%\fi
%
%% \CheckSum{397}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%</header>
%\fi

% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\if,\else,\fi,\emph,\footnotesize,\footrulewidth,\let}
% \DoNotIndex{\newcount,\newif,\number,\or,\parindent,\plainfootrulewidth}
% \DoNotIndex{\PrintChanges,\PrintIndex,\relax,\setlength,\space}
% \DoNotIndex{\the,\textwidth,\thepage,\newcommand,\texttt,\verb,\vfill}
% \DoNotIndex{\input,\newpage,\setcounter,\newcounter,\\,\ ,\typeout,\today}
%
% \MakeShortVerb{\|}
% \newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
% \newcommand{\Cmd}[1]{\texttt{$\backslash$#1}}
% \newcommand{\RCS}{\emph{RCS}}
% \newcommand{\blank}{{\tiny$_\sqcup$}}
% \newcommand{\Id}{\texttt{\$Id\$}}
% \newcommand{\RcsInfoCmd}[1]{\texttt{$\backslash$rcsInfo\blank\$Id#1\$}}
% \changes{v1.1}{1995/08/29}{~\\Initial version}
% \changes{v1.2}{1995/08/30}{~\\Changed: README and Make\-file}
% \changes{v1.3}{1997/07/07}{~\\New implementation.\\
%                            Support for \LatexToHtml:\\\texttt{rcsinfo.perl}.}
% \changes{v1.4}{1998/08/13}{~\\Support for \texttt{facnyhdr} package.\\
%                            Added \texttt{rcsinfo.cfg}.}
% \changes{v1.5}{1999/01/22}{~\\Removed autoload of the
%			     \texttt{babel}-package. \\
%                            Fixed the \texttt{notoday} option.}
% \changes{v1.6}{1999/02/05}{~\\Fixed problems with changing the catcode of
%                            \texttt{:} (colon), e.g.\ the \texttt{babel}
%                            package with the \texttt{french} option does
%                            this.}
% \changes{v1.7}{1999/12/17}{~\\Underscores in file names are now handeled
%                            correctly.}
%
% \changes{v1.7.1}{2000/06/23}{~\\If latex2html is not installed,
%                             \texttt{make} does not abort.}
% \changes{v1.8}{2000/07/31}{~\\rcsinfo.perl can deal now with latex2html
%                            version 99.1.\\
%                            Restructured package files.
%                            }
% \changes{v1.9}{2002/04/19}{the initial \$ of \$Id may be omitted.}
%
% \title{The \texttt{rcsinfo} package}
% \author{Dr.~J{\"u}rgen Vollmer\\
%         Viktoriastra{\ss}e 15\\
%         D-76133 Karlsruhe, Germany\\
%         {\footnotesize email: Juergen.Vollmer@acm.org}}
% \date{April 19, 2002\\Version 1.9}
%
% \maketitle
%
% \begin{abstract}
% \noindent
% This package is used to extract the revision and file information provided
% by the \RCS\ revision control system. Support for the \LatexToHtml\
% conversion tool is provided\footnote{\LatexToHtml\ is a conversion tool
% that allows documents written in \LaTeX\  to become part of the
% World Wide Web. It's written by
% \emph{Nikos Drakos, Computer Based Learning Unit, University of Leeds.}}
% \end{abstract}
%
%\section{Introduction}
%
% To maintain different versions of a document or to keep track on the
% development of one,
% the document is kept under a revison control system like \emph{SCCS} or \RCS.
% This package assumes you are using the \RCS\ system.
% To present the version information of a document, one needs to extract it
% from some kind of text inserted by the revision control system.
% \RCS\ offers therefore the \Id\ keyword, which is expanded by the \RCS\
% \emph{check out (co)} command and contains a
% lot of useful information. This information is made available through
% this package.
%
% The information obtained from the expanded \Id\ string are
% \begin{itemize}
% \item the filename,
% \item the date and time of the last \RCS\ \emph{co} command,
% \item the revision number,
% \item name of the user who has done this action,
% \item the status, and
% \item if the file is locked, the name of the locker.
% \end{itemize}
% For each of these items a macro is defined.
% When \emph{checking out} a file, the \RCS\ keywords should be contained in
% the \emph{checked out} source.
% If the user wishes, the |\today| macro is redefined, so that it returns
% the \RCS\ date.
%
% Many thanks to Thomas M{\"u}ller, aka Howie, who made the first \TeX\ hack
% for cracking the \Id\ string\footnote{Thanks to Colin Marquardt
% |<941etcm@gwfs.stud.fh-jena.de>| testing the support of the |fancyhdr|
% option.}.
%
% If you want to read about the implementation, put a \% before
% |\Only|\-|Description| in the code marked with |<*driver>| in the file
% |rcsinfo.dtx|.
%
%\section{User Interface}
%
%\subsection{Options}
%
% Options for this package are:
%
% \begin{description}
% \item[today]
%      Set the date of |\today| to the date obtained by the \RCS\ information.
%      If the \Id\ string is not expanded (see below), the current date is
%      used.
% \item[notoday]
%      Don't use the \RCS\ date for |\today|.
% \item[fancy]
%      We use the \texttt{fancyheadings} package to fill the footline with
%      \RCS\ information: filename, revision-number, status and date.
%
%      If the \texttt{fancyheadings} package is not already loaded, it
%      will be loaded
%      by this package. To use the footnotes, put something like:\\
%      \hspace*{1em}|\pagestyle{fancyplain}|\\
%      \hspace*{1em}|\lhead[\fancyplain{}{\leftmark}]{\fancyplain{}{\thepage}}|\\
%      \hspace*{1em}|\rhead[\fancyplain{}{\thepage}]{\fancyplain{}{\rightmark}}|\\
%      in the preamble.
% \item[fancyhdr]
%      We use the \texttt{fancyhdr} package to fill the footline with
%      \RCS\ information: filename, revision-number, status and date.
%
%      If the \texttt{fancyhdr} package is not already loaded, it will be
%      loaded
%      by this package. To use the footnotes, put something like:\\
%      \hspace*{1em}|\pagestyle{fancyplain}|\\
%      \hspace*{1em}|\fancyhead[RE,LO]{\leftmark}|\\
%      \hspace*{1em}|\fancyhead[LE,RO]{\thepage}|\\
%      in the preamble.
% \item[nofancy]
%      We don't define the footline. The \texttt{fancyheadings} /
%      \texttt{fancyhdr} package is not loaded.
% \item[long]
%      If used together with \texttt{fancy} / \texttt{fancyhdr} the date
%      string is printed in the long format
%      as |\today| returns it. If \texttt{fancy} / \texttt{fancyhdr}
%      is not used, nothing.
% \item[short]
%      If used together with \texttt{fancy} / \texttt{fancyhdr} the date
%      string is printed in the short
%      format \emph{YYYY/MM/DD}.
%      If \texttt{fancy} / \texttt{fancyhdr} is not used, nothing.
% \end{description}
% If the \texttt{babel} package is used, the |\today| string is language
% dependent.
%
% The default options are: \emph{today,long}. In the configuration file
% |rcsinfo.cfg| one of fancy heading packages may be set as a default
% option too.
%
%\subsection{Commands}
%
% \subsubsection{Defining the \RCS\ information}
%
% There is only one macro to define the information:
% |\rcsInfo|\DescribeMacro{\rcsInfo}.
% Since it must collaborate with \RCS\ it has an ``unusual'' calling sequence:
% The arguments are surrouned by \$.
% The following arguments are valid:\\
% \hspace*{0.5em} \RcsInfoCmd{}\\
% \hspace*{0.5em} \RcsInfoCmd{:}\\
% \hspace*{0.5em} \RcsInfoCmd{:\blank\emph{file}\texttt{,v}\blank\emph{rev}\blank\emph{YYYY/MM/DD}\blank\emph{hh:mm:ss}\blank\emph{owner}\blank\emph{stat}\blank\emph{lock}\blank}\\
% \hspace*{0.5em} \RcsInfoCmd{:\blank\emph{file}\texttt{,v}\blank\emph{rev}\blank\emph{YYYY/MM/DD}\blank\emph{hh:mm:ss}\blank\emph{owner}\blank\emph{stat}\blank}
%
% In the first two forms, \RCS\ has not expanded the \Id\ string.
% This form will usually be used before the file is \emph{checked in}
% the first time.
%
% \emph{YYYY/MM/DD} is a date, \emph{hh:mm:ss} a time.
% Note: when you perform the \RCS\ \emph{check out} command, the \Id\ string
% is expanded by \RCS\ automatically.
%
% To take effect, |\rcsInfo| must follow the |\begin{document}|.
% If you are using multiple files for a document, you could place
% |\rcsInfo| at the
% beginning of each file, so the information from the current file is
% obtained (this is not valid, when translating with \LatexToHtml, see below).
%
% \subsubsection{Accessing the \RCS\ information}
% There are the following macros to access the information provided by \RCS.
% If \RCS\ has not expanded the \Id\ string, or no |\rcsInfo| command is given,
% default values are returned.
%
% \begin{itemize}
% \item \DescribeMacro{\rcsInfoFile} The name of the source file, without
% the \RCS\ suffix \texttt{,v}.
%        Default: \texttt{--sourcefile--}.
% \item \DescribeMacro{\rcsInfoRevision} The \RCS\ revision number, of the
%       \emph{checked out} file.
%       Default: \texttt{--revision--}.
% \item \DescribeMacro{\rcsInfoDate} The date in the form \emph{YYYY/MM/DD},
%       when the file was \emph{checked out}.
%       Default: the current date.
% \item \DescribeMacro{\rcsInfoTime} The time, when the file was
%       \emph{checked out}.
%       Default: \texttt{--time--}.
% \item \DescribeMacro{\rcsInfoOwner} The user name of the file owner.
%       Default: \texttt{--owner--}.
% \item \DescribeMacro{\rcsInfoStatus} The stautus of the file, e.g.\
%       \texttt{Exp}.
%       Default: \texttt{--status--}.
% \item \DescribeMacro{\rcsInfoLocker} If the file is locked, the user name
%       of the locker.
%       If the file is not locked: \texttt{--not-locked--}.
%       Default: \texttt{--locker--}.
% \item \DescribeMacro{\rcsInfoYear} The year \emph{YYYY} of |\rcsInfoDate|.
%       Default: the current year.
% \item \DescribeMacro{\rcsInfoMonth} The month \emph{MM} of |\rcsInfoDate|.
%       Default: the current month.
% \item \DescribeMacro{\rcsInfoDay} The day \emph{DD} of |\rcsInfoDate|.
%       Default: the current day.
% \item \DescribeMacro{\rcsInfoLongDate} The date in the form of |\today|
%       when the file was \emph{checked out}. This is language dependend.
%       Default: the current date.
% \end{itemize}
%
% \subsection{\LatexToHtml}
%
% When converting a \LaTeX\ document to \texttt{HTML} using the
% \LatexToHtml\ tool,
% it's possible to use the \RCS\ information in the \texttt{HTML} document too.
% This functionality is offered by the extension file \texttt{rcsinfo.perl}
% which should be placed into the directory \texttt{LATEX2HTML/styles}.
% For more information have a look at the documentation of \LatexToHtml.
%
% An example is given in the file \texttt{rcsinfo2html.tex}.
%
% \noindent\underline{Notes}
% \begin{itemize}
% \item Use at least version \emph{99.1 release (March 30, 1999)} of
%       \LatexToHtml.
%
% \item You should |\usepackage{html}|.
%
% \item You must run \LaTeX\ on the input file before running \LatexToHtml.
%
% \item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
%       either:
%       \begin{itemize}
%       \item call \LatexToHtml\ with the option
%                  \verb|-show_section_numbers| or
%       \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
%             adding the lines in the preamble:\\
%		\verb|\begin{htmlonly}|\\
%		\verb|\input{|\emph{source}\verb|.aux}|\\
%		\verb|\end{htmlonly}|\\
% 	    which requires \verb|\usepackage{html}|.
%       \end{itemize}
%       If you don't do so, the \verb|\rcsInfo...| commands give no value.
%
% \item If using the \LatexToHtml\ tool, only the last |\rcsInfo| takes
%       effect, e.g.~if using several input files each having the |\rcsInfo|
%       command, only the vales of the last included file are used.
%       (If this is a serious problem for you, drop me a mail).
%
% \item If the \verb|fancy| / \verb|fancyhdr| option is given to the
%       \verb|rcsinfo| package,
%       the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
%       page is set to the \RCS\ date.
%
% \item If you would like to set your own \verb|ADDRESS| text, you should
%       define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
%       variable in your local \texttt{.latex2html} initialization file.
%       The routine may use the \texttt{perl}
%       variables shown below. Assign a reference of this procdure to the
%       \texttt{perl}-variable
%       \verb|$rcsinfo::SetAddressProc|.
%       E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
%       then \\
%       \verb|$rcsinfo::SetAddressProc = &my_address_field|.
% \end{itemize}
%
% \newcommand{\Var}[1]{\texttt{\$rcsinfo::#1}}
% \noindent
% Here are the commands, the Perl-variables and their output:\\
% \begin{tabular}{lll}
% \LaTeX-command              & \texttt{perl} variable & Result for this file \\\hline
% \verb|\today|               & \texttt{\$today}       & \today           \\
% \verb|\rcsInfoFile|         & \Var{File}             & \rcsInfoFile     \\
% \verb|\rcsInfoOwner|        & \Var{Owner}            & \rcsInfoOwner    \\
% \verb|\rcsInfoStatus|       & \Var{Status}           & \rcsInfoStatus   \\
% \verb|\rcsInfoLocker|       & \Var{Locker}           & \rcsInfoLocker   \\
% \verb|\rcsInfoDate|         & \Var{Date}             & \rcsInfoDate     \\
% \verb|\rcsInfoLongDate|     & \Var{LongDate}         & \rcsInfoLongDate \\
% \verb|\rcsInfoDay|          & \Var{Day}              & \rcsInfoDay      \\
% \verb|\rcsInfoMonth|        & \Var{Month}            & \rcsInfoMonth    \\
% \verb|\rcsInfoYear|         & \Var{Year}             & \rcsInfoYear     \\
% \end{tabular}
%
% \section{Examples}
%
% \newcommand{\rcsExample}{
% \begin{tabular}[t]{rl}
% \Cmd{rcsInfoFile}     & \rcsInfoFile     \\
% \Cmd{rcsInfoRevision} & \rcsInfoRevision \\
% \Cmd{rcsInfoDate}     & \rcsInfoDate     \\
% \Cmd{rcsInfoTime}     & \rcsInfoTime     \\
% \Cmd{rcsInfoOwner}    & \rcsInfoOwner    \\
% \Cmd{rcsInfoStatus}   & \rcsInfoStatus   \\
% \Cmd{rcsInfoLocker}   & \rcsInfoLocker   \\
% \end{tabular}
% \begin{tabular}[t]{rl}
% \Cmd{rcsInfoYear}     & \rcsInfoYear     \\
% \Cmd{rcsInfoMonth}    & \rcsInfoMonth    \\
% \Cmd{rcsInfoDay}      & \rcsInfoDay      \\
% \Cmd{rcsInfoLongDate} & \rcsInfoLongDate \\
% \Cmd{today}           & \today           \\
% \end{tabular}\\
% \bigskip
% \rcsInfo $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $
%}
%
% \rcsInfo $Id$
% |\rcsInfo| not expanded, no colon\\
% \verb+\rcsInfo $+\verb+Id$+\\
% \rcsExample
%
% \rcsInfo $Id:$
% |\rcsInfo| not expanded, having colon\\
% \verb+\rcsInfo $+\verb+Id:$+\\
% \rcsExample
%
% \rcsInfo $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp $
% |\rcsInfo| without locker\\
% {\small\verb+\rcsInfo $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp $+}\\
% \rcsExample
%
% \rcsInfo $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $
% |\rcsInfo| with locker\\
% {\footnotesize\verb+\rcsInfo $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $+}\\
% \rcsExample
%
% \rcsInfo Id: rcsinfo.dtx,v 1.2 2002/04/19 12:27:55 vollmer Exp vollmer $
% |\rcsInfo| no leading \$\\
% {\footnotesize\verb+\rcsInfo Id: rcsinfo.dtx,v 1.2 2002/04/19 12:27:55 vollmer Exp vollmer $+}\\
% \rcsExample
%
% \section{Copyright and License}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{tabular}{ll}
% Copyright (\copyright) 1995, & Dr.~J\"urgen Vollmer, Karlsruhe, Germany\\
%                              & \texttt{Juergen.Vollmer@acm.org}       \\
% \end{tabular}
%
% \noindent
% This program can be redistributed and/or modified under the terms
% of the \LaTeX Project Public License Distributed from CTAN
% archives in directory 'macros/latex/base/lppl.txt'; either
% version 1 of the License, or any later version.
%
% \medskip\noindent
% If you find this software useful, please send me a postcard.
%
% \StopEventually{}
%
% \section{The Documentation Driver File}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The next bit of code contains the documentation driver file for
% \TeX\, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the
% \texttt{docstrip} program.
%
% If you want to read about the implementation, put a \% before
% |\OnlyDescription| in the following code.
%    \begin{macrocode}
%<*driver>
\documentclass{article}
\usepackage{doc}
\usepackage{rcsinfo}
\OnlyDescription
\makeatletter
\if@rcsInfoUseFancy@
\pagestyle{fancyplain}
\rhead[\fancyplain{}{\leftmark}]{\fancyplain{}{\thepage}}
\lhead[\fancyplain{}{\thepage}]{\fancyplain{}{\rightmark}}
\fi
\if@rcsInfoUseFancyhdr@
\pagestyle{fancyplain}
\fancyhead[RE,LO]{\leftmark}
\fancyhead[LE,RO]{\thepage}
\fi
\makeatother
\RecordChanges
\EnableCrossrefs
\CodelineIndex
\begin{document}
\DocInput{rcsinfo.dtx}
\PrintChanges
\setcounter{IndexColumns}{2}
\PrintIndex
\end{document}
%</driver>
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{The Configuration File}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% You can set up the default fancy headings package in the file
% |rcsinfo.cfg|.
% Use the old |fancyheadings| package or the new |fancyhdr| package,
% by setting the corresponding default option: |fancy| or |fancyhdr|.
%    \begin{macrocode}
%<*config>
\ExecuteOptions{fancyhdr}
%</config>
%    \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{The Implementation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The implementation is based on cracking the \Id\ string. To support
% \LatexToHtml\ some macro definitions are written to the |.aux| file.
% These macros are the used by \LatexToHtml\ and |rcsinfo.perl| to extract
% the \RCS\ info.
%
% What do we need, and who we are:
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rcsinfo}[2002/04/19 v1.9]
%    \end{macrocode}
%
% Declare some local counters to store the \RCS\ date
%    \begin{macrocode}
\newcount\@rcsInfoDay
\newcount\@rcsInfoMonth
\newcount\@rcsInfoYear
%    \end{macrocode}
% Declare some local counters to hold some temporary information
%    \begin{macrocode}
\newcount\@rcsInfoYearTmp
\newcount\@rcsInfoMonthTmp
\newcount\@rcsInfoDayTmp
%    \end{macrocode}
%
% To memorize, that we want to set |\today| to the date obtained by the
% \RCS\ information.
%    \begin{macrocode}
\newif\if@rcsInfoToday@
%    \end{macrocode}
%
% |\today| should return the date obtained by the \RCS\ information.
%    \begin{macrocode}
\DeclareOption{today}{
  \@rcsInfoToday@true
}
%    \end{macrocode}
%
% Ok we don't want do use it.
%    \begin{macrocode}
\DeclareOption{notoday}{
  \@rcsInfoToday@false
}
%    \end{macrocode}
%
% To memorize, that we want to have the old \texttt{fancyheadings} or the new
% \texttt{fancyhdr} footline filled with \RCS\ information.
%    \begin{macrocode}
\newif\if@rcsInfoUseFancy@
\newif\if@rcsInfoUseFancyhdr@
%    \end{macrocode}
%
% We want to use the old \texttt{fancyheadings} or the  new \texttt{fancyhdr}
% package, and set the footline with the \RCS\ information.
% Only one option may be in effect.
%    \begin{macrocode}
\DeclareOption{fancy}{
  \@rcsInfoUseFancy@true
  \@rcsInfoUseFancyhdr@false
}
\DeclareOption{fancyhdr}{
  \@rcsInfoUseFancy@false
  \@rcsInfoUseFancyhdr@true
}
%    \end{macrocode}
%
% Ok we don't want do use it.
%    \begin{macrocode}
\DeclareOption{nofancy}{
  \@rcsInfoUseFancy@false
  \@rcsInfoUseFancyhdr@false
}
%    \end{macrocode}
%
% To memorize, that we want to use the long date format.
%    \begin{macrocode}
\newif\if@rcsInfoLong@
%    \end{macrocode}
%
% We want to use the long date format.
%    \begin{macrocode}
\DeclareOption{long}{
  \@rcsInfoLong@true
}
%    \end{macrocode}
%
% Ok we don't want do use it.
%    \begin{macrocode}
\DeclareOption{short}{
  \@rcsInfoLong@false
}
%    \end{macrocode}
%
% Use these default options,
%    \begin{macrocode}
\ExecuteOptions{today,long}
%    \end{macrocode}
%
% read the configuration file, to set the default fancy headings package,
%    \begin{macrocode}
\IfFileExists{rcsinfo.cfg}{\input{rcsinfo.cfg}}{}
%    \end{macrocode}
%
% and the process the user options.
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
% Load \texttt{fancyheadings} / \texttt{fancyhdr} if neccessary.
%    \begin{macrocode}
\if@rcsInfoUseFancy@
    \RequirePackage{fancyheadings}
\fi
\if@rcsInfoUseFancyhdr@
    \RequirePackage{fancyhdr}
\fi
%    \end{macrocode}
%
% If no language for the |babel| package is given in the document,
% we have to redefine |\today| (otherwise the changed |\year|, |\month| and
% |\day| won't work). In this case use the english version of |\today|.
%    \begin{macrocode}
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
%    \end{macrocode}
%
% We have a problem, since the number of arguments of |\rcsInfo| vary from
% zero to seven.
% To deal with that, we use some kind ``contuinuation passing'' style of
% programming.
% |\@rcsInfoNext| contains the action to be done next.
%
% Some packages (e.g.\ the |babel|-package with the |french|-option)
% change the catcode of |:| (colon). If this happens, we have to
% undo this in order to parse the \Id\ string (which contains a colon)
% and restore its original catcode afterwards.
% This flag is used to store whether the state of the colon was changed to
% be active.
%    \begin{macrocode}
\newif\if@rcsInfoColonIsActive@
%    \end{macrocode}

%\begin{macro}{\rcsInfo}
% Extract the \RCS\ information, and give commands shown above their values.
% Check the catcode of |:| and set the flag. The restoration is done after the
% |:| has been read. Allow \_ (underscore) in file names, hence change the
% |\catcode| of it.
%    \begin{macrocode}
\def\rcsInfo {
   \catcode`\_=13
   \ifnum\catcode`\:=13
      \@rcsInfoColonIsActive@true
      \catcode`:=12
   \else
      \@rcsInfoColonIsActive@false
   \fi
   \@rcsInfoReadArgs
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@rcsInfoReadArgs}
% First check, if the \Id\ string is not-expanded.
% Set the default values, so that for not expanded \Id\ strings, we get them.
% The \$ before |Id| may be omitted (I use this to avoid expansion of
% \$Id-Tags to be expanded by RCS in some cases).
% Restore the catcode of the |:|.
%    \begin{macrocode}
\def\@rcsInfoReadArgs #1Id#2 {
  \@rcsInfoDefaults
  \if $#2 \let \@rcsInfoNext = \@rcsInfoEat
  \else   \let \@rcsInfoNext = \@rcsInfoEatColon
  \fi
%    \end{macrocode}
% |#2| contains either |$| or |:$| or |:|\blank\ hence we have read the colon
% and can restore the catode of it.
%    \begin{macrocode}
  \if@rcsInfoColonIsActive@
     \catcode`:=13
  \fi
%    \end{macrocode}
% Start processing the \Id\ string.
%    \begin{macrocode}
  \@rcsInfoNext $Id#2
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@rcsInfoEat}
% This macro eats up its argument, i.e.\ removes it from the input.
% Reset the |\catcode| of the underscore.
%    \begin{macrocode}
\def\@rcsInfoEat #1 {\catcode`\_=8}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@rcsInfoEatColon}
% This macro eats up the colon following \texttt{Id}.
% The colon may be followed by a \$, which means that the \Id\ string is not
% expanded.
%    \begin{macrocode}
\def\@rcsInfoEatColon  $Id:#1 {
  \if $#1 \let \@rcsInfoNext = \@rcsInfoEat
  \else   \let \@rcsInfoNext = \@rcsInfoCrackAndEat
  \fi
  \@rcsInfoNext #1
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@rcsInfoCrackAndEat}
% Take an expanded \Id\ string pass it to the crack routine
% |\@rcsInfoCrack|\-|String|, which specifies what has to be done
% after it. I.e.\ if we have no locker, we have already eaten the \$,
% if we have a locker, we still have to eat the terminating \$.
% Note: here we don't give an argument to |\@rcsInfoNext|, since it is taken
% form the source, in case of |\@rcsInfoEat|.
% We have to take the next 7 tokens.
%    \begin{macrocode}
\def\@rcsInfoCrackAndEat #1,v #2 #3 #4 #5 #6 #7 {
  \@rcsInfoCrackString #1,v #2 #3 #4 #5 #6 #7
  \@rcsInfoNext
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@rcsInfoCrackString}
% Take an expanded \Id\ string and crack it:\\
% \#1: filename, \#2 revision, \#3 date, \#4 time, \#5 owner, \#6 status,
% \#7 locker\\
% Hence we have to consume the terminating \$ afterwards, or \\
% \#1: filename,\#2 revision, \#3 date, \#4 time, \#5 owner, \#6 status,
% \#7 \$ \\
% Here we have already consumed the terminating \$ as 7$^{th}$ parameter, hence
% |\relax|. Reset the |\catcode| of the underscore.
%
% Split the date into year,month and day.
% If the option \texttt{today} is given, |\today| returns from now
% on the \RCS\ date.
%
% Write some macro definitions to the |.aux| file, to support \LatexToHtml.
%    \begin{macrocode}
\def\@rcsInfoCrackString #1,v #2 #3 #4 #5 #6 #7 {
  \def\rcsInfoFile{#1}
  \def\rcsInfoRevision{#2}
  \def\rcsInfoTime{#4}
  \def\rcsInfoOwner{#5}
  \def\rcsInfoStatus{#6}
  \write\@mainaux{\string\def\string\rcsInfoFILE{#1}}
  \write\@mainaux{\string\def\string\rcsInfoREVISION{#2}}
  \write\@mainaux{\string\def\string\rcsInfoTIME{#4}}
  \write\@mainaux{\string\def\string\rcsInfoOWNER{#5}}
  \write\@mainaux{\string\def\string\rcsInfoSTATUS{#6}}

  \if $#7
    \def\rcsInfoLocker{--not-locked--}
    \write\@mainaux{\string\def\string\rcsInfoLocker{--not-locked--}}
    \let \@rcsInfoNext = \relax
  \else
    \def\rcsInfoLocker{#7}
    \write\@mainaux{\string\def\string\rcsInfoLocker{#7}}
    \let \@rcsInfoNext = \@rcsInfoEat
  \fi
  \catcode`\_=8
  \@rcsInfoSplitDate x#3x
  \def\rcsInfoLongDate{\@rcsInfoToday}
  \if@rcsInfoToday@
    \year  = \@rcsInfoYear
    \month = \@rcsInfoMonth
    \day   = \@rcsInfoDay
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rcsInfoSplitDate}
% This macro sets |\rcsInfoYear|, |\rcsInfoMonth|, and |\rcsInfoDay|.
% It takes a \texttt{x}\emph{YYYY/MM/DD}\texttt{x} style of argument.
%    \begin{macrocode}
\def\@rcsInfoSplitDate x#1/#2/#3x{
  \@rcsInfoDay  = #3
  \@rcsInfoMonth= #2
  \@rcsInfoYear = #1
  \write\@mainaux{\string\def\string\rcsInfoDAY{#3}}
  \write\@mainaux{\string\def\string\rcsInfoMONTH{#2}}
  \write\@mainaux{\string\def\string\rcsInfoYEAR{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rcsInfoToday}
% Returns the \RCS\ date in the form as |\today| does it.
% To do this, we set |\year|, |\month| and |\day| commands to the
% corresponding \RCS\ information, let |\today| does its work, i.e.\
% transforming the date into a language dependent string and reset
% |\year|, |\month| and |\day| to their previous value.
%
%    \begin{macrocode}
\def\@rcsInfoToday {%
   \@rcsInfoYearTmp  = \year
   \@rcsInfoMonthTmp = \month
   \@rcsInfoDayTmp   = \day
   \year  = \@rcsInfoYear
   \month = \@rcsInfoMonth
   \day   = \@rcsInfoDay
   \today%
   \year  = \@rcsInfoYearTmp
   \month = \@rcsInfoMonthTmp
   \day   = \@rcsInfoDayTmp
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rcsInfoDefaults}
% This macro sets the default values.
%    \begin{macrocode}
\def\@rcsInfoDefaults {
  \@rcsInfoYear  = \year
  \@rcsInfoMonth = \month
  \@rcsInfoDay   = \day
  \def\rcsInfoFile{--sourcefile--}
  \def\rcsInfoDate{\the\@rcsInfoYear/\two@digits\@rcsInfoMonth/%
                   \two@digits\@rcsInfoDay}
  \def\rcsInfoTime{--time--}
  \def\rcsInfoRevision{--revision--}
  \def\rcsInfoOwner{--owner--}
  \def\rcsInfoStatus{--status--}
  \def\rcsInfoLocker{--locker--}
  \def\rcsInfoYear{\the\@rcsInfoYear}
  \def\rcsInfoMonth{\the\@rcsInfoMonth}
  \def\rcsInfoDay{\the\@rcsInfoDay}
  \def\rcsInfoLongDate{\@rcsInfoToday}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rcsInfoFancyFoot}
% This defines the contents of the footline
%    \begin{macrocode}
\def\@rcsInfoFancyFoot {
  \if@rcsInfoLong@
    \def\@rcsInfoFancyInfo{{\footnotesize%
                           \emph{Rev: \rcsInfoRevision,
				      \rcsInfoStatus,
			              \rcsInfoLongDate}}}
  \else
    \def\@rcsInfoFancyInfo{{\footnotesize%
                          \emph{Rev: \rcsInfoRevision,
				     \rcsInfoStatus,
				     \rcsInfoDate}}}
  \fi
  \def\@rcsInfoFancyFile{{\footnotesize\emph{\rcsInfoFile}}}
%    \end{macrocode}
% and set it for the \texttt{fancyheadings} package,
% package page style.
%    \begin{macrocode}
  \if@rcsInfoUseFancy@
    \rfoot[\fancyplain{\@rcsInfoFancyFile}{\@rcsInfoFancyFile}]%
          {\fancyplain{\@rcsInfoFancyInfo}{\@rcsInfoFancyInfo}}
    \lfoot[\fancyplain{\@rcsInfoFancyInfo}{\@rcsInfoFancyInfo}]%
          {\fancyplain{\@rcsInfoFancyFile}{\@rcsInfoFancyFile}}
    \setlength{\footrulewidth}{0.4pt}
    \setlength{\plainfootrulewidth}{0.4pt}
  \fi
%    \end{macrocode}
% and for the \texttt{fancyhdr} package.
%    \begin{macrocode}
  \if@rcsInfoUseFancyhdr@
    \fancyfoot[LE,RO]{\@rcsInfoFancyInfo}
    \fancyfoot[LO,RE]{\@rcsInfoFancyFile}
    \fancyfoot[CO,CE]{\thepage}
    \renewcommand{\footrulewidth}{0.4pt}
    \fancypagestyle{plain}{%
       \fancyfoot[LE,RO]{\@rcsInfoFancyInfo}
       \fancyfoot[LO,RE]{\@rcsInfoFancyFile}
       \fancyfoot[CO,CE]{\thepage}
       \renewcommand{\footrulewidth}{0.4pt}
    }
  \fi
}
%    \end{macrocode}
%\end{macro}

% Initialize the defaults
%    \begin{macrocode}
\@rcsInfoDefaults
%    \end{macrocode}

% At the start of the document, if we use the
% \texttt{fancyheadings} / \texttt{fancyhdr} footline, we should set it here.
%    \begin{macrocode}
\AtBeginDocument{
  \if@rcsInfoUseFancy@
    \@rcsInfoFancyFoot
  \fi
  \if@rcsInfoUseFancyhdr@
    \@rcsInfoFancyFoot
  \fi
}
%</package>
%    \end{macrocode}
% \centerline{That's the end}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \Finale
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
%
% rcsinfo2html.tex: the example file for transforming to HTML
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%<*html>
\documentclass{article}
\usepackage{html}
\usepackage{rcsinfo}

% the rcsinfo.perl stuff needs that the .aux file has been read!
\begin{htmlonly}
\input{rcsinfo2html.aux}
\end{htmlonly}

\newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
\newcommand{\Var}[1]{\texttt{\$rcsinfo::#1}}
\newcommand{\RCS}{\emph{RCS}}

\pagestyle{fancy}

\begin{document}
\rcsInfo $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $

\author{Dr.~J{\"u}rgen Vollmer\\
        Viktoriastra{\ss}e 15, D-76133 Karlruhe, Germany\\
        \small{\texttt{Juergen.Vollmer@acm.org}}}
\date{\today}
\title{Example for converting a \LaTeX\ document to \texttt{HTML}\\
       using \LatexToHtml\ and the \texttt{rcsinfo}-package}
\maketitle

\section{Notes}
%%%%%%%%%%%%%%%

\begin{itemize}
\item Use at least version \emph{99.1 release (March 30, 1999)} of
      \LatexToHtml.

\item You should \verb|\usepackage{html}|.

\item You must run \LaTeX\ on the input file before running \LatexToHtml.

\item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
      either:
      \begin{itemize}
      \item call \LatexToHtml\ with the option
                 \verb|-show_section_numbers| or
      \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
            adding the lines in the preamble:\\
		\verb|\begin{|\verb|htmlonly}|\\  % looks ulgy, but otherwise
		\verb|\input{|\emph{source}\verb|.aux}|\\
		\verb|\end{|\verb|htmlonly}|\\    % latex2html fails.
	    which requires \verb|\usepackage{html}|.
      \end{itemize}
      If you don't do so, the \verb|\rcsInfo...| commands give no value.

\item If using the \LatexToHtml\ tool, only the last \verb|\rcsInfo| takes
      effect, e.g.~if using several input files each having the \verb|\rcsInfo|
      command, only the vales of the last included file are used.
      (If this is a serious problem for you, drop me a mail).

\item If the \verb|fancy| / \verb|fancyhdr| option is given to the
      \verb|rcsinfo| package,
      the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
      page is set to the \RCS\ date.

\item If you would like to set your own \verb|ADDRESS| text, you should
      define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
      variable in your local \texttt{.latex2html} initialization file.
      The routine may use the \texttt{perl}
      variables shown below. Assign a reference of this procdure to the
      \texttt{perl}-variable
      \verb|$rcsinfo::SetAddressProc|.
      E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
      then \\
      \verb|$rcsinfo::SetAddressProc = &my_address_field|.

      For example the follownig \texttt{perl}-code does the job:
\begin{verbatim}
sub my_address_field
{
 $ADDRESS = '<hr>This file was last updated on ' .
            $rcsinfo::Date  .
            '&nbsp; by ' .
            '<a href="mailto: Juergen.Vollmer@acm.org">' .
            'Juergen Vollmer ' .
	    '&lt;Juergen.Vollmer@acm.org&gt;</a>';
}
$rcsinfo::SetAddressProc = \&my_address_field;
\end{verbatim}
\end{itemize}

\newpage

\section{Example}
%%%%%%%%%%%%%%%%%

\label{sec-examples}
Here are the commands and their output:

\begin{tabular}{lll}
\LaTeX-command              & \texttt{perl} variable & Result for this file \\\hline
\verb|\today|               & \texttt{\$today}       & \today           \\
\verb|\rcsInfoFile|         & \Var{File}             & \rcsInfoFile     \\
\verb|\rcsInfoOwner|        & \Var{Owner}            & \rcsInfoOwner    \\
\verb|\rcsInfoStatus|       & \Var{Status}           & \rcsInfoStatus   \\
\verb|\rcsInfoLocker|       & \Var{Locker}           & \rcsInfoLocker   \\
\verb|\rcsInfoDate|         & \Var{Date}             & \rcsInfoDate     \\
\verb|\rcsInfoLongDate|     & \Var{LongDate}         & \rcsInfoLongDate \\
\verb|\rcsInfoDay|          & \Var{Day}              & \rcsInfoDay      \\
\verb|\rcsInfoMonth|        & \Var{Month}            & \rcsInfoMonth    \\
\verb|\rcsInfoYear|         & \Var{Year}             & \rcsInfoYear     \\
\end{tabular}

\end{document}
%</html>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% 				rcsinfo.ins
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*ins>
\def\batchfile{rcsinfo.ins}
\input docstrip.tex

\Msg{}
\Msg{***********************************************************}
\Msg{** Hello to the installation of the `rcsinfo' package.}
\Msg{** Version 1.9, April 19, 2002}
\Msg{***********************************************************}
\Msg{}

\generate{
        \askforoverwritefalse
       %\file{rcsinfo.ins}{\from{rcsinfo.dtx}{header,ins}}
        \file{rcsinfo.cfg}{\from{rcsinfo.dtx}{header,config}}
        \file{rcsinfo.sty}{\from{rcsinfo.dtx}{header,package}}
        \file{rcsinfo2html.tex}{\from{rcsinfo.dtx}{header,html}}
        \usepreamble\empty
        \usepostamble\empty
        \file{rcsinfo.perl}{\from{rcsinfo.dtx}{perl}}
        \file{rcsinfo.init}{\from{rcsinfo.dtx}{init}}
}

\Msg{}
\Msg{***********************************************************}
\Msg{** Edit the file rcsinfo.cfg and set the default fancy headings package}
\Msg{** To finish the installation move the file `rcsinfo.sty' and}
\Msg{** rcsinfo.cfg to a place where LaTeX will find it.}
\Msg{** To Get the documentation: `latex rcsinfo.dtx'}
\Msg{** and `latex rcsinfo2html.dtx'}
\Msg{** If you are using LaTeX2HTML, move the PERL-package}
\Msg{** `rcsinfo.perl' to a place where LaTeX2HTML will find it.}
\Msg{** `rcsinfo.perl' is created by running `latex rcsinfo.dtx'.}
\Msg{** Happy TeXing}
\Msg{***********************************************************}
\Msg{}
%</ins>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% 				rcsinfo.perl
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*perl>
###############################################################################
# RCSINFO.PERL
# Copyright 1995, Dr. Juergen Vollmer <Juergen.Vollmer@acm.org>
#
# Extension to LaTeX2HTML to translate LaTeX commands of the
#               rcsinfo
# package to equivalent HTML commands.
#
# This is file `rcsinfo.perl',
# generated with the docstrip utility.
#
# The original source files were:
#
# rcsinfo.dtx  (with options: `perl')
#
# IMPORTANT NOTICE:
#
# For the copyright see the source file.
#
# Any modified versions of this file must be renamed
# with new filenames distinct from rcsinfo.perl.
#
# For distribution of the original source see the terms
# for copying and modification in the file rcsinfo.dtx.
#
# This generated file may be distributed as long as the
# original source files, as listed above, are part of the
# same distribution. (The sources need not necessarily be
# in the same archive or directory.)
#
# $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $
#
###############################################################################

package rcsinfo;

($Dummy1,$PackageVersionDate,$PackageVersionTime,$Dummy2) =
        split (/ /,'$Date: 2002/04/19 12:29:56 $');

print "\n\t rcsinfo style interface for LaTeX2HTML, $PackageVersionDate\n";

# set defaults options
$OptionFancy = 1;
$OptionToday = 1;
$OptionLong  = 1;

# set default values
$Date     = `date '+%Y/%m/%d'`;
$Time     = `date '+%H:%M:%S'`;
$File     = "--sourcefile--";
$Revision = "--revision--";
$Owner    = "--owner--";
$Status   = "--status--";
$Locker   = "--locker--";
$Year     = `date '+%Y'`;
$Month    = `date '+%m'`;
$Day      = `date '+%d'`;
$LongDate = $Date;

sub SetAddress
{
    $main::address_data[1] = "Revision: $rcsinfo::Revision, $rcsinfo::LongDate";
    # Supply your own string if you don't like the default <Name> <Date>
    $main::ADDRESS = "<I>$main::address_data[0] <BR>\n$main::address_data[1]</I>";
}
if ($SetAddressProc == "") {
  $SetAddressProc = \&rcsinfo::SetAddress;
}
sub make_cmds
{
  my $cmd;
  foreach $cmd (File,Revision,Date,Time,Owner,Status,Locker,Year,Month,Day,LongDate) {
        eval "sub main::do_cmd_rcsInfo$cmd { "
            . 'my $val = $rcsinfo::' . "$cmd; "
#           . 'printf STDERR "\ndo_cmd_rcsInfo%s=%s\n", ' . $cmd .', $val;'
            . "join('',\$val,\$_[0]);"
            . "}";
  }
}

@GermanMonthName  = ('','Januar','Februar','M&auml;rz','April','Mai','Juni','Juli',
                    'August','September','Oktober','November','Dezember');
@EnglishMonthName = ('','January','February','March','April','May','June','July',
                    'August','September','October','November','December');
@FrenchMonthName  = ('','Janvier','F&eacute;vrier','Mars','Avril','Mai','Juin',
                     'Juillet','Ao&ucirc;t','Septembre','Octobre','Novembre',
                     'D&eacute;cembre');

###############################################################################

package main;

# handling package options
sub do_rcsinfo_fancyhdr { $rcsinfo::OptionFancy = 1; }
sub do_rcsinfo_fancy    { $rcsinfo::OptionFancy = 1; }
sub do_rcsinfo_nofancy  { $rcsinfo::OptionFancy = 0; }
sub do_rcsinfo_today    { $rcsinfo::OptionToday = 1; }
sub do_rcsinfo_notoday  { $rcsinfo::OptionToday = 0; }
sub do_rcsinfo_short    { $rcsinfo::OptionLong  = 0; }
sub do_rcsinfo_long     { $rcsinfo::OptionLong  = 1; }

# handling of LaTeX commands
sub do_cmd_rcsInfo
{

    local ($_) = @_;

    # printf STDERR "\ndo_cmd_rcsInfo\n";

    # see latex2html, procedure: substitute_meta_cmds, process_body_newcommand
    # the format of the variable $new_command{cmd} is:
    #   $new_command{$cmd} = join(':!:',$argn,$body,$opt);
    # note: opt = "}" means:  Flag for no optional arg
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoFILE};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoREVISION};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoYEAR};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoMONTH};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoDAY};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoTIME};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoOWNER};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoSTATUS};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoLOCKER};

    # the following assumes: LaTeX2HTML Version 99.1 release (March 30, 1999)
    # may be later
    my ($argn, $opt);
    if (exists $new_command{rcsInfoFILE}) {
        ($argn, $rcsinfo::File, $opt) = split(/:!:/, $new_command{rcsInfoFILE});
    } else {
         $rcsinfo::File = $File
    }
    if (exists $new_command{rcsInfoREVISION}) {
        ($argn, $rcsinfo::Revision, $opt) = split(/:!:/, $new_command{rcsInfoREVISION});
    } else {
         $rcsinfo::Revision = $Revision
    }
    if (exists $new_command{rcsInfoYEAR}) {
        ($argn, $rcsinfo::Year, $opt) = split(/:!:/, $new_command{rcsInfoYEAR});
    } else {
         $rcsinfo::Year = $Year
    }
    if (exists $new_command{rcsInfoMONTH}) {
        ($argn, $rcsinfo::Month, $opt) = split(/:!:/, $new_command{rcsInfoMONTH});
    } else {
         $rcsinfo::Month = $Month
    }
    if (exists $new_command{rcsInfoDAY}) {
        ($argn, $rcsinfo::Day, $opt) = split(/:!:/, $new_command{rcsInfoDAY});
    } else {
         $rcsinfo::Day = $Day
    }
    if (exists $new_command{rcsInfoTIME}) {
        ($argn, $rcsinfo::Time, $opt) = split(/:!:/, $new_command{rcsInfoTIME});
    } else {
         $rcsinfo::Time = $Time
    }
    if (exists $new_command{rcsInfoOWNER}) {
        ($argn, $rcsinfo::Owner, $opt) = split(/:!:/, $new_command{rcsInfoOWNER});
    } else {
         $rcsinfo::Owner = $Owner
    }
    if (exists $new_command{rcsInfoSTATUS}) {
        ($argn, $rcsinfo::Status, $opt) = split(/:!:/, $new_command{rcsInfoSTATUS});
    } else {
         $rcsinfo::Status = $Status
    }
    if (exists $new_command{rcsInfoLOCKER}) {
        ($argn, $rcsinfo::Locker, $opt) = split(/:!:/, $new_command{rcsInfoLOCKER});
    } else {
         $rcsinfo::Locker = $Locker
    }

    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::File;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Revision;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Year;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Month;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Day;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Time;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Owner;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Status;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $rcsinfo::Locker;

    # the following code is for oldfashioned latex2hmtl, not anymore supported
    # format of $_:
    #                  vvvvvv that's text following the RCS-Id-string
    # <#nr#>.....<#nr>......
    #       ^ ^ ^  that's the RCS-Id-string
#    my ($Nr,$IdString,$Rest) = /(<#\d+#>)(.*)\1(.*)/s ;

    # The Id-String  may contain various tags, remove them
#    $IdString =~ s/<[^>]*>//g;

     # The Id-String  may contain various tags, remove them
#    $IdString =~ s/<[^>]*>//g;

    # split the Id-string
#    my ($id,$file,$revision,$date,$time,$owner,$status,$locker) = split(/\s/,$IdString);

    # remove trailing ,v
#    $file =~ s/,v$//;

    # split date
#    ($rcsinfo::Year,$rcsinfo::Month,$rcsinfo::Day) = split (/\//,$date);

#    $rcsinfo::Revision = $revision;
#    $rcsinfo::File     = $file;
#    $rcsinfo::Date     = $date;
#    $rcsinfo::Time     = $time;
#    $rcsinfo::Owner    = $owner;
#    $rcsinfo::Status   = $status;
#    $rcsinfo::Locker   = $locker;

    if ($default_language eq 'german' || $default_language eq 'austrian') {
        $rcsinfo::LongDate = $rcsinfo::Day . '.&nbsp;' .
                 $rcsinfo::GermanMonthName[$rcsinfo::Month] . '&nbsp;' .
                 $rcsinfo::Year;
        $rcsInfo::Date = $rcsinfo::Day . '.&nbsp;' . $rcsinfo::Month . '.&nbsp;' . $rcsinfo::Year;
    } elsif ($default_language eq 'french') {
        $rcsinfo::LongDate = $rcsinfo::Day . '.&nbsp;' .
                 $rcsinfo::FrenchMonthName[$rcsinfo::Month] . '&nbsp;' .
                 $rcsinfo::Year;
        $rcsInfo::Date = $rcsinfo::Day . '.&nbsp;' .$rcsinfo::Month . '.&nbsp;' . $rcsinfo::Year;
    } else { # english is the default
        $rcsinfo::LongDate = $rcsinfo::EnglishMonthName[$rcsinfo::Month] . '&nbsp;' .
                 $rcsinfo::Day . ',&nbsp;' .
                 $rcsinfo::Year;
        $rcsInfo::Date = $rcsinfo::Year . '/' .$rcsinfo::Month . '/' . $rcsinfo::Day;
    }

    if ($rcsinfo::OptionFancy == 1) {
       &$rcsinfo::SetAddressProc;
    }
    rcsinfo::make_cmds();

    # printf STDERR "xxx $HTML_VERSION, $HTML_OPTIONS\n";
    # remove stuff generated for the $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $-string
    # we assume that noting follows the "\rcsInfo $Id....$"
    if ($HTML_VERSION >= 3.2) {
        /^<tex2html_verbatim_mark>[^\n]*/;
        return $';
    } elsif ($HTML_VERSION == 3.1 || $HTML_VERSION == 2.1) {
        /^<tex2html_image_mark>[^\n]*/;
        return $';
    } else {
        if ($HTML_OPTIONS =~ /math/) {
            /^<tex2html_verbatim_mark>[^\n]*/;
            return $';
        } else {
            /^<tex2html_image_mark>[^\n]*/;
            return $';
        }
    }
}

# Replace do_cmd_today (\today) using the RCS date.
sub do_cmd_today {
    local($today);
    if ($rcsinfo::OptionToday == 1) {
        $today = $rcsinfo::LongDate;
    } else {
        if ($default_language eq 'german' || $default_language eq 'austrian') {
            $today = (`date "+%m:%d, 20%y"`);
            $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2. $rcsinfo::GermanMonthName[$1]/o;
            $today =~ s/20([7|8|9]\d{1})/19$1/o;
        } elsif ($default_language eq 'french') {
            $today = (`date "+%m:%d, 20%y"`);
            $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2 $rcsinfo::FrenchMonthName[$1]/o;
            $today =~ s/20([7|8|9]\d{1})/19$1/o;
        } else { # english is the default
            $today = (`date "+%m:%d, 20%y"`);
            $today =~ s/(\d{1,2}):0?/$rcsinfo::EnglishMonthName[$1] /o;
            $today =~ s/20([7|8|9]\d{1})/19$1/o;
        }
    }
    join('',$today,$_[0]);
}

1;

###############################################################################
%</perl>
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% 				latex2html.init
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%<*init>
# This is file `rcsinfo.init',
# generated with the docstrip utility.
#
# The original source files were:
#
# rcsinfo.dtx  (with options: `init')
#
# IMPORTANT NOTICE:
#
# For the copyright see the source file.
#
# Any modified versions of this file must be renamed
# with new filenames distinct from rcsinfo.init.
#
# For distribution of the original source see the terms
# for copying and modification in the file rcsinfo.dtx.
#
# This generated file may be distributed as long as the
# original source files, as listed above, are part of the
# same distribution. (The sources need not necessarily be
# in the same archive or directory.)
#
# This file should be used as initialization file for LaTeX2HTML
# when transforming rcsinfo2html.tex --> HTML
#
# $Id: rcsinfo.dtx,v 1.3 2002/04/19 12:29:56 vollmer Exp vollmer $
###############################################################################
sub my_address_field
{
 $ADDRESS = '<hr>This file was last updated on ' .
            $rcsinfo::Date  .
            '&nbsp; by ' .
            '<a href="mailto: Juergen.Vollmer@acm.org">' .
            'Juergen Vollmer ' .
	    '&lt;Juergen.Vollmer@acm.org&gt;</a>';
}
$rcsinfo::SetAddressProc = \&my_address_field;
###############################################################################
%</init>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                    E N D     of     R C S I N F O . D T X
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\fi
