%%
%% This is file `pdfescape.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pdfescape.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 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 pdfescape.dtx
%% and the derived files
%%    pdfescape.sty, pdfescape.pdf, pdfescape.ins, pdfescape.drv,
%%    pdfescape-test1.tex, pdfescape-test2.tex,
%%    pdfescape-test3.tex.
%% 
\begingroup
  \expandafter\let\expandafter\x\csname ver@pdfescape.sty\endcsname
  \ifcase 0%
    \ifx\x\relax % plain
    \else
      \ifx\x\empty % LaTeX
      \else
        1%
      \fi
    \fi
  \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{pdfescape}{The package is already loaded}%
    \endgroup
    \expandafter\endinput
  \fi
\endgroup
\begingroup
  \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\relax
        \xdef#1{#3}%
      \fi
    }%
  \fi
\expandafter\x\csname ver@pdfescape.sty\endcsname
\ProvidesPackage{pdfescape}%
  [2007/04/11 v1.3 Provides hex, PDF name and string conversions (HO)]
\expandafter\edef\csname PE@AtEnd\endcsname{%
  \catcode64 \the\catcode64\relax
}
\catcode64 11 % @
\def\PE@EnsureCode#1#2#3{%
  \edef\PE@AtEnd{%
    \PE@AtEnd
    #1#2 \the#1#2\relax
  }%
  #1#2 #3\relax
}
\PE@EnsureCode\catcode{0}{12}% ^^@
\PE@EnsureCode\catcode{34}{12}% "
\PE@EnsureCode\catcode{42}{12}% *
\PE@EnsureCode\catcode{45}{12}% -
\PE@EnsureCode\catcode{46}{12}% .
\PE@EnsureCode\catcode{60}{12}% <
\PE@EnsureCode\catcode{61}{12}% =
\PE@EnsureCode\catcode{62}{12}% >
\PE@EnsureCode\catcode{94}{7}% ^
\PE@EnsureCode\catcode{96}{12}% `
\PE@EnsureCode\uccode{34}{0}% "
\PE@EnsureCode\uccode{48}{0}% 0
\PE@EnsureCode\uccode{61}{0}% =
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfescapehex\endcsname\relax
  \long\def\EdefEscapeHex#1#2{%
    \PE@sanitize#1{#2}%
    \edef#1{\expandafter\PE@SpaceToOther#1 \relax}%
    \PE@EscapeHex#1%
  }%
  \def\EdefUnescapeHex#1#2{%
    \PE@sanitize#1{#2}%
    \PE@UnescapeHex#1%
  }%
  \long\def\EdefEscapeName#1#2{%
    \PE@sanitize#1{#2}%
    \edef#1{\expandafter\PE@SpaceToOther#1 \relax}%
    \PE@EscapeName#1%
  }%
  \long\def\EdefEscapeString#1#2{%
    \PE@sanitize#1{#2}%
    \edef#1{\expandafter\PE@SpaceToOther#1 \relax}%
    \PE@EscapeString#1%
  }%
\else
\long\def\PE@edefbabel#1#2#3{%
  \begingroup
    \csname @save@activestrue\endcsname
    \edef#1{#2{#3}}%
  \expandafter\endgroup
  \expandafter\def\expandafter#1\expandafter{#1}%
}
  \long\def\EdefEscapeHex#1#2{%
    \PE@edefbabel#1\pdfescapehex{#2}%
  }%
  \def\EdefUnescapeHex#1#2{%
    \PE@edefbabel#1\pdfunescapehex{#2}%
  }%
  \long\def\EdefEscapeName#1#2{%
    \PE@edefbabel#1\pdfescapename{#2}%
  }%
  \long\def\EdefEscapeString#1#2{%
    \PE@edefbabel#1\pdfescapestring{#2}%
  }%
  \PE@AtEnd
  \expandafter\endinput
\fi
\edef\PE@hash{\string#}
\begingroup
  \catcode`\ =12\relax%
\def\x{\endgroup\def\PE@space@other{ }}\x\relax
\def\PE@space@space{ }
\begingroup
  \long\def\@gobble#1{}%
  \escapechar=92 %
\edef\x{\endgroup
  \def\noexpand\PE@backslash{\expandafter\@gobble\string\\}%
}
\x
\newif\ifPE@etex
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname numexpr\endcsname\relax
\else
  \PE@etextrue
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname detokenize\endcsname\relax
  \long\def\PE@sanitize#1#2{%
    \begingroup
      \csname @safe@activestrue\endcsname
      \edef#1{#2}%
      \PE@onelevel@sanitize#1%
    \expandafter\endgroup
    \expandafter\def\expandafter#1\expandafter{#1}%
  }%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname @onelevel@sanitize\endcsname\relax
    \def\PE@onelevel@sanitize#1{%
      \edef#1{\expandafter\PE@strip@prefix\meaning#1}%
    }%
    \def\PE@strip@prefix#1>{}%
  \else
    \let\PE@onelevel@sanitize\@onelevel@sanitize
  \fi
\else
  \long\def\PE@sanitize#1#2{%
    \begingroup
      \csname @safe@activestrue\endcsname
      \edef#1{#2}%
      \edef#1{\detokenize\expandafter{#1}}%
    \expandafter\endgroup
    \expandafter\def\expandafter#1\expandafter{#1}%
  }%
\fi
\def\PE@SpaceToOther#1 #2\relax{%
  #1%
  \ifx\\#2\\%
  \else
    \PE@space@other
    \@ReturnAfterFi{%
      \PE@SpaceToOther#2\relax
    }%
  \fi
}
\long\def\@ReturnAfterFi#1\fi{\fi#1}
\ifPE@etex
  \def\PE@EscapeHex#1{%
    \edef#1{\expandafter\PE@ToHex#1\relax}%
  }%
\else
  \def\PE@EscapeHex#1{%
    \def\PE@result{}%
    \expandafter\PE@ToHex#1\relax
    \let#1\PE@result
  }%
\fi
\def\PE@ToHex#1{%
  \ifx\relax#1%
  \else
    \PE@HexChar{#1}%
    \expandafter\PE@ToHex
  \fi
}%
\ifPE@etex
  \def\PE@HexChar#1{%
    \PE@HexDigit{\numexpr\dimexpr.0625\dimexpr`#1sp\relax\relax\relax}%
    \PE@HexDigit{%
      \numexpr`#1-16*\dimexpr.0625\dimexpr`#1sp\relax\relax\relax
    }%
  }%
\else
  \def\PE@HexChar#1{%
    \dimen0=`#1sp%
    \dimen2=.0625\dimen0 %
    \advance\dimen0-16\dimen2 %
    \edef\PE@result{%
      \PE@result
      \PE@HexDigit{\dimen2 }%
      \PE@HexDigit{\dimen0 }%
    }%
  }%
\fi
\def\PE@HexDigit#1{%
  \expandafter\string
  \ifcase#1%
    0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or 9\or
    A\or B\or C\or D\or E\or F%
  \fi
}
\ifPE@etex
  \def\PE@OctChar#1{%
    \expandafter\PE@@OctChar
        \the\numexpr\dimexpr.015625\dimexpr`#1sp\relax\relax
            \expandafter\relax
        \expandafter\relax
        \the\numexpr\dimexpr.125\dimexpr`#1sp\relax\relax\relax
        \relax
        #1%
  }%
  \def\PE@@OctChar#1\relax#2\relax#3{%
    \PE@backslash
    #1%
    \the\numexpr#2-8*#1\relax
    \the\numexpr\dimexpr`#3sp\relax-8*#2\relax
  }%
\else
  \def\PE@OctChar#1{%
    \dimen0=`#1sp%
    \dimen2=.125\dimen0 %
    \dimen4=.125\dimen2 %
    \advance\dimen0-8\dimen2 %
    \advance\dimen2-8\dimen4 %
    \edef\PE@result{%
      \PE@result
      \PE@backslash
      \number\dimen4 %
      \number\dimen2 %
      \number\dimen0 %
    }%
  }%
\fi
\def\PE@UnescapeHex#1{%
  \begingroup
    \def\PE@result{}%
    \expandafter\PE@DeHex#1\relax\relax
  \expandafter\endgroup
  \expandafter\def\expandafter#1\expandafter{\PE@result}%
}
\def\PE@DeHex#1#2{%
  \ifx#2\relax
    \ifx#1\relax
    \else
      \PE@DeHex#10\relax\relax
    \fi
  \else
    \uppercase{\lccode0="#1#2}\relax
    \ifnum\lccode0=32 %
      \edef\PE@result{\PE@result\PE@space@space}%
    \else
      \lowercase{\def\PE@temp{^^@}}%
      \edef\PE@result{\PE@result\PE@temp}%
    \fi
    \expandafter\PE@DeHex
  \fi
}
\ifPE@etex
  \def\PE@EscapeName#1{%
    \edef#1{\expandafter\PE@EscapeNameTokens#1\relax}%
  }%
\else
  \def\PE@EscapeName#1{%
    \def\PE@result{}%
    \expandafter\PE@EscapeNameTokens#1\relax
    \let#1\PE@result
  }%
\fi
\def\PE@EscapeNameTokens#1{%
  \ifx\relax#1%
  \else
    \ifnum`#1<33 %
      \ifcase`#1 %
        % drop illegal zero
      \else
        \PE@EscapeNameAdd\PE@hash
        \PE@HexChar#1%
      \fi
    \else
      \ifnum`#1>126 %
        \PE@EscapeNameAdd\PE@hash
        \PE@HexChar#1%
      \else  \ifnum`#1=35  \PE@EscapeNameHashChar 23% #
        \else\ifnum`#1=37  \PE@EscapeNameHashChar 25% %
        \else\ifnum`#1=40  \PE@EscapeNameHashChar 28% (
        \else\ifnum`#1=41  \PE@EscapeNameHashChar 29% )
        \else\ifnum`#1=47  \PE@EscapeNameHashChar 2F% /
        \else\ifnum`#1=60  \PE@EscapeNameHashChar 3C% <
        \else\ifnum`#1=62  \PE@EscapeNameHashChar 3E% >
        \else\ifnum`#1=91  \PE@EscapeNameHashChar 5B% [
        \else\ifnum`#1=93  \PE@EscapeNameHashChar 5D% ]
        \else\ifnum`#1=123 \PE@EscapeNameHashChar 7B% {
        \else\ifnum`#1=125 \PE@EscapeNameHashChar 7D% }
        \else
          \PE@EscapeNameAdd{#1}%
        \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
      \fi
    \fi
    \expandafter\PE@EscapeNameTokens
  \fi
}%
\def\PE@EscapeNameHashChar#1#2{%
  \PE@EscapeNameAdd{\PE@hash\string#1\string#2}%
}%
\ifPE@etex
  \def\PE@EscapeNameAdd#1{#1}%
\else
  \def\PE@EscapeNameAdd#1{%
    \edef\PE@result{%
      \PE@result
      #1%
    }%
  }%
\fi
\ifPE@etex
  \def\PE@EscapeString#1{%
    \edef#1{\expandafter\PE@EscapeStringTokens#1\relax}%
  }%
\else
  \def\PE@EscapeString#1{%
    \begingroup
      \def\PE@result{}%
      \expandafter\PE@EscapeStringTokens#1\relax
    \expandafter\endgroup
    \expandafter\def\expandafter#1\expandafter{\PE@result}%
  }%
\fi
\def\PE@EscapeStringTokens#1{%
  \ifx\relax#1%
  \else
    \ifnum`#1<33 %
      \PE@OctChar#1%
    \else
      \ifnum`#1>126 %
        \PE@OctChar#1%
      \else  \ifnum`#1=40 \PE@EscapeStringAdd{\string\(}% (
        \else\ifnum`#1=41 \PE@EscapeStringAdd{\string\)}% )
        \else\ifnum`#1=92 \PE@EscapeStringAdd{\string\\}% \
        \else
          \PE@EscapeStringAdd{#1}%
        \fi\fi\fi
      \fi
    \fi
    \expandafter\PE@EscapeStringTokens
  \fi
}%
\ifPE@etex
  \def\PE@EscapeStringAdd#1{#1}%
\else
  \def\PE@EscapeStringAdd#1{%
    \edef\PE@result{%
      \PE@result
      #1%
    }%
  }%
\fi
\PE@AtEnd
\endinput
%%
%% End of file `pdfescape.sty'.
