%%
%% This is file `svninfo.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% svninfo.dtx  (with options: `header,package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from svninfo.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file svninfo.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.)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `svninfo' package to use with LaTeX2e.
%%
%% This package is used to extract the revision and file information provided
%% by the Subversion revision control system.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%% Copyright (C) 2003-2010 Achim D. Brucker
%%
%% 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.
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% \CheckSum{628}
%% \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         \~}

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{svninfo}[2010/03/22 v0.7.4]
\newcount\@svnInfoDay
\newcount\@svnInfoMonth
\newcount\@svnInfoYear
\newif\if@svnInfoToday@
\DeclareOption{today}{
  \@svnInfoToday@true
}
\DeclareOption{notoday}{
  \@svnInfoToday@false
}
\newif\if@svnInfoRevRange@
\@svnInfoRevRange@false
\DeclareOption{revrange}{
  \@svnInfoRevRange@true
}
\newif\if@svnInfoDraft@
\DeclareOption{final}{
  \@svnInfoDraft@false
}
\DeclareOption{draft}{
  \@svnInfoDraft@true
}
\newif\if@svnInfoNotPreamble@%
\@svnInfoNotPreamble@false%
\newif\if@svnInfoUseFancy@
\newif\if@svnInfoUseFancyhdr@
\newif\if@svnInfoUseScrpage@
\newif\if@svnInfoUseEsofoot@
\newif\if@svnInfoUseMargin@
\newif\if@svnInfoSVK@
\DeclareOption{fancy}{
  \@svnInfoUseFancy@true
  \@svnInfoUseFancyhdr@false
  \@svnInfoUseScrpage@false
  \@svnInfoUseEsofoot@false
}
\DeclareOption{fancyhdr}{
  \@svnInfoUseFancy@false
  \@svnInfoUseFancyhdr@true
  \@svnInfoUseScrpage@false
  \@svnInfoUseEsofoot@false
}
\DeclareOption{scrpage}{
  \@svnInfoUseFancy@false
  \@svnInfoUseFancyhdr@false
  \@svnInfoUseScrpage@true
  \@svnInfoUseEsofoot@false
}
\DeclareOption{eso-foot}{
  \@svnInfoUseFancy@false
  \@svnInfoUseFancyhdr@false
  \@svnInfoUseScrpage@false
  \@svnInfoUseEsofoot@true
}
\DeclareOption{margin}{
  \@svnInfoUseMargin@true
}
\DeclareOption{svk}{
  \@svnInfoSVK@true
}
\DeclareOption{nofancy}{
  \@svnInfoUseFancy@false
  \@svnInfoUseFancyhdr@false
  \@svnInfoUseScrpage@false
  \@svnInfoUseEsofoot@false
}
\newif\if@svnInfoLong@
\DeclareOption{long}{
  \@svnInfoLong@true
}
\DeclareOption{short}{
  \@svnInfoLong@false
}
\ExecuteOptions{draft,today,long}
\IfFileExists{svninfo.cfg}{\input{svninfo.cfg}}{}
\ProcessOptions*\relax
\if@svnInfoDraft@
    \if@svnInfoUseFancy@
        \RequirePackage{fancyheadings}
    \fi
    \if@svnInfoUseFancyhdr@
        \RequirePackage{fancyhdr}
    \fi
    \if@svnInfoUseScrpage@
        \RequirePackage{scrpage2}
    \fi
    \if@svnInfoUseEsofoot@
        \RequirePackage{eso-pic}
    \fi
\fi
\RequirePackage{ifthen}
\def\svnToday{\@svnInfoToday}


\def\@svnBeginRead{\begingroup
   \catcode`\_=13 %
   \catcode`:=12 %
   \catcode`\\=12 %
}
\def\@svnEndRead{\endgroup
}

\def\svnInfo {\@svnBeginRead
  \@svnInfoReadArgs
 }


\def\@svnInfoReadArgs #1Id#2 {\@svnEndRead
  \@svnInfoDefaults
  \if $#2 \expandafter\@svnInfoEat
  \else   \@svnBeginRead
          \expandafter\@svnInfoEatColon
  \fi
  $Id#2 %
}

\def\@svnInfoEat #1 {}

\def\@svnInfoEatColon $Id:#1 {\@svnEndRead
  \if $#1 \expandafter\@svnInfoEat
  \else   \@svnBeginRead
          \expandafter\@svnInfoCrackAndEat
  \fi
  #1 %
}

\def\@svnInfoCrackAndEat #1 #2 #3 #4 #5 #6 {\@svnEndRead
  \@svnInfoCrackString #2 #3 #4 #5 #6 %
}

\def\@svnInfoCrackString #1 #2 #3 #4 #5 {%
  \def\svnInfoFile{#1}%
  \def\svnInfoRevision{#2}%
  \def\svnInfoTime{#4}%
  %
  \@svnInfoSplitDate x#3r#2x%
  \@svnInfoMargin%
  \def\svnInfoLongDate{\@svnInfoToday}%
  \if@svnInfoToday@
    \year  =\@svnInfoYear
    \month =\@svnInfoMonth
    \day   =\@svnInfoDay
  \fi
\ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\) %
    \OR \(   \svnInfoMaxRevision < #2 \)}{%
    \def\svnInfoMaxRevision{#2}%
  }{}%
  \ifthenelse{\(\equal{\svnInfoMinRevision}{--minrevision--}\) %
    \OR \( #2 < \svnInfoMinRevision \)}{\def\svnInfoMinRevision{#2}}{}%
  \if $#5 \def\svnInfoOwner{}%$%
          \def\svnId{#1\ #2\ #3\ #4}%
  \else
    \def\svnInfoOwner{#5}%
    \def\svnId{#1\ #2\ #3\ #4\ #5}%
    \expandafter\@svnInfoEat
  \fi
}
\if@svnInfoSVK@
  \def\@svnInfoSplitDate x#1-#2-#3T#4Zr#5x{%
    \@svnInfoDay  =#3\relax
    \@svnInfoMonth=#2\relax
    \@svnInfoYear =#1\relax
    \ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\)
\OR \(   \svnInfoMaxRevision < #5 \)}{%
    \def\svnInfoMaxYear{#1}%
    \def\svnInfoMaxMonth{#2}%
    \def\svnInfoMaxDay{#3}%
  }{}%
}
\else%
  \def\@svnInfoSplitDate x#1-#2-#3r#4x{%
    \@svnInfoDay  =#3\relax
    \@svnInfoMonth=#2\relax
    \@svnInfoYear =#1\relax
\ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\)
\OR \(   \svnInfoMaxRevision < #4 \)}{%
    \def\svnInfoMaxYear{#1}%
    \def\svnInfoMaxMonth{#2}%
    \def\svnInfoMaxDay{#3}%
  }{}%
}
\fi%
\def\@svnInfoToday {%
 \begingroup
   \year  =\@svnInfoYear
   \month =\@svnInfoMonth
   \day   =\@svnInfoDay
   \today
 \endgroup
}
\def\@svnInfoMaxToday {%
 \begingroup
   \year  =\svnInfoMaxYear
   \month =\svnInfoMaxMonth
   \day   =\svnInfoMaxDay
   \today
 \endgroup
}

\def\@svnInfoDefaults {%
  \@svnInfoYear  =\year
  \@svnInfoMonth =\month
  \@svnInfoDay   =\day
  \ifthenelse{\isundefined{\svnInfoMaxYear}}{\def\svnInfoMaxYear{\the\year}}{}
  \ifthenelse{\isundefined{\svnInfoMaxMonth}}{\def\svnInfoMaxMonth{\the\month}}{}
  \ifthenelse{\isundefined{\svnInfoMaxDay}}{\def\svnInfoMaxDay{\the\day}}{}
  \def\svnInfoFile{--sourcefile--}%
  \def\svnInfoHeadURL{--head-url--}%
  \def\svnInfoDate{\the\@svnInfoYear-\two@digits\@svnInfoMonth-%
                   \two@digits\@svnInfoDay}%
  \def\svnInfoTime{--time--}%
  \def\svnInfoRevision{--revision--}%
  \ifthenelse{\isundefined{\svnInfoMinRevision}}{\def\svnInfoMinRevision{--minrevision--}}{}%
  \ifthenelse{\isundefined{\svnInfoMaxRevision}}{\def\svnInfoMaxRevision{--maxrevision--}}{}%
  \def\svnInfoOwner{--owner--}%
  \def\svnInfoYear{\the\@svnInfoYear}%
  \def\svnInfoMonth{\the\@svnInfoMonth}%
  \def\svnInfoDay{\the\@svnInfoDay}%
  \def\svnInfoLongDate{\@svnInfoToday}%
  \def\svnInfoMaxToday{\@svnInfoMaxToday}%
  \def\svnMaxToday{\@svnInfoMaxToday}%
  \def\svnId{\svnInfoFile\ \svnInfoRevision\ \svnInfoTime\ \svnInfoOwner}%
}

\def\@svnInfoFancyFoot {%
    \if@svnInfoRevRange@
      \def\@svnInfoRevisionRange{{ (\svnInfoMinRevision : \svnInfoMaxRevision)}}%
    \else
      \def\@svnInfoRevisionRange{\relax}%
    \fi
  \if@svnInfoLong@
    \def\@svnInfoFancyInfo{{\footnotesize
                           \emph{Rev: \svnInfoRevision\@svnInfoRevisionRange, %
              \svnInfoLongDate}}}%
  \else
    \def\@svnInfoFancyInfo{{\footnotesize
          \emph{Rev: \svnInfoRevision\@svnInfoRevisionRange, %
     \svnInfoDate}}}%
  \fi
  \def\@svnInfoFancyFile{{\footnotesize\emph{\svnInfoFile}}}%
  \if@svnInfoDraft@
  \if@svnInfoUseFancy@
    \rfoot[\fancyplain{\@svnInfoFancyFile}{\@svnInfoFancyFile}]%
          {\fancyplain{\@svnInfoFancyInfo}{\@svnInfoFancyInfo}}%
    \lfoot[\fancyplain{\@svnInfoFancyInfo}{\@svnInfoFancyInfo}]%
          {\fancyplain{\@svnInfoFancyFile}{\@svnInfoFancyFile}}%
    \setlength{\footrulewidth}{0.4pt}%
    \setlength{\plainfootrulewidth}{0.4pt}%
  \fi
  \fi
  \if@svnInfoDraft@
  \if@svnInfoUseFancyhdr@
    \if@twoside
      \fancyfoot[LE,RO]{\@svnInfoFancyInfo}%
      \fancyfoot[LO,RE]{\@svnInfoFancyFile}%
      \fancyfoot[CO,CE]{\thepage}%
      \renewcommand{\footrulewidth}{0.4pt}%
      \fancypagestyle{plain}{%
         \fancyfoot[LE,RO]{\@svnInfoFancyInfo}%
         \fancyfoot[LO,RE]{\@svnInfoFancyFile}%
         \fancyfoot[CO,CE]{\thepage}%
         \renewcommand{\footrulewidth}{0.4pt}%
       }
    \else
      \fancyfoot[L]{\@svnInfoFancyInfo}%
      \fancyfoot[R]{\@svnInfoFancyFile}%
      \fancyfoot[C]{\thepage}%
      \renewcommand{\footrulewidth}{0.4pt}%
      \fancypagestyle{plain}{%
         \fancyfoot[L]{\@svnInfoFancyInfo}%
         \fancyfoot[R]{\@svnInfoFancyFile}%
         \fancyfoot[C]{\thepage}%
         \renewcommand{\footrulewidth}{0.4pt}%
       }
    \fi
  \fi
  \fi
 \if@svnInfoDraft@
\if@svnInfoUseScrpage@
    \clearscrheadfoot%
    \ohead{\headmark}%
    \cfoot[\emph{\@svnInfoFancyInfo}]{\emph{\@svnInfoFancyInfo}}%
    \ifoot[\@svnInfoFancyFile]{\@svnInfoFancyFile}%
    \ofoot[\pagemark]{\pagemark}%
    \pagestyle{scrheadings}%
  \fi
\fi
 \if@svnInfoDraft@
 \if@svnInfoUseEsofoot@
   \AddToShipoutPicture{%
    \setlength{\unitlength}{1mm}%
    \put(5,5){\tiny\svnInfoFile\quad\svnInfoRevision\quad\svnInfoDate%
    \quad\svnInfoTime\quad\svnInfoOwner}%
 }
\fi
\fi
}
\def\@svnInfoMargin{
 \if@svnInfoDraft@
 \if@svnInfoNotPreamble@
 \if@svnInfoUseMargin@
 \expandafter\marginpar[%
 {\raggedleft\tiny\svnInfoFile, \svnInfoRevision, %
   \svnInfoDate, \svnInfoTime, \svnInfoOwner}%
 ]{%
 {\raggedright\tiny\svnInfoFile, \svnInfoRevision, %
   \svnInfoDate, \svnInfoTime, \svnInfoOwner}%
 }%
\fi
\fi
\fi
}
\@svnInfoDefaults

\AtBeginDocument{%
 \@svnInfoNotPreamble@true
 \if@svnInfoDraft@
  \if@svnInfoUseFancy@
    \@svnInfoFancyFoot
  \fi
  \if@svnInfoUseFancyhdr@
    \@svnInfoFancyFoot
  \fi
  \if@svnInfoUseScrpage@
    \@svnInfoFancyFoot
  \fi
  \if@svnInfoUseEsofoot@
    \@svnInfoFancyFoot
  \fi
\fi
}
\AtEndDocument{%
  \immediate\write\@mainaux{\string\gdef\string\svnInfoMinRevision{\svnInfoMinRevision}}%
  \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxRevision{\svnInfoMaxRevision}}%
  \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxDay{\svnInfoMaxDay}}%
  \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxMonth{\svnInfoMaxMonth}}%
  \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxYear{\svnInfoMaxYear}}%
}
\def\svnKeyword $#1${\svn@$#1: $}
\let\svnKeywordempty\relax
\def\svn@$#1: #2${%
  \def\svn@tmp{#2}%
  \ifx\svn@tmp\@empty
    \def\svn@suffix{@unexp}%
  \else
    \def\svn@suffix{@exp}%
  \fi
  \@ifundefined{svnKeyword@#1\svn@suffix}%
      {\@nameuse{svnKeyword@generic\svn@suffix}{#1}{#2}}%
    {\@nameuse{svnKeyword@#1\svn@suffix}{#1}{#2}}%
}
\def\svnKeyword@generic@exp#1#2{%
  \expandafter\svn@set\csname svnKeyword#1\endcsname$#2$%
}
\def\svnKeyword@generic@unexp#1#2{%
  \expandafter\global\expandafter\let\csname svnKeyword#1\endcsname\svnKeywordempty
}
\def\svn@set#1$#2 : ${\gdef#1{#2}}
\def\svnKeyword@Date@unexp#1#2{}%
\let\svnKeyword@LastChangedDate@unexp\svnKeyword@Date@unexp%
\def\svnKeyword@Date@exp#1#2{%
  \svn@parse@date$#2$%
}%
\let\svnKeyword@LastChangedDate@exp\svnKeyword@Date@exp
\if@svnInfoSVK@
  \def\svn@parse@date$#1-#2-#3T#4:#5:#6.#7${%
    \@svnInfoDay  =#3\relax%
    \@svnInfoMonth=#2\relax%
    \@svnInfoYear =#1\relax%
    \def\svnInfoLongDate{\@svnInfoToday}%
    \if@svnInfoToday@
      \year  =\@svnInfoYear
      \month =\@svnInfoMonth
      \day   =\@svnInfoDay
    \fi
     \def\svnInfoTime{#4:#5:#6}%
   }
\else
\def\svn@parse@date$#1-#2-#3 #4:#5:#6 #7${%

  \@svnInfoDay  =#3\relax%
  \@svnInfoMonth=#2\relax%
  \@svnInfoYear =#1\relax%
    \def\svnInfoLongDate{\@svnInfoToday}%
    \if@svnInfoToday@
      \year  =\@svnInfoYear
      \month =\@svnInfoMonth
      \day   =\@svnInfoDay
    \fi
     \def\svnInfoTime{#4:#5:#6}%
  }
\fi

\def\svnKeyword@Id@unexp#1#2{}%
\def\svnKeyword@Id@exp#1#2{%
  \svn@parse@id$#2$
}%
\def\svn@parse@id$#1 : ${%
  \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $ %
}%

\def\svnKeyword@Author@unexp#1#2{}%
\let\svnKeyword@LastChangedBy@unexp\svnKeyword@Author@unexp%
\def\svnKeyword@Author@exp#1#2{%
  \svn@parse@Author$#2$
}%
\def\svn@parse@Author$#1 : ${%
  \def\svnInfoOwner{#1}%
}%
\let\svnKeyword@LastChangedBy\svnKeyword@Author@exp%

\def\svnKeyword@Revision@unexp#1#2{}%
\let\svnKeyword@LastChangedRevision@unexp\svnKeyword@Revision@unexp%
\let\svnKeyword@Rev@unexp\svnKeyword@Revision@unexp%
\def\svnKeyword@Revision@exp#1#2{%
  \svn@parse@Revision$#2$%
}%
\def\svn@parse@Revision$#1 : ${%
  \def\svnInfoRevision{#1}%
    \ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\) %
    \OR \(#1 > \svnInfoMaxRevision \)}{\def\svnInfoMaxRevision{#1}}{}%
  \ifthenelse{\(\equal{\svnInfoMinRevision}{--minrevision--}\) %
    \OR \( #1 < \svnInfoMinRevision \)}{\def\svnInfoMinRevision{#1}}{}%
}%
\let\svnKeyword@LastChangedRevision@exp\svnKeyword@Revision@exp%
\let\svnKeyword@Rev@unexp\svnKeyword@Revision@exp%

\def\svnKeyword@HeadURL@unexp#1#2{}%
\let\svnKeyword@URL@unexp\svnKeyword@HeadURL@unexp%
\def\svnKeyword@HeadURL@exp#1#2{%
  \svn@parse@HeadURL$#2$%
}%
\def\svn@parse@HeadURL$#1 : ${%
  \def\svnInfoHeadURL{#1}%
}%
\let\svnKeyword@URL@exp\svnKeyword@HeadURL@exp%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%
%% End of file `svninfo.sty'.
