%%
%% This is file `snapshot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% snapshot.dtx 
%% 
%%% ====================================================================
%%%  @LaTeX-doc-source-file{
%%%     filename        = "snapshot.dtx",
%%%     version         = "1.14",
%%%     date            = "2002/03/05",
%%%     time            = "15:29:00 EST",
%%%     checksum        = "39090 807 3449 29761",
%%%     author          = "American Mathematical Society",
%%%     copyright       = "Copyright 2001 American Mathematical Society,
%%%                        all rights reserved.  Copying of this file is
%%%                        authorized only if either:
%%%                        (1) you make absolutely no changes to your copy,
%%%                        including name; OR
%%%                        (2) if you do make changes, you first rename it
%%%                        to some other name.",
%%%     address         = "American Mathematical Society,
%%%                        Electronic Products and Services,
%%%                        PO Box 6248,
%%%                        Providence, RI 02940,
%%%                        USA",
%%%     email           = "tech-support@ams.org",
%%%     URL             = "http://www.ams.org/",
%%%     supported       = "yes",
%%%     keywords        = "version, compatibility, dependencies, LaTeX",
%%%     abstract        = "This package provides a way for a LaTeX
%%%                        document to specify, for each external file
%%%                        on which the document depends, which version
%%%                        is required to guarantee output fidelity.",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{snapshot}[2002/03/05 v1.14]
\let\@xp\expandafter \let\@nx\noexpand
\newcommand{\RequireVersions}[2][]{%
  \let\snap@check\snap@compare@versions
  \let\snap@selfcheck\snap@selfcheck@a
  \@ifnextchar *\snap@store@version\snap@store@error#2*{end}{}{}%
}
\@onlypreamble\RequireVersions
\def\snap@store@error#1{%
  \PackageError{snapshot}{Expected '*' here, not '#1'}\@ehc
}
\@onlypreamble\snap@store@error
\def\snap@store@version #1#2#3#4{%
  \@xp\snap@store@b\csname snapx@#2\endcsname{#2}{#3}{#4}%
}
\@onlypreamble\snap@store@version
\def\@fmtextension{fmt}
\def\@tfmextension{tfm}
\edef\snapx@package{.\@pkgextension}
\edef\snapx@class{.\@clsextension}
\edef\snapx@format{.\@fmtextension}
\edef\snapx@tfm{.\@tfmextension}
\long\def\snapx@application{}
\let\snap@file=\@empty
\let\snapx@end\@@end
\def\snap@store@b#1#2#3#4{%
  \ifx#1\snapx@end
    \@xp\@gobblefour
  \else
    \ifx#1\relax \let#1\@empty\fi
    \def\@tempa##1 ##2 ##3\@nil{##1 ##2}%
    \ifx#1\snapx@application
    \else
      \xdef\rqv@list{\rqv@list
        \ifx\@empty\rqv@list\else,\fi
        #3#1%
      }%
    \fi
    \@xp\xdef\csname rqv@#3#1\endcsname{\@tempa#4 v?.? ? \relax\@nil}%
    \ifx#1\snapx@format \snap@check{#3.fmt}%
    \else \snap@selfcheck{#3.sty}%
    \fi
  \fi
  \@ifnextchar *\snap@store@version\snap@store@error
}
\@onlypreamble\snap@store@b
\def\snap@write{\immediate\write\snap@out}
\let\snap@out\sixt@@n % fallback, probably never used
\DeclareOption{dep}{%
  \def\snap@write{\immediate\write\snap@out}%
}
\DeclareOption{log}{%
  \let\snap@write\typeout
}
\let\snap@fake@b\relax
\DeclareOption{test}{%
  \def\snap@fake@b{\endinput \futurelet\@let@token\snap@ignoline}%
}
\DeclareOption{tfm}{%
  \typeout{Option 'tfm' not implemented yet [1999/09/23]}%
}
\def\snap@mismatch@warning#1#2#3{\PackageWarningNoLine{#1}{#2}}
\def\snap@mismatch{\snap@mismatch@warning}
\DeclareOption{error}{%
  \def\snap@mismatch{\PackageError}%
  \ifx\snap@select\@empty \let\snap@select\snap@select@all \fi
}
\DeclareOption{warning}{%
  \def\snap@mismatch{\snap@mismatch@warning}%
  \ifx\snap@select\@empty \let\snap@select\snap@select@all \fi
}
\def\snap@select@all#1#2 #3#4 #5\@nil{#1#2 #3#4}
\let\snap@select\@empty
\DeclareOption{date}{%
  \def\snap@select#1#2 #3\@nil{#1#2}%
}
\def\snap@select@version#1{%
  \ifodd 0#11 \@xp\snap@sva\@xp#1\else\@xp\snap@select@version\fi
}
\def\snap@sva#1.#2 #3\@nil{#1.#2}
\def\snap@select@major#1{%
  \ifodd 0#11 \@xp\snap@svm\@xp#1\else\@xp\snap@select@major\fi
}
\def\snap@svm#1.#2\@nil{#1}
\DeclareOption{version}{%
  \def\snap@select#1#2 #3{\snap@select@version #3}%
}
\DeclareOption{major-version}{%
  \def\snap@select#1#2 #3{\snap@select@major #3}%
}
\ProcessOptions\par
\edef\snap@restore@extensions{%
  \def\@nx\@pkgextension{\@pkgextension}%
  \def\@nx\@clsextension{\@clsextension}%
}
\def\snap@pad#1#2#3#4#5#6#7#8#9{\snap@pad@a{#1#2#3#4#5#6#7#8#9}}
\def\snap@pad@a#1#2#3#4#5\@nil{\snap@pad@b#1#2#3#4\space\@nil}
\def\snap@pad@b#1\space#2\@nil#3{\def#3{#2}}
\def\snap@trim@version#1#2 #3{#1#2 \snap@trim@b #3}
\def\snap@trim@b#1{\ifodd 0#11 v#1\@xp\snap@trim@c\fi \snap@trim@b}
\def\snap@trim@c#1#2 #3\@nil{#2}
\let\rqv@list=\@empty
\edef\@tempc#1\fmtname{#1\fmtname}\@tempc
\def\@tempa#1,\fmtname.fmt,#2#3\@nil{#2}
\edef\@tempb{\@nx\@tempa,\@filelist,\fmtname.fmt,}
\if ?\@tempb?\@nil
  \edef\@filelist{\fmtname.fmt,\@filelist}%
  \def\@tempc{LaTeX2e}%
  \@xp\edef\csname ver@\fmtname.fmt\endcsname{%
    \fmtversion\space
    v\ifx\@tempc\fmtname 2.e\else ?.?\fi
  }%
\fi
\listfiles
\def\@dofilelist{%
  \snap@restore@extensions
  \ifx\rqv@list\@empty
  \else \rqv@compare@lists
  \fi
  \ifx\snap@write\typeout
  \else
    \newwrite\snap@out
    \immediate\openout\snap@out=\jobname.dep \relax
  \fi
  \snap@write{\string\RequireVersions\@charlb}%
  \snap@write{\space\space *{application}{TeX}%
             \space\space\space\space\space{1990/03/25 v3.x}}%
  \@for\@currname:=\@filelist\do{%
    \filename@parse\@currname
    \ifx\filename@ext\relax
      \def\@tempa{file}\def\@tempd{.tex}\def\filename@ext{tex}%
      \def\@tempb{~~~}%
    \else\ifx\filename@ext\@pkgextension
      \def\@tempa{package}\let\@tempd\@empty
      \def\@tempb{}%
    \else\ifx\filename@ext\@clsextension
      \def\@tempa{class}\let\@tempd\@empty
      \def\@tempb{~~}%
    \else\ifx\filename@ext\@fmtextension
      \def\@tempa{format}\let\@tempd\@empty
      \def\@tempb{~}%
    \else\ifx\filename@ext\@tfmextension
      \def\@tempa{tfm}\let\@tempd\@empty
      \def\@tempb{~~~~}%
    \else
      \def\@tempa{file}\edef\@tempd{.\filename@ext}%
      \def\@tempb{~~~}%
    \fi\fi\fi\fi\fi
    \@xp\let\@xp\@tempe
      \csname ver@\filename@base.\filename@ext\endcsname
    \ifx\@tempe\@empty \let\@tempe\relax \fi
    \edef\@tempe{%
      \ifx\@tempe\relax 0000/00/00 v0.0%
      \else
        \@xp\@xp\@xp\snap@trim@version\@xp\@tempe\space v0.0 v0.0 \@nil
      \fi
    }%
    \edef\@tempc{\filename@area\filename@base\@tempd}% full file name
    \@xp\snap@pad\@tempc\space~~~~~~~~~~~~~~~~\@nil\@tempd
    \begingroup \let~\space
      \snap@write{\space\space *{\@tempa}\@tempb{\@tempc}\@tempd{\@tempe}}%
    \endgroup
  }%
  \snap@write{\@charrb}%
  \ifx\snap@write\typeout
  \else \immediate\closeout\snap@out
    \typeout{Dependency list written on \jobname.dep.}%
  \fi
}%
\def\rqv@condense#1,{%
  \if ,#1,%
  \else
    \@xp\ifx\csname ver@#1\endcsname\N
    \else
      \edef\L{\L,#1}%
      \@xp\let\csname ver@#1\endcsname=\N
    \fi
  \fi
  \rqv@condense
}
\def\rqv@compare@lists{%
  \begingroup
  \def\N{1}\let\L=\@gobble
  \@xp\rqv@condense \rqv@list,TeX,{,\relax\@xp\@gobbletwo\@xp},%
  \ifx\L\@gobble\let\L\@empty\fi
  \let\rqv@list=\L
  \let\L=\@gobble
  \@xp\rqv@condense \@filelist,{,\relax\@xp\@gobbletwo\@xp},%
  \ifx\L\@gobble\let\L\@empty\fi
  \@for\@currname:=\L\do{%
    \snap@mismatch{snapshot}{^^J%
      File \@currname\space loaded though not in
      \noexpand\RequireVersions list%
    }\@ehc
  }%
  \def\N{2}\let\L=\@gobble
  \@xp\rqv@condense\@filelist,TeX,{,\relax\@xp\@gobbletwo\@xp},%
  \let\L=\@gobble
  \@xp\rqv@condense\rqv@list,{,\relax\@xp\@gobbletwo\@xp},%
  \ifx\L\@gobble\let\L\@empty\fi
  \@for\@currname:=\L\do{%
    \snap@mismatch{snapshot}{^^J%
      File \@currname\space [\csname rqv@\@currname\endcsname]
      required but not loaded%
    }\@ehc
  }%
  \endgroup
}
\begingroup \catcode\endlinechar=12\relax %
\long\gdef\snap@ignoline#1
{}\endgroup %
\def\snap@fake@input#1#2#3#4{%
  \ifx#1\snapx@end
    \aftergroup\@@end \@xp\@gobblefour
  \else
    \ifx#1\snapx@format
    \else
      \message{^^J}%
      \@xp\snap@fake@b\@@input #3#1\relax
    \fi
  \fi
  \@ifnextchar *\snap@store@version\snap@store@error
}
\newcommand{\rqvTest}[2][]{%
  \begingroup \catcode\endlinechar=12
  \catcode`\%=12 \catcode`\{=12 \catcode`\}=12\relax
  \let\snapx@application=\snapx@format \let\snapx@tfm=\snap@format
  \@ifnextchar *\snap@store@version\snap@store@error#2*{end}{}{}%
  \endgroup
}
\@ifundefined{snap@fake@b}{}{%
  \let\snap@store@b\snap@fake@input
  \let\RequireVersions\rqvTest
}
\AtBeginDocument{%
  \@ifundefined{ver@amsgen}{}{%
    \@xp\let\csname ver@amsgen.sty\@xp\endcsname
                    \csname ver@amsgen\endcsname
  }%
}
\let\snap@compare@versions\@gobble \let\snap@check\@gobble
\let\snap@selfcheck\@gobble \let\snap@selfcheck@a\@gobble
\ifx\snap@select\@empty \endinput \fi
\begingroup \catcode`\.=11\relax
\gdef\snap@selfcheck@b#1\rqv@snapshot.sty#2#3\@nil{T#2}
\gdef\snap@selfcheck@a#1{%
  \if\@xp\snap@selfcheck@b\csname rqv@#1\endcsname T%
         \rqv@snapshot.sty F\@nil
    \snap@check{#1}%
  \fi
}
\endgroup
\def\@nofmt#1.fmt.#2 {#1 }
\def\snap@mismatch@a#1#2#3{%
  \snap@mismatch{snapshot}{^^J%
    \space\space Required version #2 of \@nofmt#1.fmt. and^^J%
    \space\space provided version #3 do not match%
  }\@ehc
}
\def\snap@compare@versions#1{%
  \begingroup
    \@ifundefined{rqv@#1}{}{%
      \edef\0{\csname rqv@#1\endcsname}%
      \edef\1{\csname ver@#1\endcsname}%
      \edef\1{\@xp\snap@trim@version\1 v0.0 v0.0 \@nil}%
      \edef\@tempa{\@xp\snap@select\0 v0.0 v0.0 \@nil}%
      \edef\@tempb{\@xp\snap@select\1 v0.0 v0.0 \@nil}%
      \ifx\@tempa\@tempb
      \else
        \edef\@tempd{\@nx\snap@mismatch@a{#1}{\@tempa}{\@tempb}}%
        \@xp\@tempd
      \fi
    }%
  \endgroup
}
\def\ProvidesFile#1{%
  \def\snap@checker{\snap@check{#1}}%
  \begingroup
    \aftergroup\snap@checker
    \catcode`\ 10\catcode\endlinechar 10 %
    \@makeother\/%
    \@makeother\&%
    \@ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}%
}
\def\@pr@videpackage[#1]{%
  \expandafter\xdef\csname ver@\@currname.\@currext\endcsname{#1}%
  \ifx\@currext\@clsextension
    \typeout{Document Class: \@gtempa\space#1}%
  \else
    \wlog{Package: \@gtempa\space#1}%
  \fi
  \snap@check{\@currname.\@currext}%
}
\endinput
%%
%% End of file `snapshot.sty'.
