%%
%% This is file `bkm-dvipdfm.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bookmark.dtx  (with options: `dvipdfm')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007-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 bookmark.dtx
%% and the derived files
%%    bookmark.sty, bookmark.pdf, bookmark.ins, bookmark.drv,
%%    bkm-dvipdfm.def, bkm-dvips.def, bkm-dvipsone.def,
%%    bkm-textures.def, bkm-pdftex.def, bkm-vtex.def,
%%    bookmark-example.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-dvipdfm.def}%
  [2010/04/04 v1.11 bookmark driver for dvipdfm (HO)]%
\newcount\BKM@id
\BKM@id=\z@
\@namedef{BKM@0}{000}
\newif\ifBKM@sw
\newcommand*{\bookmark}[2][]{%
  \if@filesw
    \begingroup
      \def\bookmark@text{#2}%
      \BKM@setup{#1}%
      \edef\BKM@prev{\the\BKM@id}%
      \global\advance\BKM@id\@ne
      \BKM@swtrue
      \@whilesw\ifBKM@sw\fi{%
        \def\BKM@abslevel{1}%
        \ifnum\ifBKM@startatroot\z@\else\BKM@prev\fi=\z@
          \global\BKM@startatrootfalse
          \expandafter\xdef\csname BKM@\the\BKM@id\endcsname{%
            0{\BKM@level}\BKM@abslevel
          }%
          \BKM@swfalse
        \else
          \expandafter\expandafter\expandafter\BKM@getx
              \csname BKM@\BKM@prev\endcsname
          \ifnum\BKM@level>\BKM@x@level\relax
            \BKM@CalcExpr\BKM@abslevel\BKM@x@abslevel+1%
            \expandafter\xdef\csname BKM@\the\BKM@id\endcsname{%
              {\BKM@prev}{\BKM@level}\BKM@abslevel
            }%
            \BKM@swfalse
          \else
            \let\BKM@prev\BKM@x@parent
          \fi
        \fi
      }%
      \csname HyPsd@XeTeXBigCharstrue\endcsname
      \pdfstringdef\BKM@title{\bookmark@text}%
      \edef\BKM@FLAGS{\BKM@PrintStyle}%
      \let\BKM@action\@empty
      \ifx\BKM@gotor\@empty
        \ifx\BKM@dest\@empty
          \ifx\BKM@named\@empty
            \ifx\BKM@rawaction\@empty
              \ifx\BKM@uri\@empty
                \ifx\BKM@page\@empty
                  \PackageError{bookmark}{Missing action}\@ehc
                  \edef\BKM@action{/Dest[@page1/Fit]}%
                \else
                  \ifx\BKM@view\@empty
                    \def\BKM@view{Fit}%
                  \fi
                  \edef\BKM@action{/Dest[@page\BKM@page/\BKM@view]}%
                \fi
              \else
                \BKM@EscapeString\BKM@uri
                \edef\BKM@action{%
                  /A<<%
                    /S/URI%
                    /URI(\BKM@uri)%
                  >>%
                }%
              \fi
            \else
              \edef\BKM@action{/A<<\BKM@rawaction>>}%
            \fi
          \else
            \BKM@EscapeName\BKM@named
            \edef\BKM@action{%
              /A<</S/Named/N/\BKM@named>>%
            }%
          \fi
        \else
          \BKM@EscapeString\BKM@dest
          \edef\BKM@action{%
            /A<<%
              /S/GoTo%
              /D(\BKM@dest)%
            >>%
          }%
        \fi
      \else
        \ifx\BKM@dest\@empty
          \ifx\BKM@page\@empty
            \def\BKM@page{0}%
          \else
            \BKM@CalcExpr\BKM@page\BKM@page-1%
          \fi
          \ifx\BKM@view\@empty
            \def\BKM@view{Fit}%
          \fi
          \edef\BKM@action{/D[\BKM@page/\BKM@view]}%
        \else
          \BKM@EscapeString\BKM@dest
          \edef\BKM@action{/D(\BKM@dest)}%
        \fi
        \BKM@EscapeString\BKM@gotor
        \edef\BKM@action{%
          /A<<%
            /S/GoToR%
            /F(\BKM@gotor)%
            \BKM@action
          >>%
        }%
      \fi
      \special{pdf:%
        out \ifBKM@DvipdfmxOutlineOpen
              [%
              \ifBKM@open
                \ifnum\BKM@level<\BKM@openlevel
                \else
                  -%
                \fi
              \else
                -%
              \fi
              ] %
            \fi
            \BKM@abslevel
        <<%
          /Title(\BKM@title)%
          \ifx\BKM@color\@empty
          \else
            /C[\BKM@color]%
          \fi
          \ifnum\BKM@FLAGS>\z@
            /F \BKM@FLAGS
          \fi
          \BKM@action
        >>%
      }%
    \endgroup
  \fi
}
\def\BKM@getx#1#2#3{%
  \def\BKM@x@parent{#1}%
  \def\BKM@x@level{#2}%
  \def\BKM@x@abslevel{#3}%
}
\ifBKM@atend
  \RequirePackage{atenddvi}%
  \AtEndDvi{\BKM@EndHook}%
\fi
\endinput
%%
%% End of file `bkm-dvipdfm.def'.
