%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bibtex.4ht                           2001-12-14-17:07 %
% Copyright (C) 1999--2001      Eitan M. Gurari         %
%                                                       %
% This program can 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 (at your option) any later version.       %
%                                                       %
% However, you are allowed to modify this program       %
% without changing its name, if you modify its          %
% signature. Changes to the signature can be introduced %
% with a directive of the form                          %
%            \message{signature}                        %
%                                                       %
%                             gurari@cis.ohio-state.edu %
%                 http://www.cis.ohio-state.edu/~gurari %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\immediate\write-1{version 2001-12-14-17:07}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Usage:  \input bibtex.4ht  \bibtex{file.bib}                   %
% Provides: \bibkey, \thisbib, \Configure{@...}, \Configure{...} %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\expandafter\ifx\csname :RestoreCatcodes\endcsname\relax
    \expandafter\let\csname :RestoreCatcodes\endcsname=\empty
\fi
\edef\bibstack{\noexpand\PushStack\expandafter\noexpand
    \csname Cat:Stack\endcsname
    \expandafter\noexpand \csname :RestoreCatcodes\endcsname}
\bibstack
\expandafter\edef\csname :RestoreCatcodes\endcsname{%
   \catcode`\noexpand :\the\catcode`:%
   \catcode`\noexpand "\the\catcode`"%
   \catcode`\noexpand @\the\catcode`@%
   \catcode`\noexpand _\the\catcode`_%
   \catcode`\noexpand ^\the\catcode`^%
   \catcode`\noexpand |\the\catcode`|%
   \csname no:restore\endcsname
   \noexpand\PopStack\expandafter\noexpand\csname Cat:Stack\endcsname
        \expandafter\noexpand \csname :RestoreCatcodes\endcsname}
\catcode`\:11 \catcode`\@11   \catcode`\^7 \catcode`\|=12
\catcode`"12

\catcode`\_=13
\gdef\bib:parse#1,{{\def_{\string_}%
   \xdef\bibkey{#1}\open:tag{\bib:type}{entry}\hfil\break}\cont:parse}
\catcode`\_=8
\gdef\bib:eat{\bgroup \catcode`\@=12  \catcode`\^^M=10 \catcode`\#=12
   \a:@bibtex \csname a:@\bib:type\endcsname
   \ifx \thisbib\:UnDef \expandafter\bib:conteat
   \else \pend:defI\thisbib{\egroup}\expandafter\thisbib \fi}
\NewConfigure{@bibtex}{1}
\def\get:key#1 #2///{\def\:temp{#2}\ifx\:temp\empty \def\bib:tag{#1}\else
      \def\:temp{\get:key#1#2///}\expandafter\:temp
   \fi}
\long\def\bib:conteat#1{\egroup
  {\bib:parse #1@="@"}\csname b:\bib:type\endcsname \vfil\break}
\def\open:tag#1#2{%
  \expandafter\ifx \csname a:#1\endcsname\relax
     \:warning{no configuration for #2 <#1>...</#1>}%
     \global\expandafter\let \csname a:#1\endcsname\empty
  \fi \csname a:#1\endcsname}
\def\bib:scan{\ifx \:next\bgroup \expandafter\bib:eat
   \else \expandafter\bib:more \fi}
\def\bib:more#1{\edef\bib:type{\bib:type#1}\futurelet\:next\bib:scan}

\def\b:btitem#1{\egroup\def\bib:type{#1}\futurelet\:next\bib:scan}

\catcode`\@=13\relax
\gdef\bibtex#1{\begingroup
     \def@{\bgroup \catcode`\@=12\b:btitem}%
   \catcode`\@=13\relax
   \input #1\endgroup}
\catcode`\@=11\relax

\def\cont:parse{\futurelet\:next\cont:parseY}
\def\cont:parseY{%
   \expandafter\ifx \space\:next
       \expandafter       \def\expandafter\:temp\space{\cont:parse}%
   \else \let\:temp\cont:parseX \fi \:temp}
\long\def\cont:parseX#1={%%
   \expandafter\get:key#1 ///\futurelet\:next\parse:value}
\def\parse:value{%
   \expandafter\ifx \space\:next
      \expandafter\def\expandafter\:temp\space{\futurelet
           \:next\parse:value}%
   \else \if "\:next   \let\:temp=\parse:valueX
   \else
      \ifx \bgroup\:next \let\:temp=\parse:valueG
      \else \let\:temp=\parse:valueC  \fi
   \fi \fi \:temp}
\def\parse:valueC#1,{\parse:valueY{#1},}
\def\parse:valueX"#1"{\parse:valueY{#1}}
\def\parse:valueG#1{\parse:valueY{#1}}
\def\parse:valueY#1{%
   \def\:temp{@}\def\:tempa{#1}\ifx \:temp\:tempa \else
     \def\:tempb{#1}\ifx \:tempb\empty\else \open:tag\bib:tag{key}%
        \:tempb\csname b:\bib:tag\endcsname\hfil\break
     \fi
     \expandafter\tail:parse
   \fi}
\def\tail:parse{\futurelet\:next\tail:parseY}
\def\tail:parseY{\ifx \:com\:next  \def\:temp##1{\cont:parse}%
   \else \expandafter\ifx \space\:next
       \expandafter       \def\expandafter\:temp\space{\tail:parse}%
   \else \ifx\:next\egroup \let\:temp\empty
         \else\def\:temp##1{\tail:parse}\fi
   \fi\fi \:temp}
\let\:com=,

\:RestoreCatcodes
\endinput

