%%
%% This is file `usebib.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% usebib.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2012 by Enrico Gregorio
%% <Enrico dot Gregorio at univr dot it>
%% -------------------------------------------------------
%% 
%% 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. 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'.
%% 
%% The Current Maintainer of this work is Enrico Gregorio.
%% 
%% This work consists of the files
%%   usebib.dtx
%%   usebib.ins
%% and the derived file usebib.sty.
%% 
\NeedsTeXFormat{LaTeX2e}[2008/04/05]
\ProvidesPackage{usebib}
    [2012/03/17 v1.0 Reusing bib files]
\@ifundefined{eTeXversion}
  {\PackageError{usebib}{LaTeX engine too old, aborting}
   {Please upgrade your TeX system}\@@end}{}
\RequirePackage{url}
\RequirePackage{keyval}
\define@key{usebib}{currenttype}{\def\@tempa{#1}}
\define@key{usebib}{currententry}{\def\reuse@current{#1}}
\def\define@reuse@key#1{%
  \define@key{usebib}{#1}{\lowercase{\global\@namedef{reuse@\reuse@current @#1}}{##1}}}
\define@reuse@key{title}
\define@reuse@key{isbn}
\define@reuse@key{url}
\define@reuse@key{year}
\define@reuse@key{note}
\def\reuse@find#1#{%
  \lowercase{\setkeys{usebib}{currenttype=#1}}%
  \ifcsname reuse@type@\@tempa\endcsname
    \expandafter\@gobble
  \else
    \begingroup\@makeother\%\makeatother
    \expandafter\reuse@extract
  \fi}
\def\reuse@extract#1{\setkeys{usebib}{currententry=#1}\endgroup}
\let\reuse@type@preamble\@empty
\let\reuse@type@string\@empty
\def\newbibignore#1{\expandafter\let\csname reuse@type@#1\endcsname\@empty}
\def\reuse@error#1#2{%
  \PackageError{usebib}
    {Undefined key `#1' or empty value for `#2'}
    {The key you used is wrong or the value to `#2' has not been set}}
\newcommand\newbibfield[1]{\define@reuse@key{#1}}
\def\usebibentry#1#2{\@ifundefined{reuse@#1@#2}
  {\reuse@error{#1}{#2}}
  {\@nameuse{reuse@#1@#2}}}
\newcommand{\usebibentryurl}[2][|]{\@ifundefined{reuse@#2@url}
  {\reuse@error{#2}{url}}
  {\reuse@usebibentryurl{#1}{#2}}}
\@ifpackageloaded{hyperref}{\@tempswatrue}{\@tempswafalse}
\if@tempswa
  \def\reuse@usebibentryurl#1#2{%
    \scantokens{\url{\csname reuse@#2@url\endcsname}\endinput}}
\else
  \def\reuse@usebibentryurl#1#2{%
    \toks@=\expandafter\expandafter\expandafter
      {\csname reuse@#2@url\endcsname}%
    \scantokens\expandafter{%
      \expandafter\url\expandafter#1\the\toks@#1\endinput}}
\fi
\newcommand{\bibinput}[1]{%
  \begingroup
  \catcode`\^^M=10
  \let\KV@err=\@gobble
  \let\KV@errx=\@gobble
  \let\XKV@err=\@gobble
  \begingroup\lccode`\~=`\@
    \lowercase{\endgroup\let~}\reuse@find
  \catcode`\@=\active \input{#1.bib}\endgroup}
\endinput
%%
%% End of file `usebib.sty'.
