%%
%% 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.
%% A PERL-package supporting svninfo and LaTeX2HTML is provieded too.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%% Copyright (C) 2003-2005 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{345}
%% \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}[2005/09/29 v0.3]
\newcount\@svnInfoDay
\newcount\@svnInfoMonth
\newcount\@svnInfoYear
\newcount\@svnInfoYearTmp
\newcount\@svnInfoMonthTmp
\newcount\@svnInfoDayTmp
\newif\if@svnInfoToday@
\DeclareOption{today}{
  \@svnInfoToday@true
}
\DeclareOption{notoday}{
  \@svnInfoToday@false
}
\newif\if@svnInfoUseFancyhdr@
\DeclareOption{fancy}{
  \@svnInfoUseFancyhdr@false
}
\DeclareOption{fancyhdr}{
  \@svnInfoUseFancyhdr@true
}
\DeclareOption{nofancy}{
  \@svnInfoUseFancyhdr@false
}
\newif\if@svnInfoLong@
\DeclareOption{long}{
  \@svnInfoLong@true
}
\DeclareOption{short}{
  \@svnInfoLong@false
}
\ExecuteOptions{today,long}
\IfFileExists{svninfo.cfg}{\input{svninfo.cfg}}{}
\ProcessOptions
\if@svnInfoUseFancyhdr@
    \RequirePackage{fancyhdr}
\fi
\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}
\newif\if@svnInfoColonIsActive@

\def\svnInfo {
   \catcode`\_=13
   \ifnum\catcode`\:=13
      \@svnInfoColonIsActive@true
      \catcode`:=12
   \else
      \@svnInfoColonIsActive@false
   \fi
   \@svnInfoReadArgs
}

\def\@svnInfoReadArgs #1Id#2 {
  \@svnInfoDefaults
  \if $#2 \let \@svnInfoNext = \@svnInfoEat
  \else   \let \@svnInfoNext = \@svnInfoEatColon
  \fi
  \if@svnInfoColonIsActive@
     \catcode`:=13
  \fi
  \@svnInfoNext $Id#2
}

\def\@svnInfoEat #1 {\catcode`\_=8}

\def\@svnInfoEatColon  $Id:#1 {
  \if $#1 \let \@svnInfoNext = \@svnInfoEat
  \else   \let \@svnInfoNext = \@svnInfoCrackAndEat
  \fi
  \@svnInfoNext #1
}

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

\def\@svnInfoCrackString #1 #2 #3 #4 #5 {
  \def\svnInfoFile{#1}
  \def\svnInfoRevision{#2}
  \def\svnInfoTime{#4}
  \if $#5 \let \@svnInfoNext = \relax
           \def\svnInfoOwner{}
           \def\svnId{#1\ #2\ #3\ #4}
  \else   \let \@svnInfoNext = \@svnInfoEat
           \def\svnInfoOwner{#5}
           \def\svnId{#1\ #2\ #3\ #4\ #5}
  \fi
  \write\@mainaux{\string\def\string\svnInfoFILE{#1}}
  \write\@mainaux{\string\def\string\svnInfoREVISION{#2}}
  \write\@mainaux{\string\def\string\svnInfoTIME{#4}}
  \write\@mainaux{\string\def\string\svnInfoOWNER{#5}}

  \catcode`\_=8
  \@svnInfoSplitDate x#3x
  \def\svnInfoLongDate{\@svnInfoToday}
  \if@svnInfoToday@
    \year  = \@svnInfoYear
    \month = \@svnInfoMonth
    \day   = \@svnInfoDay
  \fi
}
\def\@svnInfoSplitDate x#1-#2-#3x{
  \@svnInfoDay  = #3
  \@svnInfoMonth= #2
  \@svnInfoYear = #1
  \write\@mainaux{\string\def\string\svnInfoDAY{#3}}
  \write\@mainaux{\string\def\string\svnInfoMONTH{#2}}
  \write\@mainaux{\string\def\string\svnInfoYEAR{#1}}
}
\def\@svnInfoToday {%
   \@svnInfoYearTmp  = \year
   \@svnInfoMonthTmp = \month
   \@svnInfoDayTmp   = \day
   \year  = \@svnInfoYear
   \month = \@svnInfoMonth
   \day   = \@svnInfoDay
   \today%
   \year  = \@svnInfoYearTmp
   \month = \@svnInfoMonthTmp
   \day   = \@svnInfoDayTmp
}
\def\@svnInfoDefaults {
  \@svnInfoYear  = \year
  \@svnInfoMonth = \month
  \@svnInfoDay   = \day
  \def\svnInfoFile{--sourcefile--}
  \def\svnInfoDate{\the\@svnInfoYear-\two@digits\@svnInfoMonth-%
                   \two@digits\@svnInfoDay}
  \def\svnInfoTime{--time--}
  \def\svnInfoRevision{--revision--}
  \def\svnInfoOwner{--owner--}
  \def\svnInfoYear{\the\@svnInfoYear}
  \def\svnInfoMonth{\the\@svnInfoMonth}
  \def\svnInfoDay{\the\@svnInfoDay}
  \def\svnInfoLongDate{\@svnInfoToday}
  \def\svnId{\svnInfoFile\ \svnInfoRevision\ \svnInfoTime\ \svnInfoOwner}
}
\def\@svnInfoFancyFoot {
  \if@svnInfoLong@
    \def\@svnInfoFancyInfo{{\footnotesize%
                           \emph{Rev: \svnInfoRevision,
              \svnInfoLongDate}}}
  \else
    \def\@svnInfoFancyInfo{{\footnotesize%
                          \emph{Rev: \svnInfoRevision,
     \svnInfoDate}}}
  \fi
  \def\@svnInfoFancyFile{{\footnotesize\emph{\svnInfoFile}}}
  \if@svnInfoUseFancyhdr@
    \if@twoside
    \fancyfoot[LE,RO]{\@svnInfoFancyInfo}
    \fancyfoot[LO,RE]{\@svnInfoFancyFile}
    \fancyfoot[CO,CE]{\thepage}
    \else
    \fancyfoot[L,RO]{\@svnInfoFancyInfo}
    \fancyfoot[LO,R]{\@svnInfoFancyFile}
    \fancyfoot[C]{\thepage}
    \fi
    \renewcommand{\footrulewidth}{0.4pt}
    \if@twoside
    \fancypagestyle{plain}{%
       \fancyfoot[LE,RO]{\@svnInfoFancyInfo}
       \fancyfoot[LO,RE]{\@svnInfoFancyFile}
       \fancyfoot[CO,CE]{\thepage}
       \renewcommand{\footrulewidth}{0.4pt}
    }
    \else
      \fancypagestyle{plain}{%
         \fancyfoot[L,RO]{\@svnInfoFancyInfo}
         \fancyfoot[LO,R]{\@svnInfoFancyFile}
         \fancyfoot[C]{\thepage}
         \renewcommand{\footrulewidth}{0.4pt}
       }
    \fi
  \fi
}

\@svnInfoDefaults

\AtBeginDocument{
  \if@svnInfoUseFancyhdr@
    \@svnInfoFancyFoot
  \fi
}
\endinput
%%
%% End of file `svninfo.sty'.
