%%
%% This is file `refcount.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% refcount.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Project: refcount
%% Version: 2010/12/01 v3.2
%% 
%% Copyright (C) 1998, 2000, 2006, 2008, 2010 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and 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".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% This work consists of the main source file refcount.dtx
%% and the derived files
%%    refcount.sty, refcount.pdf, refcount.ins, refcount.drv,
%%    refcount-test1.tex, refcount-test2.tex, refcount-test3.tex,
%%    refcount-test4.tex.
%% 
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode35=6 % #
  \catcode39=12 % '
  \catcode44=12 % ,
  \catcode45=12 % -
  \catcode46=12 % .
  \catcode58=12 % :
  \catcode64=11 % @
  \catcode123=1 % {
  \catcode125=2 % }
  \expandafter\let\expandafter\x\csname ver@refcount.sty\endcsname
  \ifx\x\relax % plain-TeX, first loading
  \else
    \def\empty{}%
    \ifx\x\empty % LaTeX, first loading,
      % variable is initialized, but \ProvidesPackage not yet seen
    \else
      \expandafter\ifx\csname PackageInfo\endcsname\relax
        \def\x#1#2{%
          \immediate\write-1{Package #1 Info: #2.}%
        }%
      \else
        \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
      \fi
      \x{refcount}{The package is already loaded}%
      \aftergroup\endinput
    \fi
  \fi
\endgroup%
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode35=6 % #
  \catcode39=12 % '
  \catcode40=12 % (
  \catcode41=12 % )
  \catcode44=12 % ,
  \catcode45=12 % -
  \catcode46=12 % .
  \catcode47=12 % /
  \catcode58=12 % :
  \catcode64=11 % @
  \catcode91=12 % [
  \catcode93=12 % ]
  \catcode123=1 % {
  \catcode125=2 % }
  \expandafter\ifx\csname ProvidesPackage\endcsname\relax
    \def\x#1#2#3[#4]{\endgroup
      \immediate\write-1{Package: #3 #4}%
      \xdef#1{#4}%
    }%
  \else
    \def\x#1#2[#3]{\endgroup
      #2[{#3}]%
      \ifx#1\@undefined
        \xdef#1{#3}%
      \fi
      \ifx#1\relax
        \xdef#1{#3}%
      \fi
    }%
  \fi
\expandafter\x\csname ver@refcount.sty\endcsname
\ProvidesPackage{refcount}%
  [2010/12/01 v3.2 Data extraction from references (HO)]%
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode123=1 % {
  \catcode125=2 % }
  \catcode64=11 % @
  \def\x{\endgroup
    \expandafter\edef\csname rc@AtEnd\endcsname{%
      \endlinechar=\the\endlinechar\relax
      \catcode13=\the\catcode13\relax
      \catcode32=\the\catcode32\relax
      \catcode35=\the\catcode35\relax
      \catcode61=\the\catcode61\relax
      \catcode64=\the\catcode64\relax
      \catcode123=\the\catcode123\relax
      \catcode125=\the\catcode125\relax
    }%
  }%
\x\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
\catcode35=6 % #
\catcode64=11 % @
\catcode123=1 % {
\catcode125=2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\rc@AtEnd{%
    \rc@AtEnd
    \catcode#1=\the\catcode#1\relax
  }%
  \catcode#1=#2\relax
}
\TMP@EnsureCode{33}{12}% !
\TMP@EnsureCode{39}{12}% '
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{93}{12}% ]
\TMP@EnsureCode{96}{12}% `
\edef\rc@AtEnd{\rc@AtEnd\noexpand\endinput}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
  \input ltxcmds.sty\relax
  \input infwarerr.sty\relax
\else
  \RequirePackage{ltxcmds}[2010/04/08]%
  \RequirePackage{infwarerr}[2010/04/08]%
\fi
\ltx@IfUndefined{@ifdefinable}{%
  \def\rc@IfDefinable#1{%
    \ifx#1\ltx@undefined
      \expandafter\ltx@firstofone
    \else
      \ifx#1\relax
        \expandafter\expandafter\expandafter\ltx@firstofone
      \else
        \@PackageError{refcount}{%
          Command \string#1 is already defined.\MessageBreak
          It will not redefined by this package%
        }\@ehc
        \expandafter\expandafter\expandafter\ltx@gobble
      \fi
    \fi
  }%
}{%
  \let\rc@IfDefinable\@ifdefinable
}
\ltx@IfUndefined{protected}{%
  \ltx@IfUndefined{DeclareRobustCommand}{%
    \def\rc@RobustDefOne#1#2#3#4{%
      \rc@IfDefinable#3{%
        #1\def#3##1{#4}%
      }%
    }%
  }{%
    \def\rc@RobustDefOne#1#2#3#4{%
      \rc@IfDefinable#3{%
        \DeclareRobustCommand#2#3[1]{#4}%
      }%
    }%
  }%
}{%
  \def\rc@RobustDefOne#1#2#3#4{%
    \rc@IfDefinable#3{%
      \protected#1\def#3##1{#4}%
    }%
  }%
}
\ltx@IfUndefined{newcommand}{%
  \def\rc@newcommand*#1[#2]#3{% hash-ok
    \rc@IfDefinable#1{%
      \ifcase#2 %
        \def#1{#3}%
      \or
        \def#1##1{#3}%
      \or
        \def#1##1##2{#3}%
      \else
        \rc@InternalError
      \fi
    }%
  }%
}{%
  \let\rc@newcommand\newcommand
}
\rc@RobustDefOne\long{}\setrefcountdefault{%
  \def\rc@default{#1}%
}
\setrefcountdefault{0}
\ltx@IfUndefined{G@refundefinedtrue}{%
  \rc@RobustDefOne{}{*}\refused{%
    \begingroup
      \csname @safe@activestrue\endcsname
      \ltx@IfUndefined{r@#1}{%
        \protect\G@refundefinedtrue
        \rc@WarningUndefined{#1}%
      }{}%
    \endgroup
  }%
}{%
  \rc@RobustDefOne{}{*}\refused{%
    \begingroup
      \csname @safe@activestrue\endcsname
      \ltx@IfUndefined{r@#1}{%
        \csname protect\expandafter\endcsname
        \csname G@refundefinedtrue\endcsname
        \rc@WarningUndefined{#1}%
      }{}%
    \endgroup
  }%
}
\ltx@IfUndefined{@latex@warning}{%
  \def\rc@WarningUndefined#1{%
    \ltx@ifundefined{thepage}{%
      \def\thepage{\number\count0 }%
    }{}%
    \@PackageWarning{refcount}{%
      Reference `#1' on page \thepage\space undefined%
    }%
  }%
}{%
  \def\rc@WarningUndefined#1{%
    \@latex@warning{%
      Reference `#1' on page \thepage\space undefined%
    }%
  }%
}
\def\rc@set#1#2#3#4{%
  \begingroup
    \csname @safe@activestrue\endcsname
    \rc@refused{#4}%
    \expandafter\rc@@set\csname r@#4\endcsname{#1}{#2}{#3}%
  \endgroup
}
\def\rc@@set#1#2#3#4{%
  \ifx#1\relax
    #2{#4}{\rc@default}%
  \else
    #2{#4}{%
      \expandafter#3#1\rc@default\rc@default\@nil
    }%
  \fi
}
\rc@newcommand*{\setcounterref}[0]{%
  \rc@set\setcounter\ltx@car
}
\rc@newcommand*{\addtocounterref}[0]{%
  \rc@set\addtocounter\ltx@car
}
\rc@newcommand*{\setcounterpageref}[0]{%
  \rc@set\setcounter\ltx@cartwo
}
\rc@newcommand*{\addtocounterpageref}[0]{%
  \rc@set\addtocounter\ltx@cartwo
}
\rc@newcommand*{\getrefnumber}[1]{%
  \romannumeral
  \ltx@ifundefined{r@#1}{%
    \expandafter\ltx@zero
    \rc@default
  }{%
    \expandafter\expandafter\expandafter\rc@extract@
    \expandafter\expandafter\expandafter!%
    \csname r@#1\expandafter\endcsname
    \expandafter{\rc@default}\@nil
  }%
}
\rc@newcommand*{\getpagerefnumber}[1]{%
  \romannumeral
  \ltx@ifundefined{r@#1}{%
    \expandafter\ltx@zero
    \rc@default
  }{%
    \expandafter\expandafter\expandafter\rc@extract@page
    \expandafter\expandafter\expandafter!%
    \csname r@#1\expandafter\expandafter\expandafter\endcsname
    \expandafter\expandafter\expandafter{%
      \expandafter\rc@default
    \expandafter}\expandafter{\rc@default}\@nil
  }%
}
\rc@newcommand*{\getrefbykeydefault}[2]{%
  \romannumeral
  \expandafter\rc@getrefbykeydefault
    \csname r@#1\expandafter\endcsname
    \csname rc@extract@#2\endcsname
}
\long\def\rc@getrefbykeydefault#1#2#3{%
  \ifx#1\relax
    % reference is undefined
    \ltx@ReturnAfterElseFi{%
      \ltx@zero
      #3%
    }%
  \else
    \ltx@ReturnAfterFi{%
      \ifx#2\relax
        % extract method is missing
        \ltx@ReturnAfterElseFi{%
          \ltx@zero
          #3%
        }%
      \else
        \ltx@ReturnAfterFi{%
          \expandafter
          \rc@generic#1{#3}{#3}{#3}{#3}{#3}\@nil#2{#3}%
        }%
      \fi
    }%
  \fi
}
\long\def\rc@generic#1#2\@nil#3#4{%
  #3{#1\TR@TitleReference\@empty{#4}\@nil}{#1}#2\@nil
}
\long\def\rc@extract@#1#2#3\@nil{%
  \ltx@zero
  #2%
}
\long\def\rc@extract@page#1#2#3#4\@nil{%
  \ltx@zero
  #3%
}
\long\def\rc@extract@name#1#2#3#4#5\@nil{%
  \ltx@zero
  #4%
}
\long\def\rc@extract@anchor#1#2#3#4#5#6\@nil{%
  \ltx@zero
  #5%
}
\long\def\rc@extract@url#1#2#3#4#5#6#7\@nil{%
  \ltx@zero
  #6%
}
\long\def\rc@extract@title#1#2\@nil{%
  \rc@@extract@title#1%
}
\long\def\rc@@extract@title#1\TR@TitleReference#2#3#4\@nil{%
  \ltx@zero
  #3%
}
\rc@newcommand*{\IfRefUndefinedExpandable}[1]{%
  \ltx@ifundefined{r@#1}\ltx@firstoftwo\ltx@secondoftwo
}
\rc@RobustDefOne{}*\IfRefUndefinedBabel{%
  \begingroup
    \csname safe@actives@true\endcsname
  \expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname r@#1\endcsname\relax
    \expandafter\ltx@firstoftwo
  \else
    \expandafter\ltx@secondoftwo
  \fi
}
\rc@AtEnd%
\endinput
%%
%% End of file `refcount.sty'.
