%%
%% This is file `zref-base.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% zref.dtx  (with options: `base')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2006, 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.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".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% This work consists of the main source file zref.dtx
%% and the derived files
%%    zref.sty, zref.pdf, zref.ins, zref.drv,
%%    zref-base.sty, zref-abspage.sty, zref-counter.sty,
%%    zref-dotfill.sty, zref-hyperref.sty, zref-lastpage.sty,
%%    zref-perpage.sty, zref-savepos.sty, zref-titleref.sty,
%%    zref-totpages.sty, zref-user.sty, zref-xr.sty,
%%    zref-example.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-base}%
  [2007/02/18 Module base for zref (HO)]
\def\ZREF@name{zref}
\def\ZREF@ErrorNoLine#1#2{%
  \begingroup
    \let\on@line\@empty
    \PackageError\ZREF@name{#1}{#2}%
  \endgroup
}
\def\ZREF@UpdatePdfTeX{Update pdfTeX.}
\newif\ifZREF@found
\def\ZREF@patch#1{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname #1\endcsname\relax
    \expandafter\@gobble
  \else
    \expandafter\let\csname ZREF@org@#1\expandafter\endcsname
    \csname #1\endcsname
    \expandafter\@firstofone
  \fi
}
\begingroup
  \@ifundefined{eTeXversion}{%
    \ZREF@ErrorNoLine{%
      Missing support for eTeX; package is abandoned%
    }{%
      Use a TeX compiler that support eTeX and enable eTeX %
      in the format.%
    }%
    \endgroup
    \endinput
  }{}
\endgroup
\RequirePackage{auxhook}
\AddLineBeginAux{%
  \string\providecommand\string\zref@newlabel[2]{}%
}
\def\zref@newlabel{%
  \@newl@bel{Z@R}%
}
\def\zref@newlist#1{%
  \zref@iflistundefined{#1}{%
    \@ifdefinable{Z@L@#1}{%
     \global\expandafter\let\csname Z@L@#1\endcsname\@empty
     \PackageInfo{zref}{New property list: #1}%
    }%
  }{%
    \PackageError\ZREF@name{%
      Property list `#1' already exists%
    }\@ehc
  }%
}
\def\zref@iflistundefined#1{%
  \expandafter\ifx\csname Z@L@#1\endcsname\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\def\zref@listexists#1{%
  \zref@iflistundefined{#1}{%
    \PackageError\ZREF@name{%
      Property list `#1' does not exist%
    }\@ehc
  }%
}
\def\zref@listcontainsprop#1{%
  \expandafter\ZREF@listcontainsprop\csname Z@L@#1\endcsname
}
\def\ZREF@listcontainsprop#1#2{%
  \begingroup
    \ZREF@foundfalse
    \edef\y{#2}%
    \@tfor\x:=#1\do{%
      \edef\x{\x}%
      \ifx\x\y
        \ZREF@foundtrue
      \fi
    }%
  \expandafter\endgroup
  \ifZREF@found
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\def\zref@addprop#1#2{%
  \zref@listexists{#1}{%
    \zref@propexists{#2}{%
      \zref@listcontainsprop{#1}{#2}{%
        \PackageWarning\ZREF@name{%
          Property `#2' is already in list `#1'%
        }%
      }{%
        \expandafter\g@addto@macro\csname Z@L@#1\endcsname{{#2}}%
      }%
    }%
  }%
}
\def\zref@ifpropundefined#1{%
  \expandafter\ifx\csname Z@E@#1\endcsname\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\def\zref@propexists#1{%
  \zref@ifpropundefined{#1}{%
    \PackageError\ZREF@name{%
      Property `#1' does not exist%
    }\@ehc
  }%
}
\def\zref@newprop{%
  \@ifstar{%
    \let\ZREF@X\noexpand
    \ZREF@newprop
  }{%
    \let\ZREF@X\@empty
    \ZREF@newprop
  }%
}
\def\ZREF@newprop#1{%
  \PackageInfo{zref}{New property: #1}%
  \def\ZREF@P{#1}%
  \@ifnextchar[\ZREF@@newprop{\ZREF@@newprop[\zref@default]}%
}
\def\ZREF@@newprop[#1]{%
  \global\@namedef{Z@D@\ZREF@P}{#1}%
  \global\expandafter\let\csname Z@X@\ZREF@P\endcsname\ZREF@X
  \expandafter\ZREF@@@newprop\csname\ZREF@P\endcsname
  \zref@setcurrent\ZREF@P
}
\def\ZREF@@@newprop#1{%
  \expandafter\gdef\csname Z@E@\ZREF@P\endcsname##1#1##2##3\ZREF@nil{##2}%
}
\def\zref@setcurrent#1{%
  \expandafter\def\csname Z@C@#1\endcsname
}
\def\zref@getcurrent#1{%
  \csname Z@C@#1\endcsname
}
\def\zref@label#1{%
  \zref@labelbylist{#1}\ZREF@mainlist
}
\def\zref@labelbylist#1#2{%
  \@bsphack
    \zref@listexists{#2}{%
      \expandafter\expandafter\expandafter\ZREF@label
      \expandafter\expandafter\expandafter{%
        \csname Z@L@#2\endcsname
      }{#1}%
    }%
  \@esphack
}
\def\zref@labelbyprops#1#2{%
  \@bsphack
    \begingroup
      \edef\l{#2}%
      \toks@{}%
      \@for\x:=#2\do{%
        \zref@ifpropundefined{\x}{%
          \PackageWarning\ZREF@name{%
            Property `\x' is not known%
          }%
        }{%
          \toks@\expandafter\expandafter\expandafter{%
            \expandafter\the\expandafter\toks@\expandafter{\x}%
          }%
        }%
      }%
    \expandafter\endgroup
    \expandafter\ZREF@label\expandafter{\the\toks@}{#1}%
  \@esphack
}
\newif\ifZREF@immediate
\long\def\zref@wrapper@immediate#1{%
  \begingroup
    \ZREF@immediatetrue
    \let\ZREF@org@write\write
    \def\write{\immediate\ZREF@org@write}%
    #1%
  \endgroup
}
\def\ZREF@label#1#2{%
  \if@filesw
    \begingroup
      \ifZREF@immediate
        \let\ZREF@org@thepage\thepage
      \fi
      \protected@write\@auxout{%
        \ifZREF@immediate
          \let\thepage\ZREF@org@thepage
        \fi
        \let\ZREF@temp\@empty
        \@tfor\ZREF@P:=#1\do{%
          \expandafter\ifx
              \csname\ifZREF@immediate relax\else Z@X@\ZREF@P\fi\endcsname
              \noexpand
            \expandafter\let\csname Z@C@\ZREF@P\endcsname\relax
          \fi
          \toks@\expandafter{\ZREF@temp}%
          \edef\ZREF@temp{%
            \the\toks@
            \expandafter\string\csname\ZREF@P\endcsname{%
              \expandafter\noexpand\csname Z@C@\ZREF@P\endcsname
            }%
          }%
        }%
      }{%
        \string\zref@newlabel{#2}{\ZREF@temp}%
      }%
    \endgroup
  \fi
}
\def\ZREF@addtoks#1{%
  \toks@\expandafter\expandafter\expandafter{%
    \expandafter\the\expandafter\toks@#1%
  }%
}
\def\zref@ifrefundefined#1{%
  \expandafter\ifx\csname Z@R@#1\endcsname\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\def\zref@refused#1{%
  \begingroup
    \csname @safe@activestrue\endcsname
    \zref@ifrefundefined{#1}{%
      \protect\G@refundefinedtrue
      \@latex@warning{%
        Reference `#1' on page \thepage \space undefined%
      }%
    }{}%
  \endgroup
}
\def\zref@extract#1#2{%
  \expandafter\expandafter\expandafter\ZREF@extract
  \expandafter\expandafter\expandafter{%
    \csname Z@D@#2\endcsname
  }{#1}{#2}%
}
\def\ZREF@extract#1#2#3{%
  \zref@extractdefault{#2}{#3}{#1}%
}
\def\zref@ifrefcontainsprop#1#2{%
  \zref@ifrefundefined{#1}{%
    \@secondoftwo
  }{%
    \expandafter\ZREF@ifrefcontainsprop
    \csname Z@E@#2\expandafter\endcsname
    \csname#2\expandafter\expandafter\expandafter\endcsname
    \expandafter\expandafter\expandafter{%
      \csname Z@R@#1\endcsname
    }%
  }%
}
\def\ZREF@ifrefcontainsprop#1#2#3{%
  \expandafter\ifx\expandafter\ZREF@novalue
  #1#3#2\ZREF@novalue\ZREF@nil\@empty
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi
}
\def\ZREF@novalue{\ZREF@NOVALUE}
\def\zref@extractdefault#1#2#3{%
  \zref@ifrefundefined{#1}{%
    \ZREF@unexpanded{#3}%
  }{%
    \expandafter\expandafter\expandafter\ZREF@unexpanded
    \expandafter\expandafter\expandafter{%
      \csname Z@E@#2\expandafter\expandafter\expandafter\endcsname
      \csname Z@R@#1\expandafter\endcsname
      \csname#2\endcsname{#3}\ZREF@nil
    }%
  }%
}
\long\def\zref@wrapper@unexpanded#1{%
  \let\ZREF@unexpanded\unexpanded
  #1%
  \let\ZREF@unexpanded\@firstofone
}
\let\ZREF@unexpanded\@firstofone
\long\def\zref@wrapper@babel#1#2{%
  \begingroup
    \csname @safe@activestrue\endcsname
    \edef\x{#2}%
  \expandafter\endgroup
  \expandafter\ZREF@wrapper@babel\expandafter{\x}{#1}%
}
\def\ZREF@wrapper@babel#1#2{%
  #2{#1}%
}
\def\zref@require@unique{%
  \@ifundefined{c@zref@unique}{%
    \newcounter{zref@unique}%
    \renewcommand*{\thezref@unique}{%
      zref@\number\c@zref@unique
    }%
  }{}%
}
\def\zref@setdefault#1{%
  \def\zref@default{#1}%
}
\zref@setdefault{%
  \nfss@text{\reset@font\bfseries ??}%
}
\def\zref@setmainlist#1{%
  \def\ZREF@mainlist{#1}%
}
\zref@setmainlist{main}
\zref@newlist\ZREF@mainlist
\zref@newprop{default}{\@currentlabel}
\zref@newprop*{page}{\thepage}
\zref@addprop\ZREF@mainlist{default}
\zref@addprop\ZREF@mainlist{page}
\let\ZREF@baseok\@empty
\endinput
%%
%% End of file `zref-base.sty'.
