%%
%% This is file `rcs-multi.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% rcs-multi.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2009 by Martin Scharrer <martin@scharrer-online.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Martin Scharrer.
%% 
%% This work consists of the file rcs-multi.dtx and the derived file rcs-multi.sty.
%% 
\def\filedate$#1: #2 #3 #4-#5-#6 #7 ${%
 \def\filedate{#4/#5/#6}%
 \def\filerev{#3}%
}
\filedate$Id: rcs-multi.dtx 2436 2011-04-02 19:11:17Z martin $
\def\fileversion{v0.1a}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{rcs-multi}
 [\filedate\space\fileversion\space RCS Keywords for multi-file LaTeX documents]

\def\rcs@ifempty#1{%
  \begingroup
  \edef\rcs@temp{#1}%
  \ifx\rcs@temp\empty
    \endgroup
    \expandafter
    \@firstoftwo
  \else
    \endgroup
    \expandafter
    \@secondoftwo
  \fi
}

\def\rcs@ifequal#1#2{%
  \begingroup
  \edef\rcs@stringa{#1}%
  \edef\rcs@stringb{#2}%
  \ifx\rcs@stringa\rcs@stringb
    \endgroup
    \expandafter
    \@firstoftwo
  \else
    \endgroup
    \expandafter
    \@secondoftwo
  \fi
}

\def\rcs@ifvalidrev#1{%
  \begingroup
  \@ifundefined{#1}%
    {\def\rcs@temp{-1}}%
    {\expandafter\edef
     \expandafter\rcs@temp\expandafter{\csname #1\endcsname}}%
  \ifnum\rcs@temp>-1\relax
    \endgroup
    \expandafter
    \@firstoftwo
  \else
    \endgroup
    \expandafter
    \@secondoftwo
  \fi
}

\def\rcsrev{0.0}            \def\@rcs@rev{0.0}
\def\rcsdate{}              \def\@rcs@date{}
\def\rcsauthor{}            \def\@rcs@author{}
\def\rcsyear{0000}          \def\@rcs@year{0000}
\def\rcsmonth{00}           \def\@rcs@month{00}
\def\rcsday{00}             \def\@rcs@day{00}
\def\rcshour{00}            \def\@rcs@hour{00}
\def\rcsminute{00}          \def\@rcs@minute{00}
\def\rcssecond{00}          \def\@rcs@second{00}
\def\rcsname{}              \def\@rcs@name{}
\def\rcsurl{}               \def\@rcs@url{}
\def\rcsmainfilename{}
\def\rcsmainurl{\rcsmainfilename}
\def\rcs@temp{}
\def\rcs@lastkw{}

\def\rcsfilerev{0.0}
\def\rcsfiledate{}
\def\rcsfileauthor{}
\def\rcsfileyear{0000}
\def\rcsfilemonth{00}
\def\rcsfileday{00}
\def\rcsfilehour{00}
\def\rcsfileminute{00}
\def\rcsfilesecond{00}
\def\rcsfileurl{}
\def\rcsfilename{}

\def\rcstime{\rcshour:\rcsminute:\rcssecond}
\def\rcsfiletime{\rcsfilehour:\rcsfileminute:\rcsfilesecond}

\newcommand*{\rcstoday}{%
  \begingroup
    \year\rcsyear \month\rcsmonth \day\rcsday
    \relax \today
  \endgroup
}
\newcommand*{\rcsfiletoday}{%
  \begingroup
    \year\rcsfileyear \month\rcsfilemonth \day\rcsfileday
    \relax \today
  \endgroup
}

\newcommand*{\rcsid}{%
  \@rcsidswtrue
  \rcskwsave
}
\newif\if@rcsidsw
\@rcsidswfalse

\def\rcs@scanId#1,v #2 #3 #4 #5 #6\relax{%
  \@rcs@scandate{#3 #4}%
  \@rcs@updateid{#2}{#3 #4}{#5}{#1}%
  \rcskwdef{Filename}{#1}%
  \rcskwdef{Date}{#3 #4}%
  \rcskwdef{Revision}{#2}%
  \rcskwdef{Author}{#5}%
}

\def\@rcs@updateid#1#2#3#4{%
  \xdef\rcsfilerev{#1}%
  \xdef\rcsfiledate{#2}%
  \xdef\rcsfileauthor{#3}%
  \xdef\rcsfileurl{#4}%
  \rcs@getfilename\rcsfileurl
  \ifx\rcsfiledate\empty\else
    \begingroup
      \edef\@tempa{\@rcs@year\@rcs@month\@rcs@day}
      \edef\@tempb{\rcsfileyear\rcsfilemonth\rcsfileday}
      \ifnum\@tempa<\@tempb
        \rcs@update
      \else\ifnum\@tempa=\@tempb
        \edef\@tempa{\@rcs@hour\@rcs@minute\@rcs@second}
        \edef\@tempb{\rcsfilehour\rcsfileminute\rcsfilesecond}
        \ifnum\@tempa<\@tempb
          \rcs@update
        \fi
      \fi\fi
    \endgroup
  \fi
}

\def\rcs@update{%
  \xdef\@rcs@rev{\rcsfilerev}%
  \xdef\@rcs@date{\rcsfiledate}%
  \xdef\@rcs@author{\rcsfileauthor}%
  \xdef\@rcs@year{\rcsfileyear}%
  \xdef\@rcs@month{\rcsfilemonth}%
  \xdef\@rcs@day{\rcsfileday}%
  \xdef\@rcs@hour{\rcsfilehour}%
  \xdef\@rcs@minute{\rcsfileminute}%
  \xdef\@rcs@second{\rcsfilesecond}%
  \xdef\@rcs@name{\rcsfilename}%
  \xdef\@rcs@url{\rcsfileurl}%
}

\def\rcs@catcodes{%
  \let\do\@makeother
  \dospecials
  \catcode`\^^M9
  \catcode`\ 10
  \catcode`\{1
  \catcode`\}2
}

\def\rcs@gdefverb#1{%
  \begingroup
    \def\rcs@temp{#1}%
    \begingroup
      \rcs@catcodes
      \rcs@gdefverb@
}

\def\rcs@gdefverb@#1{%
    \endgroup
    \expandafter\gdef\rcs@temp{#1}%
  \endgroup
}

\def\rcskwsave{%
  \begingroup
    \rcs@catcodes
    \rcskwsave@readargs
}

\gdef\rcskwsave@readargs#1{%
    \rcskwsave@read#1\relax
  \endgroup
  \if@rcsidsw
    \rcs@ifequal{\rcs@lastkw}{Id}%
      {\ifx\rcskwId\empty\else
        \expandafter
        \rcs@scanId\rcskwId\relax
        \@rcsidswfalse
      \fi}{%
    \rcs@ifequal{\rcs@lastkw}{Header}%
      {\ifx\rcskwHeader\empty\else
        \expandafter
        \rcs@scanId\rcskwHeader\relax
        \@rcsidswfalse
        \fi}{}%
      }%
  \fi
  \ignorespaces
}

\begingroup
\catcode`\$=12
\gdef\rcskwsave@read $#1$\relax{%
  \rcs@checkcolon#1:\relax
}
\endgroup

\begingroup
\catcode`\$=11
\gdef\rcskwsave@parse$#1:#2${%
  \expandafter\xdef\csname rcskw#1\endcsname{#2}%
}%
\endgroup

\newcommand{\rcskwdef}[2]{%
  \gdef\rcs@lastkw{#1}%
  \expandafter\xdef\csname rcskw#1\endcsname{#2}%
}

\rcskwdef{Rev}{0.0}
\rcskwdef{Date}{}
\rcskwdef{Author}{}
\rcskwdef{Filename}{}
\rcskwdef{HeadURL}{}

\newcommand{\rcskw}[1]{%
  \@ifundefined{rcskw#1}%
    {\PackageWarning{rcs-multi}{RCS keyword '#1' not defined (typo?)}}%
    {\csname rcskw#1\endcsname}%
}%

\def\rcs@checkcolon#1:#2\relax{%
  \rcs@ifempty{#2}%
    {\rcskwdef{#1}{}}%
    {\rcs@stripcolon#2\relax\rcskwdef{#1}{\rcs@value}}%
}

\def\rcs@stripcolon#1:\relax{%
  \rcs@ifempty{#1}%
    {\gdef\rcs@value{}}%
    {\rcs@ifequal{#1}{ }%
      {\gdef\rcs@value{}}%
      {\rcs@stripspace#1\relax\relax}%
    }%
}

\def\rcs@stripspace#1#2\relax{%
  \rcs@ifequal{#1}{ }%
    {\gdef\rcs@value{#2}}%
    {\rcs@striptrailingspace#1#2\relax}%
}

\def\rcs@striptrailingspace#1 \relax{%
  \gdef\rcs@value{#1}%
}

\def\@rcs@scandate#1{\@rcs@scandate@#1\empty\relax}

\def\@rcs@scandate@#1/#2/#3 #4:#5:#6#7#8\relax{%
  \gdef\rcsfileyear{#1}%
  \gdef\rcsfilemonth{#2}%
  \gdef\rcsfileday{#3}%
  \gdef\rcsfilehour{#4}%
  \gdef\rcsfileminute{#5}%
  \gdef\rcsfilesecond{#6#7}%
}

\def\rcspdfdate{%
  \rcsyear\rcsmonth\rcsday
  \rcshour\rcsminute\rcssecond00'00'%
}

\newcommand{\rcssetmainfile}{%
  \xdef\rcsmainfilename{\rcsfilename}%
  \xdef\rcsmainfileurl{\rcsfileurl}%
}
\AtBeginDocument{\rcssetmainfile}

\newcommand{\rcsRegisterAuthor}[2]{%
  \expandafter\def\csname rcs@author@#1\endcsname{#2}%
}

\newcommand{\rcsFullAuthor}{%
  \@ifnextchar{*}%
    {\rcsFullAuthor@star}%
    {\rcsFullAuthor@normal}%
}%
\def\rcsFullAuthor@star*#1{%
  \edef\rcs@temp{#1}%
  \rcsFullAuthor@{\rcs@temp}{~(\rcs@temp)}%
}%
\def\rcsFullAuthor@normal#1{%
  \edef\rcs@temp{#1}%
  \rcsFullAuthor@{\rcs@temp}{}%
}%
\def\rcsFullAuthor@#1#2{%
  \@ifundefined{rcs@author@#1}%
    {#1}%
    {\csname rcs@author@#1\endcsname #2}%
}

\newcommand{\rcsRegisterRevision}[2]{%
  \expandafter\def\csname rcs@revision@#1\endcsname{#2}%
}

\newcommand{\rcsFullRevision}{%
  \@ifnextchar{*}%
    {\rcsFullRevision@star}%
    {\rcsFullRevision@normal}%
}
\def\rcsFullRevision@star*#1{%
  \edef\rcs@temp{#1}%
  \rcsFullRevision@{\rcs@temp}{~(r\rcs@temp)}%
}
\def\rcsFullRevision@normal#1{%
  \edef\rcs@temp{#1}%
  \rcsFullRevision@{\rcs@temp}{}%
}
\def\rcsFullRevision@#1#2{%
  \@ifundefined{rcs@revision@#1}%
    {Revision #1}%
    {\csname rcs@revision@#1\endcsname #2}%
}

\providecommand{\rcs}[1]{\@revs#1}
\def\@rcs$#1 ${#1}

%% Adapted from the \url macro of the `hyperref` package.
\DeclareRobustCommand*{\rcsnolinkurl}{%
  \@ifundefined{hyper@normalise}%
    {\PackageWarning{rcs-multi}{Package hyperref is needed for \noexpand
     \rcsnolinkurl.}}%
    {\hyper@normalise\rcsnolinkurl@}%
}%
\def\rcsnolinkurl@#1{\Hurl{#1}}%

\def\rcs@getfilename#1{%
  \begingroup
    \edef\rcs@temp{#1}%
    \expandafter\@rcs@getfilename\rcs@temp/{}\relax
}%

\def\@rcs@getfilename#1/#2\relax{%
    \rcs@ifempty{#2}%
      {\endgroup\gdef\rcsfilename{#1}}%
      {\@rcs@getfilename#2\relax}%
}%


\def\rcs@writeaux{%
    \immediate\write\@mainaux{^^J%
      \noexpand\gdef\noexpand\rcsrev{\@rcs@rev}^^J%
      \noexpand\gdef\noexpand\rcsdate{\@rcs@date}^^J%
      \noexpand\gdef\noexpand\rcsauthor{\@rcs@author}^^J%
      \noexpand\gdef\noexpand\rcsyear{\@rcs@year}^^J%
      \noexpand\gdef\noexpand\rcsmonth{\@rcs@month}^^J%
      \noexpand\gdef\noexpand\rcsday{\@rcs@day}^^J%
      \noexpand\gdef\noexpand\rcshour{\@rcs@hour}^^J%
      \noexpand\gdef\noexpand\rcsminute{\@rcs@minute}^^J%
      \noexpand\gdef\noexpand\rcssecond{\@rcs@second}^^J%
      \noexpand\rcs@gdefverb\noexpand\rcsname{\@rcs@name}^^J%
      \noexpand\rcs@gdefverb\noexpand\rcsurl{\@rcs@url}^^J%
    }%
}

\AtEndDocument{%
  \if@filesw
    \ifx\@rcs@date\empty\else
      \rcs@writeaux
    \fi
  \fi
}
\endinput
%%
%% End of file `rcs-multi.sty'.
