%%
%% This is file `luatex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luatex.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Project: luatex
%% Version: 2010/03/09 v0.4
%% 
%% Copyright (C) 2007, 2009, 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.
%% 
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%% 
%% This work consists of the main source file luatex.dtx
%% and the derived files
%%    luatex.sty, luatex.pdf, luatex.ins, luatex.drv, luatex-loader.sty,
%%    luatex-test1.tex, luatex-test2.tex, luatex-test3.tex,
%%    luatex-test4.tex, luatex-test5.tex, oberdiek.luatex.lua.
%% 
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode35=6 % #
  \catcode39=12 % '
  \catcode44=12 % ,
  \catcode45=12 % -
  \catcode46=12 % .
  \catcode58=12 % :
  \catcode64=11 % @
  \catcode123=1 % {
  \catcode125=2 % }
  \expandafter\let\expandafter\x\csname ver@luatex.sty\endcsname
  \ifx\x\relax % plain-TeX, first loading
  \else
    \def\empty{}%
    \ifx\x\empty % LaTeX, first loading,
      % variable is initialized, but \ProvidesPackage not yet seen
    \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{luatex}{The package is already loaded}%
      \aftergroup\endinput
    \fi
  \fi
\endgroup%
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode35=6 % #
  \catcode39=12 % '
  \catcode40=12 % (
  \catcode41=12 % )
  \catcode44=12 % ,
  \catcode45=12 % -
  \catcode46=12 % .
  \catcode47=12 % /
  \catcode58=12 % :
  \catcode64=11 % @
  \catcode91=12 % [
  \catcode93=12 % ]
  \catcode123=1 % {
  \catcode125=2 % }
  \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\@undefined
        \xdef#1{#3}%
      \fi
      \ifx#1\relax
        \xdef#1{#3}%
      \fi
    }%
  \fi
\expandafter\x\csname ver@luatex.sty\endcsname
\ProvidesPackage{luatex}%
  [2010/03/09 v0.4 LuaTeX basic definition package (HO)]%
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode123=1 % {
  \catcode125=2 % }
  \catcode64=11 % @
  \def\x{\endgroup
    \expandafter\edef\csname LuT@AtEnd\endcsname{%
      \endlinechar=\the\endlinechar\relax
      \catcode13=\the\catcode13\relax
      \catcode32=\the\catcode32\relax
      \catcode35=\the\catcode35\relax
      \catcode61=\the\catcode61\relax
      \catcode64=\the\catcode64\relax
      \catcode123=\the\catcode123\relax
      \catcode125=\the\catcode125\relax
    }%
  }%
\x\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
\catcode35=6 % #
\catcode64=11 % @
\catcode123=1 % {
\catcode125=2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\LuT@AtEnd{%
    \LuT@AtEnd
    \catcode#1=\the\catcode#1\relax
  }%
  \catcode#1=#2\relax
}
\TMP@EnsureCode{10}{12}% ^^J
\TMP@EnsureCode{34}{12}% "
\TMP@EnsureCode{36}{3}% $
\TMP@EnsureCode{39}{12}% '
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{43}{12}% +
\TMP@EnsureCode{44}{12}% ,
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{93}{12}% ]
\TMP@EnsureCode{95}{12}% _ (other!)
\TMP@EnsureCode{96}{12}% `
\edef\LuT@AtEnd{\LuT@AtEnd\noexpand\endinput}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
  \input infwarerr.sty\relax
  \input ifluatex.sty\relax
\else
  \RequirePackage{infwarerr}[2007/09/09]%
  \RequirePackage{ifluatex}[2009/04/10]%
\fi
\ifluatex
\else
  \@PackageError{luatex}{%
    This package may only be run using LuaTeX%
  }\@ehc
  \expandafter\LuT@AtEnd
\fi%
\ifnum\luatexversion<36 %
  \def\LuT@MakePrimitive#1{%
    \expandafter\let\csname luatex#1\expandafter\endcsname
    \csname #1\endcsname
  }%
\else
  \def\LuT@MakeLuatexPrimitive#1{%
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname luatex#1\endcsname\relax
      \begingroup\expandafter\expandafter\expandafter\endgroup
      \expandafter\ifx\csname #1\endcsname\relax
      \else
        \expandafter\let
        \csname luatex#1\expandafter\endcsname
        \csname #1\endcsname
      \fi
    \fi
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname luatex#1\endcsname\relax
      \begingroup
        \expandafter\let\csname luatex#1\endcsname\@undefined
        \ifnum0%
          \directlua{%
            if tex.enableprimitives then %
              tex.enableprimitives('luatex',{'#1'})%
              tex.print('1')%
            end%
          }%
          \expandafter\ifx\csname luatex#1\endcsname\relax\else1\fi
        =11 %
          \global\expandafter\let
          \csname luatex#1\expandafter\endcsname
          \csname luatex#1\endcsname
        \else
          \@PackageError{luatex}{%
            tex.enableprimitives failed for `#1'%
          }\@ehc
        \fi
      \endgroup
    \fi
  }%
  \def\LuT@MakePrimitive#1{%
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname#1\endcsname\relax
      \begingroup
        \expandafter\let\csname#1\endcsname\@undefined
        \ifnum0%
          \directlua{%
            if tex.enableprimitives then %
              tex.enableprimitives('',{'#1'})%
              tex.print('1')%
            end%
          }%
          \expandafter\ifx\csname#1\endcsname\relax\else1\fi
        =11 %
          \global\expandafter\let
          \csname#1\expandafter\endcsname
          \csname#1\endcsname
        \else
          \@PackageError{luatex}{%
            tex.enableprimitives failed for `#1'%
          }\@ehc
        \fi
      \endgroup
    \fi
  }%
\fi
\LuT@MakeLuatexPrimitive{attribute}
\LuT@MakeLuatexPrimitive{attributedef}
\LuT@MakeLuatexPrimitive{catcodetable}
\LuT@MakeLuatexPrimitive{initcatcodetable}
\LuT@MakeLuatexPrimitive{luaescapestring}
\LuT@MakeLuatexPrimitive{savecatcodetable}
\LuT@MakePrimitive{numexpr}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\else
  \RequirePackage{etex}[1998/03/26]%
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname et@xins\endcsname\relax
  \@PackageWarningNoLine{luatex}{%
    Support for eTeX is not loaded (etex.src)%
  }%
\else
  \def\LuT@temp#1{%
    \ifnum\count27#1=32768 %
      \count27#1=65536 %
    \fi
  }%
  \LuT@temp0%
  \LuT@temp1%
  \LuT@temp2%
  \LuT@temp3%
  \LuT@temp4%
  \LuT@temp5%
  \LuT@temp6%
  \let\newcount\globcount
  \let\newdimen\globdimen
  \let\newskip\globskip
  \let\newbox\globbox
\fi
\expandafter\ifx\csname @empty\endcsname\relax
  \def\@empty{}%
\fi
\expandafter\ifx\csname @gobble\endcsname\relax
  \long\def\@gobble#1{}%
\fi
\expandafter\ifx\csname @firstofone\endcsname\relax
  \long\def\@firstofone#1{#1}%
\fi
\expandafter\ifx\csname @firstoftwo\endcsname\relax
  \long\def\@firstoftwo#1#2{#1}%
\fi
\expandafter\ifx\csname @car\endcsname\relax
  \def\@car#1#2\@nil{#1}%
\fi
\expandafter\ifx\csname @cdr\endcsname\relax
  \def\@cdr#1#2\@nil{#2}%
\fi
\expandafter\ifx\csname @ifstar\endcsname\relax
  \def\@ifstar#1{%
    \@ifnextchar*{\@firstoftwo{#1}}%
  }%
  \long\def\@ifnextchar#1#2#3{%
    \let\reserved@d=#1%
    \def\reserved@a{#2}%
    \def\reserved@b{#3}%
    \futurelet\@let@token\@ifnch
  }%
  \def\@ifnch{%
    \ifx\@let@token\@sptoken
      \let\reserved@c\@xifnch
    \else
      \ifx\@let@token\reserved@d
        \let\reserved@c\reserved@a
      \else
        \let\reserved@c\reserved@b
      \fi
    \fi
    \reserved@c
  }%
  \let\LuT@temp\:%
  \def\:{\let\@sptoken= }%
  \: % explicit space
  \def\:{\@xifnch}%
  \expandafter\def\: {%
    \futurelet\@let@token\@ifnch
  }%
  \let\:\LuT@temp
\fi
\expandafter\ifx\csname @tempcnta\endcsname\relax
  \csname newcount\endcsname\@tempcnta
\fi
\expandafter\ifx\csname @tempcntb\endcsname\relax
  \csname newcount\endcsname\@tempcntb
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname newcommand\endcsname\relax
  \def\LuT@newcommand#1[#2]#3{%
    \ifx#1\@undefined
      \let#1\relax
    \else
      \ifx#1\relax
      \else
        \@PackageError{luatex}{%
          \string#1 is already defined.\MessageBreak
          Redefinition is skipped%
        }\@ehc
      \fi
    \fi
    \ifx#1\relax
      \ifcase#2 %
        \def#1{#3}%
      \or
        \def#1##1{#3}%
      \or
        \def#1##1##2{#3}%
      \or
        \def#1##1##2##3{#3}%
      \or
        \@INTERNAL@ERROR
      \fi
    \fi
  }%
\else
  \def\LuT@newcommand{\newcommand*}%
\fi
\newcount\LuT@AllocAttribute
\LuT@AllocAttribute=\m@ne
\LuT@newcommand\newattribute[1]{%
  \ifnum\LuT@AllocAttribute<65535 %
    \global\advance\LuT@AllocAttribute\@ne
    \allocationnumber\LuT@AllocAttribute
    \global\luatexattributedef#1=\allocationnumber
    \unsetattribute{#1}%
    \wlog{\string#1=\string\attribute\the\allocationnumber}%
  \else
    \errmessage{No room for a new \string\attribute}%
  \fi
}
\LuT@newcommand\setattribute[2]{%
  #1=\numexpr#2\relax
}
\ifnum\luatexversion<37
  \LuT@newcommand\LuT@UnsetAttributeValue[0]{}%
  \let\LuT@UnsetAttributeValue\m@ne
\else
  \LuT@newcommand\LuT@UnsetAttributeValue[0]{-2147483647 }%
\fi
\LuT@newcommand\unsetattribute[1]{%
  #1=\LuT@UnsetAttributeValue
}
\newcount\LuT@AllocCatcodeTable
\LuT@AllocCatcodeTable=\m@ne
\newcount\CatcodeTableStack
\CatcodeTableStack=\z@
\LuT@newcommand\newcatcodetable[1]{%
  \ifnum\LuT@AllocCatcodeTable<1114110 % 0x10FFFF is maximal \chardef
    % or < 268435455 % 2^28 - 1
    \global\advance\LuT@AllocCatcodeTable by\tw@
    \allocationnumber=\LuT@AllocCatcodeTable
    \global\chardef#1=\allocationnumber
    \wlog{%
      \string#1=\string\catcodetable\the\allocationnumber
    }%
  \else
    \errmessage{No room for a new \string\catcodetable}%
  \fi
}%
\LuT@newcommand\IncCatcodeTableStack[0]{%
  \ifnum\CatcodeTableStack<268435454 %
    \global\advance\CatcodeTableStack by\tw@
  \else
    \@PackageError{luatex}{%
      Catcode table stack overflow%
    }\@ehd
  \fi
}
\LuT@newcommand\DecCatcodeTableStack[0]{%
  \ifnum\CatcodeTableStack>\z@
    \global\advance\CatcodeTableStack by-2 %
  \else
    \@PackageError{luatex}{%
      Catcode table stack is empty%
    }\@ehd
  \fi
}
\LuT@newcommand\SetCatcodeRange[3]{%
  \edef\LuT@temp{%
    \noexpand\@tempcnta=\the\@tempcnta
    \noexpand\@tempcntb=\the\@tempcntb
    \noexpand\count@=\the\count@
    \relax
  }%
  \@tempcnta=\numexpr#1\relax
  \@tempcntb=\numexpr#2\relax
  \count@=\numexpr#3\relax
  \loop
    \unless\ifnum\@tempcnta>\@tempcntb
    \catcode\@tempcnta=\count@
    \advance\@tempcnta by \@ne
  \repeat
  \LuT@temp
}
\newcatcodetable\CatcodeTableIniTeX
\newcatcodetable\CatcodeTableString
\newcatcodetable\CatcodeTableOther
\newcatcodetable\CatcodeTableLaTeX
\luatexinitcatcodetable\CatcodeTableIniTeX
\begingroup
  \def\@makeother#1{\catcode#1=12\relax}%
  \@firstofone{%
    \luatexcatcodetable\CatcodeTableIniTeX
    \begingroup
      \SetCatcodeRange{0}{8}{15}%
      \catcode9=10 % tab
      \catcode11=15 %
      \catcode12=13 % form feed
      \SetCatcodeRange{14}{31}{15}%
      \catcode35=6 % hash
      \catcode36=3 % dollar
      \catcode38=4 % ampersand
      \catcode94=7 % circumflex
      \catcode95=8 % underscore
      \catcode123=1 % brace left
      \catcode125=2 % brace right
      \catcode126=13 % tilde
      \catcode127=15 %
      \luatexsavecatcodetable\CatcodeTableLaTeX
    \endgroup
    \@makeother{0}% nul
    \@makeother{13}% carriage return
    \@makeother{37}% percent
    \@makeother{92}% backslash
    \@makeother{127}%
    \SetCatcodeRange{65}{90}{12}% A-Z
    \SetCatcodeRange{97}{122}{12}% a-z
    \luatexsavecatcodetable\CatcodeTableString
    \@makeother{32}% space
    \luatexsavecatcodetable\CatcodeTableOther
  \endgroup
}%
\def\LuT@NumStackEmpty{0}
\let\LuT@NumStack\LuT@NumStackEmpty
\LuT@newcommand\PushCatcodeTableNumStack[0]{%
  \xdef\LuT@NumStack{%
    {\the\luatexcatcodetable}\LuT@NumStack
  }%
}
\LuT@newcommand\PopCatcodeTableNumStack[0]{%
  \ifx\LuT@NumStack\LuT@NumStackEmpty
    \@PackageWarning{luatex}{Empty catcode table number stack}%
    \luatexcatcodetable\z@
  \else
    \luatexcatcodetable=\expandafter\@car\LuT@NumStack\@nil\relax
    \xdef\LuT@NumStack{%
      \expandafter\@cdr\LuT@NumStack\@nil
    }%
  \fi
}
\LuT@newcommand\BeginCatcodeRegime[1]{%
  \PushCatcodeTableNumStack
  \luatexcatcodetable=\numexpr#1\relax
  \IncCatcodeTableStack
  \luatexsavecatcodetable\CatcodeTableStack
  \luatexcatcodetable\CatcodeTableStack
}
\LuT@newcommand\EndCatcodeRegime[0]{%
  \DecCatcodeTableStack
  \PopCatcodeTableNumStack
}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
  \input luatex-loader.sty\relax
\else
  \RequirePackage{luatex-loader}[2010/03/09]%
\fi
\LuT@AtEnd%
\endinput
%%
%% End of file `luatex.sty'.
