%%
%% This is file `se-utf8.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% stringenc.dtx  (with options: `utf8')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007-2009 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 stringenc.dtx
%% and the derived files
%%    stringenc.sty, stringenc.pdf, stringenc.ins, stringenc.drv,
%%    se-utf32be.def, se-utf32le.def, se-utf8.def, se-utf16le.def,
%%    se-pdfdoc.def, se-iso-8859-1.def, se-cp1252.def,
%%    se-ascii.def, se-ascii-print.def, se-clean7bit.def,
%%    se-iso-8859-2.def, se-iso-8859-3.def, se-iso-8859-4.def,
%%    se-iso-8859-5.def, se-iso-8859-6.def, se-iso-8859-7.def,
%%    se-iso-8859-8.def, se-iso-8859-9.def, se-iso-8859-10.def,
%%    se-iso-8859-11.def, se-iso-8859-13.def, se-iso-8859-14.def,
%%    se-iso-8859-15.def, se-iso-8859-16.def, se-koi8-r.def,
%%    se-nextstep.def, se-mac-centeuro.def, se-mac-cyrillic.def,
%%    se-mac-roman.def, se-dec-mcs.def, se-cp437.def,
%%    se-cp850.def, se-cp852.def, se-cp855.def, se-cp858.def,
%%    se-cp865.def, se-cp866.def, se-cp1250.def, se-cp1251.def,
%%    se-cp1257.def, stringenc-test1.tex, stringenc-test2.tex.
%% 
\ProvidesFile{se-utf8.def}[2009/12/15 v1.7 stringenc: UTF-8]
\expandafter\gdef\csname\SE@PrefixTo utf8\endcsname#1#2#3#4{%
  \ifnum"#1#2#3#4<"80 %
    \SE@ResultAdd{#3#4}%
  \else
    \ifnum"#1#2#3#4<"800 %
      \edef\SE@temp{%
        \SE@Nibble@NumToBin{"#3}%
      }%
      \edef\SE@temp{%
        11%
        \SE@Nibble@NumToBin{"#2}%
        \expandafter\SE@CarTwo\SE@temp\@nil
        10%
        \expandafter\SE@GobbleTwo\SE@temp
      }%
      \SE@ResultAdd{%
        \SE@Nibbles@BinToHex\SE@temp
        #4%
      }%
    \else
      \edef\SE@temp{%
        \SE@Nibble@NumToBin{"#3}%
      }%
      \edef\SE@temp{%
        10%
        \SE@Nibble@NumToBin{"#2}%
        \expandafter\SE@CarTwo\SE@temp\@nil
        10%
        \expandafter\SE@GobbleTwo\SE@temp
      }%
      \SE@ResultAdd{%
        E#1%
        \SE@Nibbles@BinToHex\SE@temp
         #4%
      }%
    \fi
  \fi
}
\expandafter\gdef\csname\SE@PrefixSurrogateTo utf8\endcsname
    #1#2#3#4#5#6#7#8{%
  \edef\SE@w{\SE@Nibble@NumToBin{"#2}}%
  \edef\SE@a{\SE@Nibble@NumToBin{"#3}}%
  \edef\SE@b{\SE@Nibble@NumToBin{"#4}}%
  \edef\SE@c{\SE@Nibble@NumToBin{"#6}}%
  \edef\SE@d{\SE@Nibble@NumToBin{"#7}}%
  \edef\SE@w{%
    \expandafter\SE@GobbleTwo\SE@w
    \expandafter\SE@CarTwo\SE@a\@nil
  }%
  \edef\SE@w{%
    \SE@Nibbles@BinToHex\SE@w
  }%
  \SE@Add\SE@w{\expandafter"\SE@w}\SE@one
  \ifnum\SE@w>15 %
    \def\SE@char{1}%
    \SE@Add\SE@w\SE@w{-16}%
  \else
    \def\SE@char{0}%
  \fi
  \edef\SE@w{\SE@Nibble@NumToBin\SE@w}%
  \edef\SE@temp{%
    0\SE@char
    \expandafter\SE@CarTwo\SE@w\@nil
    10%
    \expandafter\SE@GobbleTwo\SE@w
    \expandafter\SE@GobbleTwo\SE@a
    \expandafter\SE@CarTwo\SE@b\@nil
    10%
    \expandafter\SE@GobbleTwo\SE@b
    \expandafter\SE@GobbleTwo\SE@c
    \expandafter\SE@CarTwo\SE@d\@nil
    10%
    \expandafter\SE@GobbleTwo\SE@d
  }%
  \SE@ResultAdd{%
    F%
    \SE@Nibbles@BinToHex\SE@temp
    #8%
  }%
}
\expandafter\gdef\csname\SE@PrefixFrom utf8\endcsname#1{%
  \let\SE@temp\SE@Empty
  \let\SE@next\SE@utfviii@filter
  \expandafter\SE@utfviii@filter#1\relax\relax
  \ifcase\ifSE@TestMode
           \ifSE@invalid
             \SE@one
           \else
             \SE@zero
           \fi
         \else
           \SE@zero
         \fi
    \expandafter\SE@utfviii@from\SE@temp\relax\relax\relax\relax
                                        \relax\relax\relax\relax
  \fi
}
\gdef\SE@utfviii@filter#1#2{%
  \ifx#1\relax
    \let\SE@next\relax
  \else
    \ifcase\ifnum"#1#2>"F4 %
             \SE@zero
           \else
             \ifnum"#1#2="C0 %
               \SE@zero
             \else
               \ifnum"#1#2="C1 %
                 \SE@zero
               \else
                 \SE@one
               \fi
             \fi
           \fi
      \SE@InvalidCharacter
      \ifSE@TestMode
        \let\SE@next\SE@SkipRemaining
      \fi
    \else
      \edef\SE@temp{\SE@temp#1#2}%
    \fi
  \fi
  \SE@next
}
\gdef\SE@utfviii@from#1#2#3#4#5#6#7#8{%
  \ifx#1\relax
    \let\SE@next\relax
  \else
    \ifnum"#1<8 % 0xxx xxxx
      \SE@ResultAdd{00#1#2}%
      \def\SE@next{\SE@utfviii@from#3#4#5#6#7#8}%
    \else
      \ifnum"#1<12 % 10xx xxxx
        \SE@InvalidCharacter
        \ifSE@TestMode
          \let\SE@next\SE@SkipRemaining
        \else
          \def\SE@next{\SE@utfviii@from#3#4#5#6#7#8}%
        \fi
      \else
        \ifx#3\relax
          \let\SE@next\relax
          \SE@InvalidCharacter
        \else
          \ifcase\SE@utfviii@CheckCont#3%
            \SE@InvalidCharacter
            \ifSE@TestMode
              \let\SE@next\SE@SkipRemaining
            \else
              \def\SE@next{\SE@utfviii@from#3#4#5#6#7#8}%
            \fi
          \else
            \ifnum"#1<14 % 110y yyyy 10xx xxxx
                         % 0000 0yyy yyxx xxxx
              \edef\SE@temp{%
                \SE@Nibble@NumToBin{"#3}%
              }%
              \edef\SE@temp{%
                0\ifodd"#1 1\else 0\fi
                \SE@Nibble@NumToBin{"#2}%
                \expandafter\SE@GobbleTwo\SE@temp
              }%
              \SE@ResultAdd{%
                0%
                \SE@Nibbles@BinToHex\SE@temp
                #4%
              }%
              \def\SE@next{\SE@utfviii@from#5#6#7#8}%
            \else
              \ifx#5\relax
                \let\SE@next\relax
                \SE@InvalidCharacter
              \else
                \ifcase\SE@utfviii@CheckCont#5%
                  \SE@InvalidCharacter
                  \ifSE@TestMode
                    \let\SE@next\SE@SkipRemaining
                  \else
                    \def\SE@next{\SE@utfviii@from#5#6#7#8}%
                  \fi
                \else
                  \ifnum"#1=14 % 1110 zzzz 10yy yyyy 10xx xxxx
                               % zzzz yyyy yyxx xxxx
                    \ifcase\ifnum"#2="D %
                             \ifnum"#3#4>"9F %
                               \SE@zero
                             \else
                               \SE@one
                             \fi
                           \else
                             \ifnum"#2=\SE@zero
                               \ifnum"#3<"A %
                                 \SE@zero
                               \else
                                 \SE@one
                               \fi
                             \else
                               \SE@one
                             \fi
                           \fi
                      \SE@InvalidCharacter
                      \ifSE@TestMode
                        \let\SE@next\SE@SkipRemaining
                      \else
                        \def\SE@next{\SE@utfviii@from#7#8}%
                      \fi
                    \else
                      \edef\SE@a{\SE@Nibble@NumToBin{"#3}}%
                      \edef\SE@b{\SE@Nibble@NumToBin{"#5}}%
                      \edef\SE@temp{%
                        \expandafter\SE@GobbleTwo\SE@a
                        \SE@Nibble@NumToBin{"#4}%
                        \expandafter\SE@GobbleTwo\SE@b
                      }%
                      \SE@ResultAdd{%
                        #2%
                        \SE@Nibbles@BinToHex\SE@temp
                        #6%
                      }%
                      \def\SE@next{\SE@utfviii@from#7#8}%
                    \fi
                  \else
                    \ifx#7\relax
                      \let\SE@next\relax
                      \SE@InvalidCharacter
                    \else
                      \ifcase\SE@utfviii@CheckCont#7%
                        \SE@InvalidCharacter
                        \ifSE@TestMode
                          \let\SE@next\SE@SkipRemaining
                        \else
                          \def\SE@next{\SE@utfviii@from#7#8}%
                        \fi
                      \else
                        \let\SE@next\SE@utfviii@from
                        \ifnum"#2<8 % 1111 0uuu 10uu zzzz 10yy yyyy 10xx xxxx
                                    % 1101 10ww wwzz zzyy 1101 11yy yyxx xxxx
                          \edef\SE@w{\SE@Nibble@NumToBin{"#3}}%
                          \edef\SE@w{%
                            00%
                            \SE@Nibble@NumToBin{"#2}%
                            \expandafter\SE@GobbleTwo\SE@w
                          }%
                          \edef\SE@w{\SE@Nibbles@BinToHex\SE@w}%
                          \SE@Add\SE@w{\expandafter"\SE@w}{-1}%
                          \ifnum\SE@w>15 %
                            \SE@InvalidCharacter
                            \ifSE@TestMode
                              \let\SE@next\SE@SkipRemaining
                            \fi
                          \else
                            \ifnum\SE@w<\SE@zero
                              \SE@InvalidCharacter
                              \ifSE@TestMode
                                \let\SE@next\SE@SkipRemaining
                              \fi
                            \else
                              \edef\SE@a{\SE@Nibble@NumToBin{"#5}}%
                              \edef\SE@b{\SE@Nibble@NumToBin{"#7}}%
                              \edef\SE@temp{%
                                10%
                                \SE@Nibble@NumToBin\SE@w
                                \SE@Nibble@NumToBin{"#4}%
                                \expandafter\SE@GobbleTwo\SE@a
                                1101%
                                11%
                                \SE@Nibble@NumToBin{"#6}%
                                \expandafter\SE@GobbleTwo\SE@b
                              }%
                              \SE@ResultAdd{%
                                D%
                                \SE@Nibbles@BinToHex\SE@temp
                                #8%
                              }%
                            \fi
                          \fi
                        \else
                          \SE@InvalidCharacter
                          \if\SE@TestMode
                            \let\SE@next\SE@SkipRemaining
                          \fi
                        \fi
                      \fi
                    \fi
                  \fi
                \fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \SE@next
}
\gdef\SE@utfviii@CheckCont#1{%
  \ifnum"#1<8 %
    \SE@zero
  \else
    \ifnum"#1<12 %
      \SE@one
    \else
      \SE@zero
    \fi
  \fi
}
\endinput
%%
%% End of file `se-utf8.def'.
