diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty | 75 |
1 files changed, 55 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty index c33ae6a1c61..d9f7e287f5c 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty @@ -52,7 +52,7 @@ \let\x\ProvidesPackage \fi \expandafter\endgroup -\x{luatexbase-modutils}[2010/05/27 v0.2a Module utilities for LuaTeX] +\x{luatexbase-modutils}[2010/10/10 v0.3 Module utilities for LuaTeX] \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname RequirePackage\endcsname\relax \input ifluatex.sty @@ -61,37 +61,72 @@ \fi \ifluatex\else \begingroup - \expandafter\ifx\csname PackageWarningNoLine\endcsname\relax - \def\x#1#2{\begingroup\newlinechar10 - \immediate\write16{Package #1 warning: #2}\endgroup} + \expandafter\ifx\csname PackageError\endcsname\relax + \def\x#1#2#3{\begingroup \newlinechar10 + \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} \else - \let\x\PackageWarningNoLine + \let\x\PackageError \fi \expandafter\endgroup - \x{luatexbase-modutils}{LuaTeX is required for this package. Aborting.} + \x{luatexbase-attr}{LuaTeX is required for this package. Aborting.}{% + This package can only be used with the LuaTeX engine^^J% + (command `lualatex' or `luatex').^^J% + Package loading has been stopped to prevent additional errors.} \lltxb@modutils@AtEnd \expandafter\endinput \fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-loader.sty -\else +\ifdefined\RequirePackage \RequirePackage{luatexbase-loader} +\else + \input luatexbase-loader.sty \fi \luatexbase@directlua{require('luatexbase.modutils')} \luatexbase@ensure@primitive{luaescapestring} -\def\luatexUseModule#1{\luatexbase@directlua{% - luatexbase.use_module("\luatexluaescapestring{#1}")}} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname newcommand\endcsname\relax - \def\luatexRequireModule#1#2{% - \luatexbase@directlua{luatexbase.require_module( - "\luatexluaescapestring{#1}", "\luatexluaescapestring{#2}")}} +\ifdefined\kernel@ifnextchar + \let\lltxb@ifnextchar\kernel@ifnextchar \else - \newcommand\luatexRequireModule[2][0]{% - \luatexbase@directlua{luatexbase.require_module( - "\luatexluaescapestring{#2}", "\luatexluaescapestring{#1}")}} + \chardef\lltxb@zero0 + \chardef\lltxb@two2 + \long\def\lltxb@ifnextchar#1#2#3{% + \begingroup + \let\lltxb@CharToken= #1\relax + \toks\lltxb@zero{#2}% + \toks\lltxb@two{#3}% + \futurelet\lltxb@LetToken\lltxb@ifnextchar@ + } + \def\lltxb@ifnextchar@{% + \ifx\lltxb@LetToken\lltxb@CharToken + \expandafter\endgroup\the\toks\expandafter\lltxb@zero + \else + \ifx\lltxb@LetToken\lltxb@SpaceToken + \expandafter\expandafter\expandafter\lltxb@@ifnextchar + \else + \expandafter\endgroup\the\toks + \expandafter\expandafter\expandafter\lltxb@two + \fi + \fi + } + \begingroup + \def\x#1{\endgroup + \def\lltxb@@ifnextchar#1{% + \futurelet\lltxb@LetToken\lltxb@ifnextchar@ + }% + }% + \x{ } + \begingroup + \def\x#1{\endgroup + \let\lltxb@SpaceToken= #1% + }% + \x{ } \fi +\def\RequireLuaModule#1{% + \lltxb@ifnextchar[{\lltxb@requirelua{#1}}{\lltxb@requirelua{#1}[]}} +\def\lltxb@requirelua#1[#2]{% + \luatexbase@directlua{luatexbase.require_module( + "\luatexluaescapestring{#1}" + \expandafter\ifx\expandafter\/\detokenize{#2}\/\else + , "\luatexluaescapestring{#2}" + \fi)}} \lltxb@modutils@AtEnd \endinput %% |