From 326e706a1aab60c8759d18732d105d26d3879352 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 24 May 2011 23:30:42 +0000 Subject: luacode (24may11) git-svn-id: svn://tug.org/texlive/trunk@22605 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/lualatex/luacode/News | 3 + Master/texmf-dist/doc/lualatex/luacode/luacode.pdf | Bin 361377 -> 361338 bytes Master/texmf-dist/source/lualatex/luacode/Makefile | 4 +- .../texmf-dist/source/lualatex/luacode/luacode.dtx | 80 +++++++++++---------- Master/texmf-dist/tex/lualatex/luacode/luacode.sty | 55 +++++++------- 5 files changed, 79 insertions(+), 63 deletions(-) diff --git a/Master/texmf-dist/doc/lualatex/luacode/News b/Master/texmf-dist/doc/lualatex/luacode/News index f5e2e65989d..c7d1e0ccfce 100644 --- a/Master/texmf-dist/doc/lualatex/luacode/News +++ b/Master/texmf-dist/doc/lualatex/luacode/News @@ -1,2 +1,5 @@ +2011/05/24 v1.1 + * compatibility with luatexbase 0.4 + 2010/11/08 v1.0 * initial version diff --git a/Master/texmf-dist/doc/lualatex/luacode/luacode.pdf b/Master/texmf-dist/doc/lualatex/luacode/luacode.pdf index dd6c072b383..2a211e20bb4 100644 Binary files a/Master/texmf-dist/doc/lualatex/luacode/luacode.pdf and b/Master/texmf-dist/doc/lualatex/luacode/luacode.pdf differ diff --git a/Master/texmf-dist/source/lualatex/luacode/Makefile b/Master/texmf-dist/source/lualatex/luacode/Makefile index ba571fd3225..86534b2bad9 100644 --- a/Master/texmf-dist/source/lualatex/luacode/Makefile +++ b/Master/texmf-dist/source/lualatex/luacode/Makefile @@ -34,7 +34,7 @@ world: ctan .PHONY: all doc unpack ctan tds check world %.pdf: %.dtx - latexmk -silent $< >/dev/null + latexmk -pdf -silent $< >/dev/null $(UNPACKED): $(DTX) tex -interaction=batchmode $< >/dev/null @@ -70,7 +70,7 @@ install: check $(ALL) clean: @latexmk -silent -c $(DTX) >/dev/null - @rm -f -- *.log + @rm -f -- test-*.log test-*.aux test-*.pdf mrproper: clean @rm -f -- $(GENERATED) $(ZIPS) diff --git a/Master/texmf-dist/source/lualatex/luacode/luacode.dtx b/Master/texmf-dist/source/lualatex/luacode/luacode.dtx index 0f78f04753c..498d5840768 100644 --- a/Master/texmf-dist/source/lualatex/luacode/luacode.dtx +++ b/Master/texmf-dist/source/lualatex/luacode/luacode.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment (by the way, this file is contains UTF-8) % -% Written in 2010 by Manuel Pégourié-Gonnard +% Written in 2010, 2011 by Manuel Pégourié-Gonnard % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -140,29 +140,29 @@ See the source file for author and licensing information. % % For an introduction to the most important gotchas of |\directlua|, see % \file{lualatex-doc.pdf}. Before presenting the tools in this package, let me -% insist that the most robust way to manage a non-trivial piece of Lua code is -% to use an external file and source it from Lua, as explained in the cited -% document. +% insist that the best way to manage a non-trivial piece of Lua code is +% probably to use an external file and source it from Lua, as explained in the +% cited document. % % \medskip % % First, the exact syntax of |\directlua| has changed along version of % Lua\TeX, so this package provides a |\luadirect| command which is an exact % synonym of |\directlua| except that it doesn't have the funny, changing -% parts of its syntax.\footnote{And also, it expands in two steps instead of -% one. If you don't known what it means, then you probably don't need to.} +% parts of its syntax.\footnote{And it expands in two steps If you don't known +% what it means, then you hopefully don't need to.} % % The problems with |\directlua| (or |\luadirect|) are mainly with \TeX\ % special characters. Actually, things are not that bad, since most special % characters do work, namely: |_|, |^|, |&|, \verb+$+, |{|, |}|. Three are a % bit tricky but they can be managed with |\string|: |\| and |~|. Only |%| is % really hard to obtain. Also, \TeX\ macros are expanded, which is good since -% it allows to pass information from \TeX\ to Lua, but you must be carefull +% it allows to pass information from \TeX\ to Lua, but you must be careful % and use only purely expandable macros. % % The |\luaexec| command is similar to |\luadirect| but with a few additional % features:\footnote{And one major drawback: it is not purely expandable. See -% above.} |\\| gives a double blackslash (convenient in Lua strings), |\%| a +% above.} |\\| gives a double backslash (convenient in Lua strings), |\%| a % percent character, and |~| just works. If you happen to need a single % backslash, you can still use a construct like |\string\n| just as with % |\luadirect|. Also, \TeX\ macros are expanded. @@ -217,44 +217,46 @@ See the source file for author and licensing information. % Catcode defenses. % % \begin{macrocode} -\begingroup +\begingroup\catcode61\catcode48\catcode32=10\relax% = and space \catcode123 1 % { \catcode125 2 % } \catcode 35 6 % # - \toks0{}% - \def\x{}% + \toks0{\endlinechar\the\endlinechar}% + \edef\x{\endlinechar13}% \def\y#1 #2 {% \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% \edef\x{\x \catcode#1 #2}}% - \y 123 1 % { - \y 125 2 % } - \y 35 6 % # - \y 10 12 % ^^J - \y 34 12 % " - \y 36 3 % $ $ + \y 13 5 % carriage return + \y 61 12 % = + \y 32 10 % space + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 64 11 % @ (letter) \y 39 12 % ' \y 40 12 % ( \y 41 12 % ) \y 42 12 % * - \y 43 12 % + - \y 44 12 % , \y 45 12 % - \y 46 12 % . \y 47 12 % / - \y 60 12 % < - \y 61 12 % = - \y 64 11 % @ (letter) - \y 62 12 % > - \y 95 12 % _ (other!) + \y 91 12 % [ + \y 93 12 % ] + \y 94 7 % ^ \y 96 12 % ` - \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% -\expandafter\y\csname luacode@AtEnd\endcsname + \y 126 13 % ~ + \toks0\expandafter{\the\toks0 \relax\noexpand\endinput}% + \edef\y#1{\noexpand\expandafter\endgroup% + \noexpand\ifx#1\relax \edef#1{\the\toks0}\x\relax% + \noexpand\else \noexpand\expandafter\noexpand\endinput% + \noexpand\fi}% +\expandafter\y\csname luacode@sty@endinput\endcsname% % \end{macrocode} % % Package declaration. % % \begin{macrocode} -\ProvidesPackage{luacode}[2010/11/08 v1.0 lua-in-tex helpers (mpg)] +\ProvidesPackage{luacode}[2011/05/24 v1.0 lua-in-tex helpers (mpg)] % \end{macrocode} % % Make sure Lua\TeX\ is used. @@ -266,17 +268,14 @@ See the source file for author and licensing information. This package can only be used with the LuaTeX engine\MessageBreak (command `lualatex'). Package loading has been stopped\MessageBreak to prevent additional errors.} - \lltxb@core@AtEnd - \expandafter\endinput + \expandafter\luacode@sty@endinput \fi % \end{macrocode} % -% Use \pk{luatexbase} for catcode tables, and ensure we have the primitives -% we need. +% Use \pk{luatexbase} for catcode tables. % % \begin{macrocode} \RequirePackage{luatexbase} -\luatexbase@ensure@primitive{scantextokens}% % \end{macrocode} % % \subsection{Internal code} @@ -344,7 +343,7 @@ See the source file for author and licensing information. % depending on the current catcode regime. So we collect it linewise and % check each line against the end marker. % -% Sotrage for lines. +% Storage for lines. % % \begin{macrocode} \newtoks\luacode@lines @@ -407,16 +406,25 @@ See the source file for author and licensing information. % everything other, except backslash, braces and letters which retain their % natural catcodes. % +% Be carefull about the name of the macro for setting catcode ranges which +% is currently changing in luatexbase. The group here doesn't matter since +% catcode table settings are always global. +% % \begin{macrocode} \newluatexcatcodetable \luacode@table@soft +\begingroup +\ifdefined\SetCatcodeRange \else + \let\SetCatcodeRange\setcatcoderange +\fi \setluatexcatcodetable \luacode@table@soft {% \luatexcatcodetable\CatcodeTableOther \catcode 92 0 \catcode 123 1 \catcode 125 2 - \setcatcoderange {65}{90} {11} - \setcatcoderange {97}{122}{11} + \SetCatcodeRange {65}{90} {11} + \SetCatcodeRange {97}{122}{11} } +\endgroup % \end{macrocode} % % \subsection{Public macros and environments} @@ -440,7 +448,7 @@ See the source file for author and licensing information. % We're already done! % % \begin{macrocode} -\luacode@AtEnd +\luacode@sty@endinput % % \end{macrocode} % diff --git a/Master/texmf-dist/tex/lualatex/luacode/luacode.sty b/Master/texmf-dist/tex/lualatex/luacode/luacode.sty index 8f513dd56ee..68f281f425f 100644 --- a/Master/texmf-dist/tex/lualatex/luacode/luacode.sty +++ b/Master/texmf-dist/tex/lualatex/luacode/luacode.sty @@ -8,50 +8,50 @@ %% %% See the source file for author and licensing information. %% -\begingroup +\begingroup\catcode61\catcode48\catcode32=10\relax% = and space \catcode123 1 % { \catcode125 2 % } \catcode 35 6 % # - \toks0{}% - \def\x{}% + \toks0{\endlinechar\the\endlinechar}% + \edef\x{\endlinechar13}% \def\y#1 #2 {% \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% \edef\x{\x \catcode#1 #2}}% - \y 123 1 % { - \y 125 2 % } - \y 35 6 % # - \y 10 12 % ^^J - \y 34 12 % " - \y 36 3 % $ $ + \y 13 5 % carriage return + \y 61 12 % = + \y 32 10 % space + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 64 11 % @ (letter) \y 39 12 % ' \y 40 12 % ( \y 41 12 % ) \y 42 12 % * - \y 43 12 % + - \y 44 12 % , \y 45 12 % - \y 46 12 % . \y 47 12 % / - \y 60 12 % < - \y 61 12 % = - \y 64 11 % @ (letter) - \y 62 12 % > - \y 95 12 % _ (other!) + \y 91 12 % [ + \y 93 12 % ] + \y 94 7 % ^ \y 96 12 % ` - \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% -\expandafter\y\csname luacode@AtEnd\endcsname -\ProvidesPackage{luacode}[2010/11/08 v1.0 lua-in-tex helpers (mpg)] + \y 126 13 % ~ + \toks0\expandafter{\the\toks0 \relax\noexpand\endinput}% + \edef\y#1{\noexpand\expandafter\endgroup% + \noexpand\ifx#1\relax \edef#1{\the\toks0}\x\relax% + \noexpand\else \noexpand\expandafter\noexpand\endinput% + \noexpand\fi}% +\expandafter\y\csname luacode@sty@endinput\endcsname% +\ProvidesPackage{luacode}[2011/05/24 v1.0 lua-in-tex helpers (mpg)] \RequirePackage{ifluatex} \ifluatex\else \PackageError{luacode}{LuaTeX is required for this package. Aborting.}{% This package can only be used with the LuaTeX engine\MessageBreak (command `lualatex'). Package loading has been stopped\MessageBreak to prevent additional errors.} - \lltxb@core@AtEnd - \expandafter\endinput + \expandafter\luacode@sty@endinput \fi \RequirePackage{luatexbase} -\luatexbase@ensure@primitive{scantextokens}% \begingroup \catcode`\~\active \expandafter\endgroup \@firstofone{% \newcommand*\luacode@execute [1] {% @@ -120,21 +120,26 @@ \def \luacode@strip@sp@def #1\@nil{% \def\luacode@curr{#1}} \newluatexcatcodetable \luacode@table@soft +\begingroup +\ifdefined\SetCatcodeRange \else + \let\SetCatcodeRange\setcatcoderange +\fi \setluatexcatcodetable \luacode@table@soft {% \luatexcatcodetable\CatcodeTableOther \catcode 92 0 \catcode 123 1 \catcode 125 2 - \setcatcoderange {65}{90} {11} - \setcatcoderange {97}{122}{11} + \SetCatcodeRange {65}{90} {11} + \SetCatcodeRange {97}{122}{11} } +\endgroup \@ifdefinable\luadirect {\let\luadirect\luatexbase@directlua} \newcommand*\luaexec [1] {\luacode@execute{#1}} \newenvironment {luacode} {\luacode@begin\luacode@table@soft} {} \newenvironment {luacode*} {\luacode@begin\CatcodeTableOther} {} \newcommand \luacodestar {\@nameuse{luacode*}} \def \endluacodestar {\@nameuse{endluacode*}} -\luacode@AtEnd +\luacode@sty@endinput \endinput %% %% End of file `luacode.sty'. -- cgit v1.2.3