diff options
56 files changed, 1119 insertions, 7873 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexbase/NEWS b/Master/texmf-dist/doc/luatex/luatexbase/NEWS deleted file mode 100644 index 311ed94f9dd..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/NEWS +++ /dev/null @@ -1,158 +0,0 @@ - Changes in the luatexbase package/bundle - -2013/05/11 v0.6 - all - - move away from the module() function (deprecated in Lua 5.2) - - attr, loader and cctb now use provides_module - attr - - hack to make luatexbase and luatex.sty compatible for attribute - allocation (same thing should be done for catcodetables) - - adding user-defined whatsit node allocation functions (see doc) - modutils - - adding functions to check the availability and version of a module - - fixing small error in module date requirement - - update documentation to reflect the move from module() - loader - - do not output included file paths when called by texlua - mcb - - passing most of the term output to the log - -2013/04/13 v0.5 - all - - input luatex.sty before doing anything, as luatex.sty - breaks if loaded after luatexbase - mcb and loader - - compatibility with Lua 5.2 (LuaTeX >= 0.74) - loader - - fix an important bug making the kpse lua loader never used, - it should make package searching a bit faster. - - dropping support for LuaTeX < 0.45. - - small improvement to make x.y.lua look for x/y.lua, not - x/y/lua. - modutils - - fixing a bug printing "luatexbase-attr" in all documents - in plain TeX - -2011/05/24 v0.4 - cctb - - implement catcode table stacks à la luatex.sty - - fix \CatcodeTableLaTeX(Package): 10 (newline aka ^^J) was catcoded - 15 instead of 12 - - rename \setcatcoderange to \SetCatcodeRange (the old name remains - for compatibility but will be removed in the next version) - luatex 0.5 - - new package replacing luatex.sty from the oberdiek bundle - (see luatex.pdf for details) - -2011/05/21 v0.31 - attr - - Bugfix: \unsetluatexattribute didn't work (reported by Dohyun Kim) - -2010/10/10 v0.3 - [BI] marks backward-incompatible changes - all not using LuaTeX results in an error (formerly a warning) - modutils - - [BI] \luatexUseModule and \luatexRequireModule replaced by - \RequireLuaModule with a unified syntax. - - [BI] luatexbase.use_module removed (use luatexbase.require_module with - a single argument instead). - - [BI] luatexbase.module_term removed. - - [BI] removed support for version check using a floating point - number, only date is supported now. - - module_{error,warning,info,log} now apply string.format - automatically - - date, version and description are now optional. - - improved formatting of messages. - - luatexbase.require_module now returns curstom err/war/inf functions. - mcb - - [BI] rationalise "list"-type callbacks handling. The new calling - convention differs from the old one only in edge cases. - - add user documentation - - misc code tuning (more locals, etc) - -2010/10/04 - - various documentation updates/fixes uploaded to CTAN - - luatexbase.sty used to be broken on CTAN (bad docstrip) - -2010/05/27 v0.2a - attr - - allocate from 1 to avoid problems with some external code - - provide a Lua interface: new_attribute() and unset_attribute(). - modutils - - fix bug with module require_module()-ed many times. - luatexbase - - new, loads: compat,loader,regs,attr,cctb. - -[BI] Summary of backwards-incompatible interface changes between 0.1 and 0.2: - - Lua objects are now in table luatexbase, not luatextra. - - Lua tables tex.attributenumber and tex.catcodetablenumber are not - created any more, use their couterparts in luatexbase. - - \luatexsetcatcoderange has been renamed to \setcatcoderange. - - luamcallbacks has been renamed; Lua objects are now in luatexbase, - no more in callback.* or luamcallbacks.* - - module error/warning etc now apply string.format to the arguments. - -2010/05/12 v0.2 - all - - use luatexbase as the Lua module name - - change the filename of the lua module (suppress luatexbase.) - - load luatexbase-compat - luatexbase-compat - - new - luatexbase-attr - - don't create tex.attributenumber - - load luatexbase-compat - luatexbase-cctb - - don't create tex.catcodetablenumber - - rename \luatexsetcatcoderange to \setcatcoderange - - load lua-compat - luamcallbacks -> luatexbase-mcb - - rename package, new version numbering starting at 0.2 - - functions are now in luatexbase rather than luamcallbacks, they - are no more copied to callbacks either - - lua objects are now local (except for the public interface) - - test file now for plain and latex - luatexbase-loader - - require"foo.bar" now looks for foo/bar then foo.bar, see doc for - details - - better cooperation with the original package loader - - works with luatex 0.25.4 - luatexbase-modutils - - module error/warning etc now apply string.format to the arguments. - - use error() instead of \errmessage. - -2010/03/28 - luatexbase-* - - add catcode defenses - -2010/03/27 - luatexbase-loader 0.1 - - add very minimal test files for luatex and lualatex - luatexbase-modutils 0.1 - - add minimal test files for luatex and lualatex - - use require() (with luatexbase-loader) for loading - luatexbase-attr, luatexbase-cctb, luamcallbacks (test file) - - use luatexbase-loader - -2010/03/26 - luatexbase-cctb 0.1 - - add minimal test files for luatex and lualatex - - fix allocation range (1->65535) - - make sure newly allocated tables are initialised - - fix sensitivity to the current value of \escapechar - - new macro \setluatexcatcodetable - -2010/03/11 - luatexbase-attrs 0.1 - - add minimal test files for luatex and lualatex - - make sure newly allocated attributes are unset - - fix sensitivity to the current value of \escapechar - -2010/01/21 - luatexbase-regs 0.1 - - add test files for luatex and lualatex - - extend registers with Plain-based format too - - fix \box and \marks allocation (\mathchardef -> \chardef) - - fix \*blk macros (\mathchardef -> \chardef) - -Version 0 of the bundle is part of the 2010/01/12 version of luatextra. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/README b/Master/texmf-dist/doc/luatex/luatexbase/README deleted file mode 100644 index cb3c8bacdca..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/README +++ /dev/null @@ -1,43 +0,0 @@ - The luatexbase generic package for LuaTeX - - -This package provides resource management for the LuaTeX macro programmer. -It is composed of the following sub-packages, which can be used independantly -if desired: - -– luatexbase-compat: compatibility helpers; -– luatexbase-loader: Lua module loading; -– luatexbase-regs: allocation of registers and the like; -– luatexbase-attr: attribute and whatsit node allocation; -– luatexbase-cctb: catcode table allocation; -– luatexbase-modutils: Lua module declaration; and -– luatexbase-mcb: callbacks extensions. - -The development takes place on https://github.com/lualatex/luatexbase. - - -Installation ------------- - -Here are the recommended installation methods (preferred first). - -1. If you are using TeX Live 2010 or later, use 'tlmgr install luatexbase'. - If your are using MiKTeX, use the MiKTeX Package Manager. - Alternatively, try you Linux distribution's package management system. - -2. a. Grab the sources from CTAN or github. - b. Run 'make install TEXMFROOT=/path/to/texmf'. - (Warning: 'make install' without giving a TEXMFROOT will - put files in './texmf', which is probably not what you want.) - c. See 2c. - - -License -------- - -This work and the derived files are under the Creative Commons CC0 license, -which is as close to public domain as possible in the country of the authors. -See the full text [1] or the FAQ [2]. - -[1]: http://creativecommons.org/publicdomain/zero/1.0/legalcode -[2]: http://wiki.creativecommons.org/CC0 diff --git a/Master/texmf-dist/doc/luatex/luatexbase/README.md b/Master/texmf-dist/doc/luatex/luatexbase/README.md new file mode 100644 index 00000000000..bbcb8d46543 --- /dev/null +++ b/Master/texmf-dist/doc/luatex/luatexbase/README.md @@ -0,0 +1,7 @@ +The LaTeX kernel (LaTeX2e 2015/10/01 onward) builds in support for +LuaTeX functionality, also available as `ltluatex.tex` for users for +users of plain TeX and those with older LaTeX kernel implementations. +This support is based on ideas taken from the original `luatexbase` +package, but there are interface differences. This 'stub' package +provides a compatibility layer to allow existing packages to upgrade +smoothly to the new support structure. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/TODO b/Master/texmf-dist/doc/luatex/luatexbase/TODO deleted file mode 100644 index 1f368269f32..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/TODO +++ /dev/null @@ -1,50 +0,0 @@ -Next actions ------------- - -- Coordinate release with Heiko (luatex-loader?) - -all ---- - -- use infwarerr -- use ltxcmds? -- \lltxb as a prefix means nothing -- regression checks on the results of the tests (sed+diff the log) - or generalise use of qstest -- add debug messages to be used in the test suite? -- mark all occurences of version-dependent stuff in the code -- support the syntax foo = require"foo" in modutils? How? - -compat ------- - -- import some error checking from Heiko's \LuT@MakeLuatexPrimitive? - -modutils --------- - -- make `\listfiles` show Lua modules? or provide \listluafiles for that - -cctb ----- - -- support for unicode-letters? -- make the functions compatible with luatex.sty - -mcb ---- - -- add an analogue of `callback.find()`, see #4 -- revise priority system: use real numbers and don't change them -- provide a list()? -- allow temporary disabling of callbacks -- do something with open_read_file etc -- make callback.register = luatexbase_add_to_callback? -- check if there are functions in the callbacks before luatexbase is loaded - and import them - -bytecode registers ------------------- - -- create submodule for that (really? is it useful at all?) -- only lua interface, most probably diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-attr.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-attr.pdf Binary files differdeleted file mode 100644 index 1652ce46df6..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-attr.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-cctb.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-cctb.pdf Binary files differdeleted file mode 100644 index 580675eaa7a..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-cctb.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-compat.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-compat.pdf Binary files differdeleted file mode 100644 index ed69d0ad92a..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-compat.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-loader.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-loader.pdf Binary files differdeleted file mode 100644 index e1a32480b42..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-loader.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-mcb.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-mcb.pdf Binary files differdeleted file mode 100644 index 2013298330f..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-mcb.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-modutils.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-modutils.pdf Binary files differdeleted file mode 100644 index 70f80dd3ec4..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-modutils.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-regs.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-regs.pdf Binary files differdeleted file mode 100644 index 95ed519e71d..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase-regs.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase.pdf b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase.pdf Binary files differindex 5393aecd59e..bec42aeb82a 100644 --- a/Master/texmf-dist/doc/luatex/luatexbase/luatexbase.pdf +++ b/Master/texmf-dist/doc/luatex/luatexbase/luatexbase.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-attr-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-attr-latex.tex deleted file mode 100644 index 4904a085974..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-attr-latex.tex +++ /dev/null @@ -1,30 +0,0 @@ -%% -%% This is file `test-attr-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-attr.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase-attr} -\newluatexattribute\testattr -\setluatexattribute\testattr{1} -\ifnum\testattr=1 \else \ERROR \fi -\unsetluatexattribute\testattr -\ifnum\testattr<0 \else \ERROR \fi -\catcode64 11 -\luatexbase@directlua{assert(luatexbase.attributes.testattr)} -\luatexbase@directlua{luatexbase.new_attribute('luatestattr')} -\luatexbase@directlua{assert(luatexbase.attributes.luatestattr)} -\begingroup -\escapechar64 -\newluatexattribute\anotherattr -\endgroup -\setluatexattribute\anotherattr{1} -\luatexbase@directlua{assert(luatexbase.attributes.anotherattr)} -\stop -\endinput -%% -%% End of file `test-attr-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-attr-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-attr-plain.tex deleted file mode 100644 index 5d8d2026929..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-attr-plain.tex +++ /dev/null @@ -1,30 +0,0 @@ -%% -%% This is file `test-attr-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-attr.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase-attr.sty -\newluatexattribute\testattr -\setluatexattribute\testattr{1} -\ifnum\testattr=1 \else \ERROR \fi -\unsetluatexattribute\testattr -\ifnum\testattr<0 \else \ERROR \fi -\catcode64 11 -\luatexbase@directlua{assert(luatexbase.attributes.testattr)} -\luatexbase@directlua{luatexbase.new_attribute('luatestattr')} -\luatexbase@directlua{assert(luatexbase.attributes.luatestattr)} -\begingroup -\escapechar64 -\newluatexattribute\anotherattr -\endgroup -\setluatexattribute\anotherattr{1} -\luatexbase@directlua{assert(luatexbase.attributes.anotherattr)} -\bye -\endinput -%% -%% End of file `test-attr-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-base-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-base-latex.tex deleted file mode 100644 index f543bb11ab4..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-base-latex.tex +++ /dev/null @@ -1,15 +0,0 @@ -%% -%% This is file `test-base-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase} -\stop -\endinput -%% -%% End of file `test-base-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-base-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-base-plain.tex deleted file mode 100644 index 5167d5b00e4..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-base-plain.tex +++ /dev/null @@ -1,15 +0,0 @@ -%% -%% This is file `test-base-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase.sty -\bye -\endinput -%% -%% End of file `test-base-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-cctb-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-cctb-latex.tex deleted file mode 100644 index da360ddb585..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-cctb-latex.tex +++ /dev/null @@ -1,50 +0,0 @@ -%% -%% This is file `test-cctb-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-cctb.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\catcode00 15 -\RequirePackage{luatexbase-cctb} -\begingroup \catcode64 11 \global\let\lua\luatexbase@directlua \endgroup - -\newluatexcatcodetable\testcctb -\lua{assert(luatexbase.catcodetables.testcctb)} -\begingroup -\escapechar64 -\newluatexcatcodetable\anothercctb -\endgroup -\lua{assert(luatexbase.catcodetables.anothercctb)} -\def\test#1#2#3{% - \begingroup - \ifcsname CatcodeTable#1\endcsname \else \INTERR \fi - \luatexcatcodetable\csname CatcodeTable#1\endcsname - \ifnum\catcode#2=#3 \else \ERROR \fi - \endgroup} -\test {IniTeX} {00} {09} -\test {IniTeX} {92} {00} -\test {IniTeX} {64} {12} -\test {IniTeX} {65} {11} -\test {String} {92} {12} -\test {String} {65} {12} -\test {String} {32} {10} -\test {Other} {92} {12} -\test {Other} {65} {12} -\test {Other} {32} {12} -\test {LaTeXAtLetter} {64} {11} -\test {LaTeX} {64} {12} -\test {Expl} {32} {09} -\documentclass{minimal} -\lua{% - tex.sprint('\string\\setbox0=\string\\hbox{') - tex.sprint(luatexbase.catcodetables.string, "\string\\undef # _^&") - tex.sprint('}') - } -\stop -\endinput -%% -%% End of file `test-cctb-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-cctb-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-cctb-plain.tex deleted file mode 100644 index ae37b2a0425..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-cctb-plain.tex +++ /dev/null @@ -1,49 +0,0 @@ -%% -%% This is file `test-cctb-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-cctb.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\catcode00 15 -\input luatexbase-cctb.sty -\begingroup \catcode64 11 \global\let\lua\luatexbase@directlua \endgroup - -\newluatexcatcodetable\testcctb -\lua{assert(luatexbase.catcodetables.testcctb)} -\begingroup -\escapechar64 -\newluatexcatcodetable\anothercctb -\endgroup -\lua{assert(luatexbase.catcodetables.anothercctb)} -\def\test#1#2#3{% - \begingroup - \ifcsname CatcodeTable#1\endcsname \else \INTERR \fi - \luatexcatcodetable\csname CatcodeTable#1\endcsname - \ifnum\catcode#2=#3 \else \ERROR \fi - \endgroup} -\test {IniTeX} {00} {09} -\test {IniTeX} {92} {00} -\test {IniTeX} {64} {12} -\test {IniTeX} {65} {11} -\test {String} {92} {12} -\test {String} {65} {12} -\test {String} {32} {10} -\test {Other} {92} {12} -\test {Other} {65} {12} -\test {Other} {32} {12} -\test {LaTeXAtLetter} {64} {11} -\test {LaTeX} {64} {12} -\test {Expl} {32} {09} -\lua{% - tex.sprint('\string\\setbox0=\string\\hbox{') - tex.sprint(luatexbase.catcodetables.string, "\string\\undef # _^&") - tex.sprint('}') - } -\bye -\endinput -%% -%% End of file `test-cctb-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-compat-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-compat-latex.tex deleted file mode 100644 index d6e53db0037..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-compat-latex.tex +++ /dev/null @@ -1,21 +0,0 @@ -%% -%% This is file `test-compat-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-compat.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase-compat} -\catcode64 11 -\luatexbase@directlua{local answer = 42} -\luatexbase@ensure@primitive{primitive} -\luatexprimitive\relax -\luatexbase@directlua{assert(type(luatexbase.luatexversion) == 'number')} -\luatexbase@directlua{assert(type(luatexbase.luatexrevision) == 'number')} -\stop -\endinput -%% -%% End of file `test-compat-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-compat-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-compat-plain.tex deleted file mode 100644 index e60b83bfaff..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-compat-plain.tex +++ /dev/null @@ -1,21 +0,0 @@ -%% -%% This is file `test-compat-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-compat.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase-compat.sty -\catcode64 11 -\luatexbase@directlua{local answer = 42} -\luatexbase@ensure@primitive{primitive} -\luatexprimitive\relax -\luatexbase@directlua{assert(type(luatexbase.luatexversion) == 'number')} -\luatexbase@directlua{assert(type(luatexbase.luatexrevision) == 'number')} -\bye -\endinput -%% -%% End of file `test-compat-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-loader-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-loader-latex.tex deleted file mode 100644 index bc76deccfb2..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-loader-latex.tex +++ /dev/null @@ -1,18 +0,0 @@ -%% -%% This is file `test-loader-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-loader.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase-loader} -\catcode64 11 -\luatexbase@directlua{require "test-loader"} -\luatexbase@directlua{require "test-loader.sub"} -\stop -\endinput -%% -%% End of file `test-loader-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-loader-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-loader-plain.tex deleted file mode 100644 index 996ccd9b129..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-loader-plain.tex +++ /dev/null @@ -1,18 +0,0 @@ -%% -%% This is file `test-loader-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-loader.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase-loader.sty -\catcode64 11 -\luatexbase@directlua{require "test-loader"} -\luatexbase@directlua{require "test-loader.sub"} -\bye -\endinput -%% -%% End of file `test-loader-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-loader.lua b/Master/texmf-dist/doc/luatex/luatexbase/test-loader.lua deleted file mode 100644 index 7aee8008ed7..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-loader.lua +++ /dev/null @@ -1,13 +0,0 @@ --- --- This is file `test-loader.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-loader.dtx (with options: `testdummy') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -return true --- --- End of File `test-loader.lua'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-loader.sub.lua b/Master/texmf-dist/doc/luatex/luatexbase/test-loader.sub.lua deleted file mode 100644 index 8c9c9b34365..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-loader.sub.lua +++ /dev/null @@ -1,13 +0,0 @@ --- --- This is file `test-loader.sub.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-loader.dtx (with options: `testdummy') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -return true --- --- End of File `test-loader.sub.lua'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-aux.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-aux.tex deleted file mode 100644 index f5d5fef42e2..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-aux.tex +++ /dev/null @@ -1 +0,0 @@ -\relax diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-latex.tex deleted file mode 100644 index a8527067a18..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-latex.tex +++ /dev/null @@ -1,48 +0,0 @@ -%% -%% This is file `test-mcb-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-mcb.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase-mcb} -\catcode 64 11 -\def\msg{\immediate\write16} -\msg{===== BEGIN =====} -\luatexbase@directlua{dofile('test-mcb.lua')} -\def\test#1#2{% - \msg{^^J*********^^J* Testing #1 (type #2)^^J*********} - \msg{* Add two functions} - \luatexbase@directlua{add_#1()} - \csname test_#1\endcsname - \msg{* Remove one} - \luatexbase@directlua{rm_one_#1()} - \csname test_#1\endcsname - \msg{* Remove the second} - \luatexbase@directlua{rm_two_#1()} - \csname test_#1\endcsname - \msg{* Add two functions again} - \luatexbase@directlua{add_#1()} - \csname test_#1\endcsname - \msg{* Remove all functions} - \luatexbase@directlua{luatexbase.reset_callback("#1")} - \csname test_#1\endcsname -} -\catcode`\_ 11 -\everypar{} -\def\test_hpack_filter{\setbox0=\hbox{bla}} -\def\test_hyphenate{\showhyphens{hyphenation}} -\def\test_find_write_file{\immediate\openout15 test-mcb-out.log} -\def\test_process_input_buffer{\input test-mcb-aux.tex} -\test{hpack_filter}{list} -\test{hyphenate}{simple} -\test{find_write_file}{first} -\test{process_input_buffer}{data} -\msg{===== END =====} -\stop -\endinput -%% -%% End of file `test-mcb-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-plain.tex deleted file mode 100644 index 7108e4910d6..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb-plain.tex +++ /dev/null @@ -1,47 +0,0 @@ -%% -%% This is file `test-mcb-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-mcb.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase-mcb.sty -\catcode 64 11 -\def\msg{\immediate\write16} -\msg{===== BEGIN =====} -\luatexbase@directlua{dofile('test-mcb.lua')} -\def\test#1#2{% - \msg{^^J*********^^J* Testing #1 (type #2)^^J*********} - \msg{* Add two functions} - \luatexbase@directlua{add_#1()} - \csname test_#1\endcsname - \msg{* Remove one} - \luatexbase@directlua{rm_one_#1()} - \csname test_#1\endcsname - \msg{* Remove the second} - \luatexbase@directlua{rm_two_#1()} - \csname test_#1\endcsname - \msg{* Add two functions again} - \luatexbase@directlua{add_#1()} - \csname test_#1\endcsname - \msg{* Remove all functions} - \luatexbase@directlua{luatexbase.reset_callback("#1")} - \csname test_#1\endcsname -} -\catcode`\_ 11 -\def\test_hpack_filter{\setbox0=\hbox{bla}} -\def\test_hyphenate{\showhyphens{hyphenation}} -\def\test_find_write_file{\immediate\openout15 test-mcb-out.log} -\def\test_process_input_buffer{\input test-mcb-aux.tex} -\test{hpack_filter}{list} -\test{hyphenate}{simple} -\test{find_write_file}{first} -\test{process_input_buffer}{data} -\msg{===== END =====} -\bye -\endinput -%% -%% End of file `test-mcb-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb.lua b/Master/texmf-dist/doc/luatex/luatexbase/test-mcb.lua deleted file mode 100644 index 6172127059d..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-mcb.lua +++ /dev/null @@ -1,129 +0,0 @@ --- --- This is file `test-mcb.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-mcb.dtx (with options: `testlua') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -local msg = texio.write_nl -local function sample(head,...) - return head, true -end -local prio = luatexbase.priority_in_callback -msg("\n*********\n* Testing management functions\n*********") -luatexbase.add_to_callback("hpack_filter", sample, "sample one", 1) -luatexbase.add_to_callback("hpack_filter", sample, "sample two", 2) -luatexbase.add_to_callback("hpack_filter", sample, "sample three", 1) -assert(prio("hpack_filter", "sample three")) -luatexbase.remove_from_callback("hpack_filter", "sample three") -assert(not prio("hpack_filter", "sample three")) -luatexbase.reset_callback("hpack_filter") -assert(not prio("hpack_filter", "sample one")) -local function data_one(s) - texio.write_nl("I'm data 1 whith argument: "..s) - return s -end -local function data_two(s) - texio.write_nl("I'm data 2 whith argument: "..s) - return s -end -local function data_three(s) - texio.write_nl("I'm data 3 whith argument: "..s) - return s -end -msg("\n*********\n* Testing user-defined callbacks\n*********") -msg("* create one") -luatexbase.create_callback("fooback", "data", data_one) -msg("* call it") -luatexbase.call_callback("fooback", "default") -msg("* add two functions") -luatexbase.add_to_callback("fooback", data_two, "function two", 2) -luatexbase.add_to_callback("fooback", data_three, "function three", 1) -msg("* call") -luatexbase.call_callback("fooback", "all") -msg("* rm one function") -luatexbase.remove_from_callback("fooback", "function three") -msg("* call") -luatexbase.call_callback("fooback", "all but three") -msg("* reset") -luatexbase.reset_callback("fooback") -msg("* call") -luatexbase.call_callback("fooback", "default") -function add_hpack_filter() - luatexbase.add_to_callback('hpack_filter', function(head, ...) - texio.write_nl("I'm a dummy hpack_filter") - return head - end, - 'dummy hpack filter') - luatexbase.add_to_callback('hpack_filter', function(head, ...) - texio.write_nl("I'm an optimized dummy hpack_filter") - return true - end, - 'optimized dummy hpack filter') -end -function rm_one_hpack_filter() - luatexbase.remove_from_callback('hpack_filter', 'dummy hpack filter') -end -function rm_two_hpack_filter() - luatexbase.remove_from_callback('hpack_filter', - 'optimized dummy hpack filter') -end -function add_hyphenate() - luatexbase.add_to_callback('hyphenate', function(head, tail) - texio.write_nl("I'm a dummy hyphenate") - end, - 'dummy hyphenate') - luatexbase.add_to_callback('hyphenate', function(head, tail) - texio.write_nl("I'm an other dummy hyphenate") - end, - 'other dummy hyphenate') -end -function rm_one_hyphenate() - luatexbase.remove_from_callback('hyphenate', 'dummy hyphenate') -end -function rm_two_hyphenate() - luatexbase.remove_from_callback('hyphenate', 'other dummy hyphenate') -end -function add_find_write_file() - luatexbase.add_to_callback('find_write_file', function(id, name) - texio.write_nl("I'm a dummy find_write_file") - return "dummy-"..name - end, - 'dummy find_write_file') - luatexbase.add_to_callback('find_write_file', function(id, name) - texio.write_nl("I'm an other dummy find_write_file") - return "dummy-other-"..name - end, - 'other dummy find_write_file') -end -function rm_one_find_write_file() - luatexbase.remove_from_callback('find_write_file', - 'dummy find_write_file') -end -function rm_two_find_write_file() - luatexbase.remove_from_callback('find_write_file', - 'other dummy find_write_file') -end -function add_process_input_buffer() - luatexbase.add_to_callback('process_input_buffer', function(buffer) - return buffer.."\\msg{dummy}" - end, - 'dummy process_input_buffer') - luatexbase.add_to_callback('process_input_buffer', function(buffer) - return buffer.."\\msg{otherdummy}" - end, - 'other dummy process_input_buffer') -end -function rm_one_process_input_buffer() - luatexbase.remove_from_callback('process_input_buffer', - 'dummy process_input_buffer') -end -function rm_two_process_input_buffer() - luatexbase.remove_from_callback('process_input_buffer', - 'other dummy process_input_buffer') -end --- --- End of File `test-mcb.lua'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-modutils-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-modutils-latex.tex deleted file mode 100644 index ec25bb52afa..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-modutils-latex.tex +++ /dev/null @@ -1,17 +0,0 @@ -%% -%% This is file `test-modutils-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-modutils.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase-modutils} -\RequireLuaModule{test-modutils} -\RequireLuaModule{test-modutils}[1970/01/01] -\stop -\endinput -%% -%% End of file `test-modutils-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-modutils-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-modutils-plain.tex deleted file mode 100644 index 1829334411e..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-modutils-plain.tex +++ /dev/null @@ -1,17 +0,0 @@ -%% -%% This is file `test-modutils-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-modutils.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase-modutils.sty -\RequireLuaModule{test-modutils} -\RequireLuaModule{test-modutils}[1970/01/01] -\bye -\endinput -%% -%% End of file `test-modutils-plain.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-modutils.lua b/Master/texmf-dist/doc/luatex/luatexbase/test-modutils.lua deleted file mode 100644 index 45a644dfab4..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-modutils.lua +++ /dev/null @@ -1,35 +0,0 @@ --- --- This is file `test-modutils.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-modutils.dtx (with options: `testdummy') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -local err, warn, info, log = luatexbase.provides_module { - name = 'test-modutils', - date = '2000/01/01', - version = 1, - description = 'dummy test package', -} -luatexbase.provides_module { - name = 'test-modutils2', - date = '', - version = 1, - description = 'dummy test package', -} -info('It works!\nOh, rly?\nYeah rly!') -log("I'm a one-line info.") -info("1 = "..luatexbase.get_module_version('test-modutils')) -if is_module_loaded('test-modutils') then - info("ok!") -else - err("problem!") -end -info("2000/01/01 = "..luatexbase.get_module_info('test-modutils').date) -info("20000101 = "..luatexbase.get_module_date_int('test-modutils')) -info("-1 = "..luatexbase.get_module_date_int('test-modutils2')) --- --- End of File `test-modutils.lua'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-regs-latex.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-regs-latex.tex deleted file mode 100644 index db8f9a83e0c..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-regs-latex.tex +++ /dev/null @@ -1,54 +0,0 @@ -%% -%% This is file `test-regs-latex.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-regs.dtx (with options: `testlatex') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\RequirePackage{luatexbase-regs} -\def\checkregister#1{% - \edef\newregister{\expandafter\noexpand\csname new#1\endcsname}% - \edef\locregister{\expandafter\noexpand\csname loc#1\endcsname}% - \count0 1 - \loop - \newregister\dummy - \locregister\dummy - \ifnum\count0<30000 - \advance\count0 1 - \repeat} -\checkregister{count} -\checkregister{dimen} -\checkregister{skip} -\checkregister{muskip} -\checkregister{box} -\checkregister{toks} -\checkregister{marks} - -\count0 1 -\loop \ifnum\count0<100 - \csname newinsert\endcsname\dummy - \advance\count0 1 -\repeat - -\globcountblk \dummy{3000} -\globdimenblk \dummy{3000} -\globskipblk \dummy{3000} -\globmuskipblk\dummy{3000} -\globboxblk \dummy{3000} -\globtoksblk \dummy{3000} -\globmarksblk \dummy{3000} - -\loccountblk \dummy{1000} -\locdimenblk \dummy{1000} -\locskipblk \dummy{1000} -\locmuskipblk \dummy{1000} -\locboxblk \dummy{1000} -\loctoksblk \dummy{1000} -\locmarksblk \dummy{1000} -\stop -\endinput -%% -%% End of file `test-regs-latex.tex'. diff --git a/Master/texmf-dist/doc/luatex/luatexbase/test-regs-plain.tex b/Master/texmf-dist/doc/luatex/luatexbase/test-regs-plain.tex deleted file mode 100644 index bc51cf58e32..00000000000 --- a/Master/texmf-dist/doc/luatex/luatexbase/test-regs-plain.tex +++ /dev/null @@ -1,54 +0,0 @@ -%% -%% This is file `test-regs-plain.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-regs.dtx (with options: `testplain') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\input luatexbase-regs.sty -\def\checkregister#1{% - \edef\newregister{\expandafter\noexpand\csname new#1\endcsname}% - \edef\locregister{\expandafter\noexpand\csname loc#1\endcsname}% - \count0 1 - \loop - \newregister\dummy - \locregister\dummy - \ifnum\count0<30000 - \advance\count0 1 - \repeat} -\checkregister{count} -\checkregister{dimen} -\checkregister{skip} -\checkregister{muskip} -\checkregister{box} -\checkregister{toks} -\checkregister{marks} - -\count0 1 -\loop \ifnum\count0<100 - \csname newinsert\endcsname\dummy - \advance\count0 1 -\repeat - -\globcountblk \dummy{3000} -\globdimenblk \dummy{3000} -\globskipblk \dummy{3000} -\globmuskipblk\dummy{3000} -\globboxblk \dummy{3000} -\globtoksblk \dummy{3000} -\globmarksblk \dummy{3000} - -\loccountblk \dummy{1000} -\locdimenblk \dummy{1000} -\locskipblk \dummy{1000} -\locmuskipblk \dummy{1000} -\locboxblk \dummy{1000} -\loctoksblk \dummy{1000} -\locmarksblk \dummy{1000} -\bye -\endinput -%% -%% End of file `test-regs-plain.tex'. diff --git a/Master/texmf-dist/source/luatex/luatexbase/Makefile b/Master/texmf-dist/source/luatex/luatexbase/Makefile deleted file mode 100644 index c3b8e894aa1..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/Makefile +++ /dev/null @@ -1,197 +0,0 @@ -# Makefile for luatexbase - -NAME = luatexbase -DTX = $(wildcard luatexbase*.dtx) -DOC = $(patsubst %.dtx, %.pdf, $(DTX)) -DTXSTY = lltxb-dtxstyle.tex - -# Files grouped by generation mode -UNPACKED_MCB = luatexbase-mcb.sty mcb.lua \ - test-mcb-latex.tex test-mcb-plain.tex \ - test-mcb.lua $(TEST_MCB) -UNPACKED_REGS = luatexbase-regs.sty \ - test-regs-plain.tex test-regs-latex.tex -UNPACKED_ATTR = luatexbase-attr.sty attr.lua \ - test-attr-plain.tex test-attr-latex.tex -UNPACKED_CCTB = luatexbase-cctb.sty cctb.lua \ - test-cctb-plain.tex test-cctb-latex.tex -UNPACKED_LOADER = luatexbase-loader.sty luatexbase.loader.lua \ - test-loader-plain.tex test-loader-latex.tex \ - $(TEST_LOADER).lua test-loader.sub.lua -UNPACKED_MODUTILS = luatexbase-modutils.sty modutils.lua test-modutils.lua \ - test-modutils-plain.tex test-modutils-latex.tex -UNPACKED_COMPAT = luatexbase-compat.sty \ - test-compat-plain.tex test-compat-latex.tex -UNPACKED_BASE = luatexbase.sty test-base-plain.tex test-base-latex.tex -UNPACKED_LUATEX = luatex.sty test-luatex1.tex test-luatex2.tex \ - test-luatex3.tex test-luatex4.tex test-luatex5.tex -UNPACKED = $(UNPACKED_MCB) $(UNPACKED_REGS) $(UNPACKED_ATTR) $(UNPACKED_CCTB) \ - $(UNPACKED_LOADER) $(UNPACKED_MODUTILS) $(UNPACKED_COMPAT) \ - $(UNPACKED_BASE) $(UNPACKED_LUATEX) -UNPACKEDTL = $(UNPACKED_MCB) $(UNPACKED_REGS) $(UNPACKED_ATTR) $(UNPACKED_CCTB) \ - $(UNPACKED_LOADER) $(UNPACKED_MODUTILS) $(UNPACKED_COMPAT) \ - $(UNPACKED_BASE) -COMPILED = $(DOC) -GENERATED = $(COMPILED) $(UNPACKED) -SOURCE = $(DTX) $(DTXSTY) README TODO NEWS Makefile - -# used for check -TEST_LOADER = test-loader -TMP_LOADER = $(TEST_LOADER).tex -TEST_MCB = test-mcb-aux.tex - -# Files grouped by installation location -RUNFILES = $(filter-out test-%, $(UNPACKEDTL)) -DOCFILES = $(DOC) $(filter test-%, $(UNPACKEDTL)) README TODO NEWS -SRCFILES = $(DTX) Makefile - -# The following definitions should be equivalent -# ALL_FILES = $(RUNFILES) $(DOCFILES) $(SRCFILES) -ALL_FILES = $(GENERATED) $(SOURCE) - -# Installation locations -FORMAT = luatex -RUNDIR = $(TEXMFROOT)/tex/$(FORMAT)/$(NAME) -DOCDIR = $(TEXMFROOT)/doc/$(FORMAT)/$(NAME) -SRCDIR = $(TEXMFROOT)/source/$(FORMAT)/$(NAME) -TEXMFROOT = ./texmf - -INSTALL_RUNFILES = @mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) -INSTALL_DOCFILES = @mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR) -INSTALL_SRCFILES = @mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR) - -TESTENV = TEXINPUTS=.:$(TEXMFROOT)/tex//: - -CTAN_ZIP = $(NAME).zip -TDS_ZIP = $(NAME).tds.zip -ZIPS = $(CTAN_ZIP) $(TDS_ZIP) - -DO_TEX = tex --interaction=batchmode $< >/dev/null -DO_LATEXMK = latexmk -pdf -silent $< >/dev/null - -# Main targets definition -all: $(GENERATED) -check: check-regs check-attr check-cctb check-loader check-modutils check-mcb \ - check-compat check-base check-luatex -doc: $(COMPILED) -unpack: $(UNPACKED) -ctan: check $(CTAN_ZIP) -tds: $(TDS_ZIP) Makefile -world: all ctan - -%.pdf: %.dtx $(DTXSTY) - $(DO_LATEXMK) - -luatexbase.%.lua: %.lua - ln -sf $< $@ - -$(UNPACKED_MCB): luatexbase-mcb.dtx - $(DO_TEX) - echo "\\\relax" > $(TEST_MCB) - -$(UNPACKED_REGS): luatexbase-regs.dtx - $(DO_TEX) - -$(UNPACKED_ATTR): luatexbase-attr.dtx - $(DO_TEX) - -$(UNPACKED_CCTB): luatexbase-cctb.dtx - $(DO_TEX) - -$(UNPACKED_LOADER): luatexbase-loader.dtx - $(DO_TEX) - -$(UNPACKED_MODUTILS): luatexbase-modutils.dtx - $(DO_TEX) - -$(UNPACKED_COMPAT): luatexbase-compat.dtx - $(DO_TEX) - -$(UNPACKED_BASE): luatexbase.dtx - $(DO_TEX) - -$(UNPACKED_LUATEX): luatex.dtx - $(DO_TEX) - -check-regs: $(UNPACKED_REGS) - luatex --interaction=batchmode test-regs-plain.tex >/dev/null - lualatex --interaction=batchmode test-regs-latex.tex >/dev/null - -check-attr: install-runfiles - $(TESTENV) luatex --interaction=batchmode test-attr-plain.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-attr-latex.tex >/dev/null - -check-cctb: install-runfiles - $(TESTENV) luatex --interaction=batchmode test-cctb-plain.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-cctb-latex.tex >/dev/null - -check-loader: install-runfiles - echo "this is no lua code" > $(TMP_LOADER) - $(TESTENV) luatex --interaction=batchmode test-loader-plain.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-loader-latex.tex >/dev/null - -check-modutils: install-runfiles - $(TESTENV) luatex --interaction=batchmode test-modutils-plain.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-modutils-latex.tex >/dev/null - -check-mcb: install-runfiles $(UNPACKED_MCB) - $(TESTENV) luatex --interaction=batchmode test-mcb-plain.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-mcb-latex.tex >/dev/null - -check-compat: $(UNPACKED_COMPAT) - luatex --interaction=batchmode test-compat-plain.tex >/dev/null - lualatex --interaction=batchmode test-compat-latex.tex >/dev/null - -check-base: $(UNPACKED_BASE) - luatex --interaction=batchmode test-base-plain.tex >/dev/null - lualatex --interaction=batchmode test-base-latex.tex >/dev/null - -check-luatex: install-runfiles - $(TESTENV) luatex --interaction=batchmode test-luatex1.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-luatex2.tex >/dev/null - #$(TESTENV) lualatex --interaction=batchmode test-luatex3.tex >/dev/null - $(TESTENV) lualatex --interaction=batchmode test-luatex4.tex >/dev/null - $(TESTENV) luatex --interaction=batchmode test-luatex5.tex >/dev/null - -$(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP) - @echo "Making $@ for CTAN upload." - @$(RM) -- $@ - @zip -9 $@ $^ >/dev/null - -$(TDS_ZIP): TEXMFROOT=./tmp-texmf -$(TDS_ZIP): $(ALL_FILES) - @echo "Making TDS-ready archive $@." - @$(RM) -- $@ - $(INSTALL_RUNFILES) - $(INSTALL_DOCFILES) - $(INSTALL_SRCFILES) - @cd $(TEXMFROOT) && zip -9 ../$@ -r . >/dev/null - @$(RM) -r -- $(TEXMFROOT) - -.PHONY: install manifest clean mrproper install-runfiles - -install: $(ALL_FILES) - @echo "Installing in '$(TEXMFROOT)'." - $(INSTALL_RUNFILES) - $(INSTALL_DOCFILES) - $(INSTALL_SRCFILES) - -install-runfiles: $(RUNFILES) - $(INSTALL_RUNFILES) - -manifest: - @echo "Source files:" - @for f in $(SOURCE); do echo $$f; done - @echo "" - @echo "Derived files:" - @for f in $(GENERATED); do echo $$f; done - -clean: - @latexmk -silent -c *.dtx >/dev/null - @#for non-latexmk runs - @$(RM) -- *.log - -mrproper: clean - @$(RM) -- $(GENERATED) $(ZIPS) $(TMP_LOADER) - @$(RM) -r $(TEXMFROOT) - diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-attr.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-attr.dtx deleted file mode 100644 index 5b7288fc098..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-attr.dtx +++ /dev/null @@ -1,692 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% Copyright 2013 by Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-attr.dtx -% and the derived files -% luatexbase-attr.sty attr.lua -% test-regs-plain.tex test-regs-latex.tex -% -% Unpacking: -% tex luatexbase-attr.dtx -% Documentation: -% pdflatex luatexbase-attr.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\let\MetaPrefix\relax - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\let\MetaPrefix\DoubleperCent - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-attr.sty}{\from{luatexbase-attr.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-attr-plain.tex}{\from{luatexbase-attr.dtx}{testplain}}% - \file{test-attr-latex.tex}{\from{luatexbase-attr.dtx}{testlatex}}% -} - -\def\MetaPrefix{-- } - -\def\luapostamble{% - \MetaPrefix^^J% - \MetaPrefix\space End of File `\outFileName'.% -} - -\def\currentpostamble{\luapostamble}% - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{attr.lua}{\from{luatexbase-attr.dtx}{luamodule}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-attr.sty attr.lua} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\documentclass{ltxdoc} -\input lltxb-dtxstyle -\begin{document} - \DocInput{luatexbase-attr.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-attr}{v0.6 2013-05-11} -% -% \maketitle -% -% \begin{abstract} -% In addition to the registers existing in \tex and \etex, \luatex introduces -% a new concept: attributes. This package takes care of attribute allocation -% just like Plain \tex and \latex do for other registers, and also provides a -% Lua interface. -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% \subsection{\tex interface} -% -% The main macro defined here is |\newluatexattribute|. It behaves in the same -% way as |\newcount|. There are also two helper macros: |\setluatexattibute| -% sets an attribute's value (locally, but you can use |\global| in front of -% it). |\unsetluatexattribute| unsets an attribute by giving it a special -% value, depending on \luatex's version; you should always use this macro -% in order to be sure the correct special value for your version of \luatex is -% used. -% -% Due to the intended use of attributes, it makes no sense to locally -% allocate an attribute the way you can locally allocate a counter using -% \file{etex.sty}'s |\loccount|, so no corresponding macro is defined. -% -% \subsection{Lua interface} -% -% The various Lua functions for manipulating attributes use a number to -% designate the attribute. Hence, package writers need a way to know the -% number of the attribute associated to |\fooattr| assuming it was defined -% using |\newluatexattribute\fooattr|, something that \luatex currently -% doesn't support (you can get the current value of the associated attribute -% as |tex.attribute.fooattr|, but not the attribute number). -% -% There are several ways to work around this. For example, it is possible to -% extract the number at any time from the |\meaning| of |\fooattr|. -% Alternatively, one could look at |\the\allocationnumber| just after the -% definition of |\fooattr| and remember it in a Lua variable. For your -% convenience, this is automatically done by |\newluatexattribute|: the number -% is remembered in a dedicated Lua table so that you can get it as -% |luatexbase.attributes.fooattr| (mind the absence of backslash here) at any -% time. -% -% Also, two Lua functions are provided that are analogous to the above \tex -% macros (actually, the macros are wrappers around the functions): -% |luatexbase.new_attribute|\parg{name} allocates a new attribute, without -% defining a corresponding \tex control sequence (only an entry in -% |luatexbase.attributes| is created. It usually returns the number of the -% allocated attribute. If room is missing, it raises an error, unless the -% second argument (optional) is not false, in which case it returns -1. -% -% |luatexbase.unset_attribute|\parg{name} unsets an existing attribute. -% -% \section{Implementation} -% -% \subsection{\tex package} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsubsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 34 12 % " - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < - \y 62 12 % > - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@attr@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-attr}[2013/05/11 v0.6 Attributes allocation for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \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.} - \expandafter\luatexbase@attr@sty@endinput% -\fi -% \end{macrocode} -% -% \subsubsection{Primitives needed} -% -% First load \pk{luatexbase-modutils} (hence \pk{luatexbase-loader} -% and \pk{luatexbase-compat}), and make sure \pk{luatex.sty} is loaded too. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-modutils.sty - \input luatex.sty -\else - \RequirePackage{luatexbase-modutils} - \RequirePackage{luatex} -\fi -% \end{macrocode} -% -% Make sure the primitives we need are available. -% -% \begin{macrocode} -\luatexbase@ensure@primitive{luaescapestring} -\luatexbase@ensure@primitive{attributedef} -\luatexbase@ensure@primitive{attribute} -% \end{macrocode} -% -% \subsubsection{Load supporting Lua module} -% -% \begin{macrocode} -\luatexbase@directlua{require('luatexbase.attr')} -% \end{macrocode} -% -% \subsection{User macros} -% -% The allocation macro is merely a wrapper around the Lua function, but -% handles error and logging in \tex, for consistency with other allocation -% macros. -% -% \begin{macrocode} -\def\newluatexattribute#1{% - \begingroup\escapechar\m@ne \expandafter\expandafter\expandafter - \endgroup \expandafter\expandafter\expandafter - \allocationnumber \luatexbase@directlua{tex.write( - luatexbase.new_attribute("\luatexluaescapestring{\string#1}", true))}% - \ifnum\allocationnumber>\m@ne - \global\luatexattributedef#1=\allocationnumber - \wlog{\string#1=\string\luatexattribute\the\allocationnumber}% - \else - \errmessage{No room for a new \string\attribute}% - \fi} -% \end{macrocode} -% -% Helper macro |\unsetluatexattribute|. -% -% \begin{macrocode} -\newcount\lltxb@attr@unsetvalue -\lltxb@attr@unsetvalue=\ifnum\luatexversion<37 -1\else -2147483647\fi\relax -\def\unsetluatexattribute#1{% - #1\lltxb@attr@unsetvalue} -% \end{macrocode} -% -% And now the trivial helper macro. -% -% \begin{macrocode} -\def\setluatexattribute#1#2{% - #1=\numexpr#2\relax} -% \end{macrocode} -% -% That's all folks! -% -% \begin{macrocode} -\luatexbase@attr@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \subsection{Lua module} -% -% \begin{macrocode} -%<*luamodule> ---- locals -local copynode = node.copy -local newnode = node.new -local nodesubtype = node.subtype -local nodetype = node.id -local stringfind = string.find -local stringformat = string.format -local tableunpack = unpack or table.unpack -local texiowrite_nl = texio.write_nl -local texiowrite = texio.write ---- luatex internal types -local whatsit_t = nodetype"whatsit" -local user_defined_t = nodesubtype"user_defined" -local unassociated = "__unassociated" -luatexbase = luatexbase or { } -local luatexbase = luatexbase -local err, warning, info, log = luatexbase.provides_module({ - name = "luatexbase-attr", - version = 0.6, - date = "2013/05/11", - description = "Attributes allocation for LuaTeX", - author = "Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - copyright = "Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - license = "CC0", -}) -% \end{macrocode} -% -% This table holds the values of the allocated attributes, indexed by name. -% -% \begin{macrocode} -luatexbase.attributes = luatexbase.attributes or { } -local attributes = luatexbase.attributes -% \end{macrocode} -% -% Scoping: we use locals for the attribute functions. -% -% \begin{macrocode} -local new_attribute -local unset_attribute -% \end{macrocode} -% -% In the \luatex ecosystem there are currently two functions that create a -% new attribute. -% One is in |oberdiek| bundle, the other is this one. We will hack a little -% in order to make them compatible. The other function uses -% |LuT@AllocAttribute| as attribute counter, we will keep it in sync with -% ours. A possible problem might also appear: the other function starts -% attribute allocation at 0, which will break luaotfload. We output an -% error if a new attribute has already been allocated with number 0. -% -% \begin{macrocode} -local luatex_sty_counter = 'LuT@AllocAttribute' -if tex.count[luatex_sty_counter] then - if tex.count[luatex_sty_counter] > -1 then - error("luatexbase error: attribute 0 has already been set by \newattribute" - .."macro from luatex.sty, not belonging to this package, this makes" - .."luaotfload unusable. Please report to the maintainer of luatex.sty") - else - tex.count[luatex_sty_counter] = 0 - end -end -% \end{macrocode} -% -% The allocation function. Unlike other registers, allocate starting from 1. -% Some code (e.~g., font handling coming from Con\tex{}t) behaves strangely -% with \verb+\attribute0+ set, and since there is plenty of room here, it -% doesn't seem bad to ``lose'' one item in order to avoid this problem. -% -% \begin{macrocode} -local last_alloc = 0 -function new_attribute(name, silent) - if last_alloc >= 65535 then - if silent then - return -1 - else - error("No room for a new \\attribute", 1) - end - end - local lsc = tex.count[luatex_sty_counter] - if lsc and lsc > last_alloc then - last_alloc = lsc - end - last_alloc = last_alloc + 1 - if lsc then - tex.setcount('global', luatex_sty_counter, last_alloc) - end - attributes[name] = last_alloc - unset_attribute(name) - if not silent then - log('luatexbase.attributes[%q] = %d', name, last_alloc) - end - return last_alloc -end -luatexbase.new_attribute = new_attribute -% \end{macrocode} -% -% Unset an attribute the correct way depending on \luatex's version. -% The constant \verb+unset_value+ can be retrieved by calling -% \verb+get_unset_value()+ to apply to nodes. -% -% \begin{macrocode} -local unset_value = (luatexbase.luatexversion < 37) and -1 or -2147483647 -function unset_attribute(name) - tex.setattribute(attributes[name], unset_value) -end -luatexbase.unset_attribute = unset_attribute -luatexbase.get_unset_value = function () return unset_value end -% \end{macrocode} -% -% Allocation of user-defined whatsit nodes (experimental). -% User-defined whatsit nodes (or user whatsits) are ignored by the -% \luatex engine. They can thus be used to store information in -% node lists without doing any harm. User whatsits can be -% distinguished by an id that is stored in node field |user_id|. -% -% \begin{macrocode} ---- cf. luatexref-t.pdf, sect. 8.1.4.25 -local user_whatsits = { --- (package, (name, id hash)) hash - __unassociated = { }, --- those without package name -} -local whatsit_ids = { } --- (id, (name * package)) hash -local whatsit_cap = 2^53 --- Lua numbers are doubles -local current_whatsit = 0 -local anonymous_whatsits = 0 -local anonymous_prefix = "anon" -% \end{macrocode} -% -% User whatsit allocation is split into two functions: -% \verb|new_user_whatsit_id| registers a new id (an integer) -% and returns it. It is up to the user what he actually does -% with the return value. -% -% Registering user whatsits without a name, though supported, is -% not exactly good style. In these cases we generate a name -% from a counter. -% -% In addition to the user whatsit name, it is possible and even -% encouraged to specify the name of the package that will be -% using the user whatsit as the second argument. -% -% \begin{macrocode} ---- string -> string -> int -local new_user_whatsit_id = function (name, package) - if name then - if not package then - package = unassociated - end - else -- anonymous - anonymous_whatsits = anonymous_whatsits + 1 - warning("defining anonymous user whatsit no. %d", anonymous_whatsits) - warning("dear package authors, please name your whatsits!") - package = unassociated - name = anonymous_prefix .. tostring(anonymous_whatsits) - end - - local whatsitdata = user_whatsits[package] - if not whatsitdata then - whatsitdata = { } - user_whatsits[package] = whatsitdata - end - - local id = whatsitdata[name] - if id then --- warning - warning("replacing whatsit %s:%s (%d)", package, name, id) - else --- new id - current_whatsit = current_whatsit + 1 - if current_whatsit >= whatsit_cap then - warning("maximum of %d integral user whatsit ids reached", - whatsit_cap) - warning("further whatsit allocation may be inconsistent") - end - id = current_whatsit - whatsitdata[name] = id - whatsit_ids[id] = { name, package } - end - log("new user-defined whatsit %d (%s:%s)", id, package, name) - return id -end -luatexbase.new_user_whatsit_id = new_user_whatsit_id -% \end{macrocode} -% -% \verb|new_user_whatsit| first registers a new id and then also -% creates the corresponding whatsit node of subtype “user-defined”. -% We return a nullary function that delivers copies of the whatsit. -% -% Alternatively, the first argument can be a whatsit node that -% will then be used as prototype. Note that in this case a -% \emph{copy} of the prototype will be stored in the closure, -% eliminating side-effects. -% -% \begin{macrocode} ---- (string | node_t) -> string -> ((unit -> node_t) * int) -local new_user_whatsit = function (req, package) - local id, whatsit - if type(req) == "string" then - id = new_user_whatsit_id(req, package) - whatsit = newnode(whatsit_t, user_defined_t) - whatsit.user_id = id - elseif req.id == whatsit_t and req.subtype == user_defined_t then - id = req.user_id - whatsit = copynode(req) - if not whatsit_ids[id] then - warning("whatsit id %d unregistered; " - .. "inconsistencies may arise", id) - end - end - return function () return copynode(whatsit) end, id -end -luatexbase.new_user_whatsit = new_user_whatsit -% \end{macrocode} -% -% If one knows the name of a user whatsit, its corresponding id -% can be retrieved by means of \verb|get_user_whatsit_id|. -% -% \begin{macrocode} ---- string -> string -> int -local get_user_whatsit_id = function (name, package) - if not package then - package = unassociated - end - return user_whatsits[package][name] -end -luatexbase.get_user_whatsit_id = get_user_whatsit_id -% \end{macrocode} -% -% The inverse lookup is also possible via \verb|get_user_whatsit_name|. -% Here it finally becomes obvious why it is beneficial to supply a package -% name -- it adds information about who created and might be relying on the -% user whatsit in question. First return value is the user whatsit name, the -% second the package identifier it was registered with. -% -% We issue a warning and return empty strings in case the argument -% doesn't correspond to a registered user whatsit id. -% -% \begin{macrocode} ---- int | fun | node -> (string, string) -local get_user_whatsit_name = function (asked) - local id - if type(asked) == "number" then - id = asked - elseif type(asked) == "function" then - --- node generator - local n = asked() - id = n.user_id - else --- node - id = asked.user_id - end - local metadata = whatsit_ids[id] - if not metadata then -- unknown - warning("whatsit id %d unregistered; inconsistencies may arise", id) - return "", "" - end - return tableunpack(metadata) -end -luatexbase.get_user_whatsit_name = get_user_whatsit_name -% \end{macrocode} -% -% For the curious as well as the cautious who are interesting in -% what they are dealing with, we add a function that outputs the -% current allocation status to the terminal. -% -% \begin{macrocode} ---- string -> unit -local dump_registered_whatsits = function (asked_package) - local whatsit_list = { } - if asked_package then - local whatsitdata = user_whatsits[asked_package] - if not whatsitdata then - error("(no user whatsits registered for package %s)", - asked_package) - return - end - texiowrite_nl("(user whatsit allocation stats for " .. asked_package) - for name, id in next, whatsitdata do - whatsit_list[#whatsit_list+1] = - stringformat("(%s:%s %d)", asked_package, name, id) - end - else - texiowrite_nl("(user whatsit allocation stats") - texiowrite_nl(stringformat(" ((total %d)\n (anonymous %d))", - current_whatsit, anonymous_whatsits)) - for package, whatsitdata in next, user_whatsits do - for name, id in next, whatsitdata do - whatsit_list[#whatsit_list+1] = - stringformat("(%s:%s %d)", package, name, id) - end - end - end - - texiowrite_nl" (" - --- in an attempt to be clever the texio.write* functions - --- mess up line breaking, so concatenation is unusable ... - local first = true - for i=1, #whatsit_list do - if first then - first = false - else -- indent - texiowrite_nl" " - end - texiowrite(whatsit_list[i]) - end - texiowrite"))\n" -end -luatexbase.dump_registered_whatsits = dump_registered_whatsits -% \end{macrocode} -% Lastly, we define a couple synonyms for convenience. -% \begin{macrocode} -luatexbase.newattribute = new_attribute -luatexbase.newuserwhatsit = new_user_whatsit -luatexbase.newuserwhatsitid = new_user_whatsit_id -luatexbase.getuserwhatsitid = get_user_whatsit_id -luatexbase.getuserwhatsitname = get_user_whatsit_name -luatexbase.dumpregisteredwhatsits = dump_registered_whatsits -% \end{macrocode} -% -% \begin{macrocode} -%</luamodule> -% \end{macrocode} -% -% \section{Test files} -% -% The tests done are very basic: we just make sure that the package loads -% correctly and the macros don't generate any error, under both \latex and -% Plain \tex. We also check that the attribute's number is remembered well, -% independently of the current value of |\escapechar|. -% -% \begin{macrocode} -%<testplain>\input luatexbase-attr.sty -%<testlatex>\RequirePackage{luatexbase-attr} -%<*testplain,testlatex> -\newluatexattribute\testattr -\setluatexattribute\testattr{1} -\ifnum\testattr=1 \else \ERROR \fi -\unsetluatexattribute\testattr -\ifnum\testattr<0 \else \ERROR \fi -\catcode64 11 -\luatexbase@directlua{assert(luatexbase.attributes.testattr)} -\luatexbase@directlua{luatexbase.new_attribute('luatestattr')} -\luatexbase@directlua{assert(luatexbase.attributes.luatestattr)} -\begingroup -\escapechar64 -\newluatexattribute\anotherattr -\endgroup -\setluatexattribute\anotherattr{1} -\luatexbase@directlua{assert(luatexbase.attributes.anotherattr)} -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-cctb.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-cctb.dtx deleted file mode 100644 index 4b15776a236..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-cctb.dtx +++ /dev/null @@ -1,765 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-cctb.dtx -% and the derived files -% luatexbase-cctb.sty cctb.lua -% test-cctb-plain.tex test-cctb-latex.tex -% -% Unpacking: -% tex luatexbase-cctb.dtx -% Documentation: -% pdflatex luatexbase-cctb.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\let\MetaPrefix\relax - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\let\MetaPrefix\DoubleperCent - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-cctb.sty}{\from{luatexbase-cctb.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-cctb-plain.tex}{\from{luatexbase-cctb.dtx}{testplain}}% - \file{test-cctb-latex.tex}{\from{luatexbase-cctb.dtx}{testlatex}}% -} - -\def\MetaPrefix{-- } - -\def\luapostamble{% - \MetaPrefix^^J% - \MetaPrefix\space End of File `\outFileName'.% -} - -\def\currentpostamble{\luapostamble}% - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{cctb.lua}{\from{luatexbase-cctb.dtx}{luamodule}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-cctb.sty cctb.lua} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\documentclass{ltxdoc} -\input{lltxb-dtxstyle} -\begin{document} - \DocInput{luatexbase-cctb.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-cctb}{v0.6 2013-05-11} -% -% \maketitle -% -% \begin{abstract} -% In addition to the registers existing in \tex and \etex, \luatex introduces -% a new concept: catcode tables. This package takes care of catcode table -% allocation just like Plain TeX and LaTeX do for other registers. It also -% provides a few handy macros from common use cases. -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% \subsection{Allocation and setting} -% -% The main macro defined here is |\newluatexcatcodetable|. It behaves the same -% as |\newbox|. Additionally, the newly allocated catcode table is initialised -% to the catcodes of Ini\tex. In order to help you define the catcode tables -% (once they are allocated), two helper macros are available. -% -% \begin{quote} -% \cs{SetCatcodeRange}\marg{from}\marg{to}\marg{value} -% \end{quote} -% Set all characters code in the range \meta{from}--\meta{to} to the given -% catcode \meta{value}. -% -% \begin{quote} -% \cs{setluatexcatcodetable}\marg{table}\marg{catcode statements} -% \end{quote} -% Set a previously allocated \meta{table} to the catcodes given by executing -% \meta{catcode statements}. Note that \meta{table} must not be the current -% active catcode table. You may, however, load another catcode table in your -% \meta{catcode statements} (if you don't, then the current catcodes will be -% used as a basis). -% -% For your convenience, a few catcode tables are predefined: -% \begin{itemize} -% \item |\CatcodeTableIniTeX|: Ini\tex catcodes. -% \item |\CatcodeTableString|: the catcode regime used by |\string| and -% |\meaning|: everything has catcode 12, except space (U+0020) that has -% catcode 10. -% \item |\CatcodeTableOther|: everything (included space) has catcode 12. -% \item |\CatcodeTableLaTeX|: basic \LaTeXe\ catcodes. -% \item |\CatcodeTableLaTeXAtLetter|: same as above, but |@| is a letter. -% \item |\CatcodeTableExpl|: catcodes used by \latex{}3 with |\ExplSyntaxOn|. -% Be aware that this does not provide the exact same environment as -% |\ExplSyntaxOn|: most noticibly, some booleans are not set, and -% |\endlinechar| is not adjusted (it should be 32). -% \end{itemize} -% -% \subsection{Access from Lua} -% -% Various Lua functions, such as |tex.print| accept a catcode table number as -% argument. In order to use in Lua the catcode tables allocated in \tex, the -% package writer needs to know their number. Since |\chardef| is used for the -% definition of the control sequence, this is rather easy to do. However, for -% extra ease of use, the numbers are also directly accessible from Lua as the -% value of the table |luatexbase.catcodetables|, whose keys is the name of the -% control sequence (without any leading backslash). For example, after -% \begin{quote} -% |\newluatexcatcodetable\mycatcodes| -% \end{quote} -% the variable |luatexbase.catcodetables.mycatcodes| will hold the number of -% the catcode table |\mycatcodes|. You will usually want to do -% \begin{quote} -% |local mycatcodes = luatexbase.catcodetables.mycatcodes| -% \end{quote} -% at the beginning of your Lua module (assuming it is loaded after the catcode -% table has been allocated) and then use |tex.print(mycatcodes, ...)| in the -% rest of your Lua code. -% -% Also, nicknames are available for the predefined catcode tables: -% \begin{itemize} -% \item |CatcodeTableIniTeX| = |ini|, -% \item |CatcodeTableString| = |string|, -% \item |CatcodeTableOther| = |other|, -% \item |CatcodeTableLaTeX| = |latex|, -% \item |CatcodeTableLaTeXAtLetter| = |latex-atletter| = |latex-package|, -% \item |CatcodeTableExpl| = |expl| = |expl3|, -% \end{itemize} -% -% \subsection{High-level stack interface} -% -% In many situations, you want to ensure a proper set of catcodes for some -% time, then go back to the previous catcodes without using a group. The -% obvious use case is a package, which may be loaded while unexpected -% catcodes are active. A pair of macros is provided to deal precisely with -% this situation. -% \begin{quote} -% \cs{BeginCatcodeRegime}\marg{catcode table}\\ -% \meta{code}\\ -% \cs{EndCatcodeRegime} -% \end{quote} -% \cs{BeginCatcodeRegime} remembers the current catcode table, then -% initializes a new one with a copy of the \meta{catcode table} given (so that -% this table is not changed by anything in \meta{code}), and makes it the -% active table. \cs{EndCatcodeRegime} restores the previous catcode table. -% -% For example, a \latex package might do: -% \begin{quote} -% |\BeginCatcodeRegime\CatcodeTableLaTeXAtLetter|\\ -% |% package code|\\ -% |\EndCatcodeRegime| -% \end{quote} -% Every catcode change made in the package code will be lost avec -% \cs{EndCatcodeRegime}; if you want them to survive, please use -% \cs{AtEndOfPackage} or \cs{AtBeginDocument}. -% -% By the way, you may add catcode statements in the argument of -% \cs{BeginCatcodeRegime} after the name of a catcode table. So the first line -% of the previous example is equivalent to -% \begin{quote} -% |\BeginCatcodeRegime{\CatcodeTableLaTeX \makeatletter}| -% \end{quote} -% -% \subsection{Low-level stack interface} -% -% The previous macros use internally two stacks : the first on holds the -% numbers of the active catcodes tables, so remembering the current table -% means pushing its number on the stack, and restoring the previously active -% table means popping it off the stack. This is done with: -% \begin{quote} -% \cs{PushCatcodeTableNumStack}\\ -% \cs{PopCatcodeTableNumStack} -% \end{quote} -% Note that \cs{PushCatcodeTableNumStack} doesn't change current catcodes -% but \cs{PopCatcodeTableNumStack} does. -% -% The second stack consists of temporary tables, mainly used to hold copies of -% existing tables. A temporary table are allocated with -% \cs{IncCatcodeTableStack}, accessed with \cs{CatcodeTableStack} and the -% freed with \cs{DecCatcodeTableStack}, none of which changes the current -% table. -% -% As an illustration, \cs{BeginCatcodeRegime} does -% \begin{quote} -% |\PushCatcodeTableNumStack|\\ -% |\IncCatcodeTableStack|\\ -% |\setluatexcatcodetable\CatcodeTableStack{\luatexcatcodetable#1}%|\\ -% |\luatexcatcodetable\CatcodeTableStack| -% \end{quote} -% and \cs{EndCatcodeRegime} is defined as -% \begin{quote} -% |\DecCatcodeTableStack|\\ -% |\PopCatcodeTableNumStack| -% \end{quote} -% -% If you choose to use this low-level interface, it is your responsibility to -% ensure proper balancing of push-pop and inc-dec, as well as making sure that -% a temporary table is never used after it has been freed. -% -% \section{Implementation} -% -% \subsection{\tex package} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsubsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < - \y 62 12 % > - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@cctb@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-cctb}[2013/05/11 v0.6 Catcodetable allocation for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-cctb}{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.} - \expandafter\luatexbase@cctb@sty@endinput% -\fi -% \end{macrocode} -% -% \subsubsection{Load supporting Lua module} -% -% First load \pk{luatexbase-modutils} (hence \pk{luatexbase-loader} -% and \pk{luatexbase-compat}), then the supporting Lua module. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-modutils.sty -\else - \RequirePackage{luatexbase-modutils} -\fi -\luatexbase@directlua{require('luatexbase.cctb')} -% \end{macrocode} -% -% \subsubsection{Primitives needed} -% -% \pk{luatexbase-compat} is already loaded; just make sure the primitives -% we need are available. -% -% \begin{macrocode} -\luatexbase@ensure@primitive{luaescapestring} -\luatexbase@ensure@primitive{catcodetable} -\luatexbase@ensure@primitive{initcatcodetable} -\luatexbase@ensure@primitive{savecatcodetable} -% \end{macrocode} -% -% \subsubsection{Allocation and temporary tables} -% -% Counters for the allocated and temporary tables. -% -% \begin{macrocode} -\newcount\lltxb@catcodetable@alloc -\lltxb@catcodetable@alloc\m@ne -\newcount\CatcodeTableStack -\CatcodeTableStack\z@ -% \end{macrocode} -% -% The allocation macro. Allocate only odd numbers to allow using even -% numbers for temporary tables. -% -% \begin{macrocode} -\def\newluatexcatcodetable#1{% - \ifnum\lltxb@catcodetable@alloc<65535\relax - \global\advance\lltxb@catcodetable@alloc\tw@ - \allocationnumber\lltxb@catcodetable@alloc - \global\chardef#1\allocationnumber - \luatexinitcatcodetable\allocationnumber - \begingroup\escapechar\m@ne - \luatexbase@directlua{luatexbase.catcodetabledef_from_tex( - '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}% - \endgroup - \wlog{\string#1=\string\luatexcatcodetable\the\allocationnumber}% - \else - \errmessage{No room for a new \string\luatexcatcodetable}% - \fi} -% \end{macrocode} -% -% Allocate a new temporary table, using even numbers. -% -% \begin{macrocode} -\def\IncCatcodeTableStack{% - \ifnum\CatcodeTableStack<65534\relax - \global\advance\CatcodeTableStack\tw@ - \else - \errmessage{CatcodeTableStack overflow}% - \fi} -% \end{macrocode} -% -% Free a temporary table. -% -% \begin{macrocode} -\def\DecCatcodeTableStack{% - \ifnum\CatcodeTableStack>\z@ - \global\advance\CatcodeTableStack-2\relax - \else - \errmessage{CatcodeTableStack underflow}% - \fi} -% \end{macrocode} -% -% \subsubsection{Setting catcode tables} -% -% A small patch to get two new counters in Plain too. -% -% \begin{macrocode} -\expandafter\ifx\csname @tempcnta\endcsname\relax - \csname newcount\endcsname\@tempcnta -\fi -\expandafter\ifx\csname @tempcntb\endcsname\relax - \csname newcount\endcsname\@tempcntb -\fi -% \end{macrocode} -% -% Set the catcodes for a range of characters. -% -% \begin{macrocode} -\def\SetCatcodeRange#1#2#3{% - \edef\luaSCR@temp{% - \noexpand\@tempcnta=\the\@tempcnta - \noexpand\@tempcntb=\the\@tempcntb - \noexpand\count@=\the\count@ - \relax}% - \@tempcnta=#1\relax - \@tempcntb=#2\relax - \count@=#3\relax - \loop\unless\ifnum\@tempcnta>\@tempcntb - \catcode\@tempcnta=\count@ - \advance\@tempcnta\@ne - \repeat - \luaSCR@temp} -% \end{macrocode} -% -% Make \cs{SetCatcodeRange} available with its old name. -% -% \begin{macrocode} -\def\lltxb@synonym#1#2{% - \def#1{% - \begingroup - \ifdefined\PackageWarning - \let\x\PackageWarning - \else - \def\x####1####2{% - \begingroup \endlinechar10 - \message{Package ####1 warning: ####2}% - \endgroup} - \fi - \expandafter\endgroup - \x{luatex}{\string#1 is deprecated^^J% - and will be removed in the next version of the package.^^J% - Please use \string#2 instead.} - \let#1#2% - #1}} -\lltxb@synonym \setcatcoderange \SetCatcodeRange -% \end{macrocode} -% -% Set a catcode table. -% -% \begin{macrocode} -\def\setluatexcatcodetable#1#2{% - \begingroup - #2% - \luatexsavecatcodetable#1% - \endgroup} -% \end{macrocode} -% -% \subsubsection{Predefined tables} -% -% The |IniTeX| catcode table needs no extra initialisation. -% -% \begin{macrocode} -\newluatexcatcodetable\CatcodeTableIniTeX -% \end{macrocode} -% -% The |String| and |Other| catcode tables. -% -% \begin{macrocode} -\newluatexcatcodetable\CatcodeTableString -\setluatexcatcodetable\CatcodeTableString{% - \luatexcatcodetable\CatcodeTableIniTeX - \catcode0 12 % nul - \catcode13 12 % carriage return - \catcode37 12 % percent - \SetCatcodeRange{65}{90}{12}% A-Z - \SetCatcodeRange{97}{122}{12}% a-z - \catcode92 12 % backslash - \catcode127 12 } -% \end{macrocode} -% -% \begin{macrocode} -\newluatexcatcodetable\CatcodeTableOther -\setluatexcatcodetable\CatcodeTableOther{% - \luatexcatcodetable\CatcodeTableString - \catcode32 12 } -% \end{macrocode} -% -% Tables for \LaTeXe. -% -% \begin{macrocode} -\newluatexcatcodetable\CatcodeTableLaTeX -\setluatexcatcodetable\CatcodeTableLaTeX{% - \luatexcatcodetable\CatcodeTableIniTeX - \SetCatcodeRange{0}{31}{15}% - \catcode9 10 % tab - \catcode10 12 % newline - \catcode12 13 % form feed - \catcode13 5 % carriage return - \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 } -% \end{macrocode} -% -% \begin{macrocode} -\newluatexcatcodetable\CatcodeTableLaTeXAtLetter -\setluatexcatcodetable\CatcodeTableLaTeXAtLetter{% - \luatexcatcodetable\CatcodeTableLaTeX - \catcode64=11 } -% \end{macrocode} -% -% A table for \pk{expl3}. -% -% \begin{macrocode} -\newluatexcatcodetable\CatcodeTableExpl -\setluatexcatcodetable\CatcodeTableExpl{% - \luatexcatcodetable\CatcodeTableLaTeX - \catcode126 10 % tilde is a space char - \catcode32 9 % space is ignored - \catcode9 9 % tab also ignored - \catcode95 11 % underscore letter - \catcode58 11 % colon letter - } -% \end{macrocode} -% -% Now do the shortcuts. -% -% \begin{macrocode} -\luatexbase@directlua{luatexbase.catcodetable_do_shortcuts()} -% \end{macrocode} -% -% \subsubsection{Catcode table number stack and regimes} -% -% The stack is implemented as a list of (brace-enclosed) \tex arguments. -% Initially, in contains only $0$, the number of the active table when -% \luatex starts. -% -% \begin{macrocode} -\def\lltxb@cctb@numstack{0} -% \end{macrocode} -% -% Pushing a number on the stack actually means adding it to the beginning -% of the list (ie, unshifting it). -% -% \begin{macrocode} -\def\PushCatcodeTableNumStack{% - \xdef\lltxb@cctb@numstack{{\the\luatexcatcodetable}\lltxb@cctb@numstack}} -% \end{macrocode} -% -% Popping a number off the stack means shifting it. -% -% \begin{macrocode} -\def\PopCatcodeTableNumStack{% - \expandafter\lltxb@cctb@numstack@pop\lltxb@cctb@numstack\@nil} -\def\lltxb@cctb@numstack@pop#1#2\@nil{% - \ifx\empty#2\empty - \begingroup - \ifdefined\PackageWarning - \let\x\PackageWarning - \else - \def\x####1####2{% - \begingroup \endlinechar10 - \message{Package ####1 warning: ####2}% - \endgroup}% - \fi - \expandafter\endgroup - \x{luatexbase-cctb}{Popping from an empty CatcodeTableNumStack}% - \luatexcatcodetable\z@ - \else - \gdef\lltxb@cctb@numstack{#2}% - \luatexcatcodetable#1\relax - \fi} -% \end{macrocode} -% -% Now the catcode regime pseudo-environment as presented in the -% documentation. -% -% \begin{macrocode} -\def\BeginCatcodeRegime#1{% - \PushCatcodeTableNumStack - \IncCatcodeTableStack - \setluatexcatcodetable\CatcodeTableStack{\luatexcatcodetable#1}% - \luatexcatcodetable\CatcodeTableStack} -% \end{macrocode} -% -% \begin{macrocode} -\def\EndCatcodeRegime{% - \DecCatcodeTableStack - \PopCatcodeTableNumStack} -% \end{macrocode} -% -% That's all, folks! -% -% \begin{macrocode} -\luatexbase@cctb@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \subsection{Lua module} -% -% \begin{macrocode} -%<*luamodule> -luatexbase = luatexbase or { } -local luatexbase = luatexbase -luatexbase.provides_module({ - name = "luatexbase-cctb", - version = 0.6, - date = "2013/05/11", - description = "Catcodetable allocation for LuaTeX", - author = "Heiko Oberdiek, Elie Roux and Manuel Pegourie-Gonnard", - copyright = "Heiko Oberdiek, Elie Roux and Manuel Pegourie-Gonnard", - license = "CC0", -}) -% \end{macrocode} -% -% The number associated to a CS name is remembered in the |catcodetables| -% table. -% -% \begin{macrocode} -luatexbase.catcodetables = luatexbase.catcodetables or { } -local catcodetables = luatexbase.catcodetables -local function catcodetabledef_from_tex(name, number) - catcodetables[name] = tonumber(number) -end -luatexbase.catcodetabledef_from_tex = catcodetabledef_from_tex -% \end{macrocode} -% -% The next function creates some shortcuts for better readability in lua -% code. This makes |luatexbase.catcodetables.latex| equivalent to -% |luatexbase.catcodetables.CatcodeTableLaTeX|. -% -% \begin{macrocode} -local function catcodetable_do_shortcuts() - local cat = catcodetables - cat['latex'] = cat.CatcodeTableLaTeX - cat['latex-package'] = cat.CatcodeTableLaTeXAtLetter - cat['latex-atletter'] = cat.CatcodeTableLaTeXAtLetter - cat['ini'] = cat.CatcodeTableIniTeX - cat['expl3'] = cat.CatcodeTableExpl - cat['expl'] = cat.CatcodeTableExpl - cat['string'] = cat.CatcodeTableString - cat['other'] = cat.CatcodeTableOther -end -luatexbase.catcodetable_do_shortcuts = catcodetable_do_shortcuts -% \end{macrocode} -% -% \begin{macrocode} -%</luamodule> -% \end{macrocode} -% -% \section{Test files} -% -% The tests done are very basic: we just make sure that the package loads -% correctly and the macros don't generate any error, under both LaTeX en -% Plain TeX. -% -% \begin{macrocode} -%<testplain,testlatex>\catcode00 15 -%<testplain>\input luatexbase-cctb.sty -%<testlatex>\RequirePackage{luatexbase-cctb} -%<*testplain,testlatex> -\begingroup \catcode64 11 \global\let\lua\luatexbase@directlua \endgroup -% \end{macrocode} -% -% Also check that the catcodetable's number is remembered well, -% independently of the current value of |\escapechar|. - -% \begin{macrocode} -\newluatexcatcodetable\testcctb -\lua{assert(luatexbase.catcodetables.testcctb)} -\begingroup -\escapechar64 -\newluatexcatcodetable\anothercctb -\endgroup -\lua{assert(luatexbase.catcodetables.anothercctb)} -% \end{macrocode} -% -% Now, play a little bit with predefined tables. Be careful to change -% catcodes only inside a group to avoid chaos. -% -% \begin{macrocode} -\def\test#1#2#3{% - \begingroup - \ifcsname CatcodeTable#1\endcsname \else \INTERR \fi - \luatexcatcodetable\csname CatcodeTable#1\endcsname - \ifnum\catcode#2=#3 \else \ERROR \fi - \endgroup} -\test {IniTeX} {00} {09} -\test {IniTeX} {92} {00} -\test {IniTeX} {64} {12} -\test {IniTeX} {65} {11} -\test {String} {92} {12} -\test {String} {65} {12} -\test {String} {32} {10} -\test {Other} {92} {12} -\test {Other} {65} {12} -\test {Other} {32} {12} -\test {LaTeXAtLetter} {64} {11} -\test {LaTeX} {64} {12} -\test {Expl} {32} {09} -%<testlatex>\documentclass{minimal} -\lua{% - tex.sprint('\string\\setbox0=\string\\hbox{') - tex.sprint(luatexbase.catcodetables.string, "\string\\undef # _^&") - tex.sprint('}') - } -% \end{macrocode} -% -% \begin{macrocode} -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-compat.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-compat.dtx deleted file mode 100644 index 4da25225890..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-compat.dtx +++ /dev/null @@ -1,403 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-compat.dtx -% and the derived files -% luatexbase-compat.pdf luatexbase-compat.sty -% test-compat-plain.tex test-compat-latex.tex -% -% Unpacking: -% tex luatexbase-compat.dtx -% Documentation: -% pdflatex luatexbase-compat.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-compat.sty}{\from{luatexbase-compat.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-compat-plain.tex}{\from{luatexbase-compat.dtx}{testplain}}% - \file{test-compat-latex.tex}{\from{luatexbase-compat.dtx}{testlatex}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-compat.sty} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\NeedsTeXFormat{LaTeX2e} -\documentclass{ltxdoc} -\input lltxb-dtxstyle.tex -\EnableCrossrefs -\CodelineIndex -\begin{document} - \DocInput{luatexbase-compat.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-compat}{2011/05/24 v0.4} -% -% \maketitle -% -% \begin{abstract} -% The \luatex manual is very clear: everything may change. This package -% provides tools to help package writers deal with the changes. It helps -% supporting \luatex versions down to 0.25.4, and is tested with -% \luatex 0.40.6 (\texlive 2009), \luatex 0.60.2 (\texlive 2010) and current -% beta versions. -% -% The supported formats are Plain and \latex adapted for \luatex as provided -% by \texlive and MiK\tex (see \file{lualatex-doc.pdf} section~4 for details -% about these formats). -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% Three problems are currently addressed by this package: changes in the -% syntax of |\directlua|, version information, and variable policies for -% primitives activation and naming (in \luatex itself as well as in the -% formats provided by distributions). -% -% \medskip -% -% Older versions of \luatex used to support multiple Lua states. A number was -% mandatory with |\directlua| in order to specify the Lua state to be used. -% Later, support for multiple Lua states was removed and the old syntax -% resulted in a warning. Now (\luatex 0.50), |\directlua| again accepts a -% number after |\directlua|, but with a different meaning (see the \luatex -% manual for details). -% -% This package provides a macro |\luatexbase@directlua| that expands to -% |\directlua0| on \luatex 0.35 and lower (where the number is mandatory), and -% to |\directlua| otherwise. It is a macro in both cases so that it always -% expands in exactly two steps. -% -% \medskip -% -% Current versions of \luatex make the version available directly from Lua as -% |tex.luatexversion| and |tex.luatexrevision|. However, older versions (such -% as 0.25.4) didn't, which makes it particularly uneasy to test the version -% from within Lua. The present package makes this information available as -% |luatexbase.luatexversion| and |luatexbase.luatexrevision|. -% -% \medskip -% -% Starting with \luatex 0.39.0, the only primitives available in Ini\tex mode -% are the basic primitives from \tex{}82 and |\directlua|. All other -% primitives are hidden by default and have to be activated using a Lua -% function. In \texlive 2009 (\luatex 0.40.6), the following arrangement has -% been made in order to try preserving usability while avoiding name clashes -% in the \latex world: in \latex-based formats, all pdf\tex primitives are -% enabled with their normal name, but the primitives specific to \luatex are -% enabled with the |luatex| prefix.\footnote{The prefix is dropped for -% primitives whose name already starts with \texttt{luatex}.} In Plain based -% formats however, all the primitives are enabled with their natural name, but -% are also provided with the same name as in \latex-based formats in order to -% help writing generic packages. -% -% So, starting with \texlive 2009, the situation is clear: the prefixed -% version of the \luatex primitives is always available. But in earlier -% versions (\texlive 2008, \luatex 0.25.4) those primitives were available -% only with their natural names. The primitives provided by \etex and pdf\tex -% on the other hand, are always available. -% -% \begin{quote} -% \cs{luatexbase@ensure@primitive}\marg{name} -% \end{quote} -% The tool provided to deal with that is \cs{luatexbase@ensure@primitive}, -% whose argument is a \luatex primitive name (without a leading backslash nor -% any |luatex| prefix, eg just |{latelua}|). It makes sure that the primitive -% gets available as \cs{luatex\meta{name}}. -% -% \textbf{Warning.} In particular circumstances, this macro may fail silently -% for primitives whose natural name starts with |luatex|, hence such -% primitives shouldn't be used as arguments. This is actually not a problem, -% since the only three such primitives are |\luatexversion|, |\luatexrevision| -% and |\luatexdatestamp|. The first two are already activated by \pk{ifluatex} -% which is loaded by this package, so you don't need to activated them -% yourself. The third should never be used in production according to the -% \luatex manual. -% -% \textit{Remark.} If you only aim at compatibility down to \texlive 2009 -% (\luatex 0.40.6), then you can simply use the primitives with their prefixed -% name (except for |\directlua| which never needs a prefix). If you want extra -% security and/or compatibility down to \texlive 2008 (\luatex 0.25.4) then -% you should use \cs{luatebase@ensure@primitive} for each primitive you intend -% to use (except |\directlua| again). -% -% This package doesn't try to activate every primitive, since it would require -% an extensive list of primitives for each version of \luatex, so it seems -% simpler to leave that burden on package writers. -% -% \section{Implementation} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 42 12 % * - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@compat@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-compat}[2011/05/24 v0.4 Compatibility tools for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-compat}{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.} - \expandafter\luatexbase@compat@sty@endinput% -\fi -% \end{macrocode} -% -% \subsection{\cs{directlua} abstraction} -% -% Define |\luatexbase@directlua| to be either |\directlua0| or -% |\directlua|, depending on the version of \luatex. -% -% \begin{macrocode} -\begingroup -\expandafter\ifx\csname newcommand\endcsname\relax - \toks0{\long\def\luatexbase@directlua}% -\else - \toks0{\newcommand\luatexbase@directlua}% -\fi -\ifnum\luatexversion<36 - \toks0\expandafter{\the\toks0{\directlua0}}% -\else - \toks0\expandafter{\the\toks0{\directlua}}% -\fi -\expandafter\endgroup -\the\toks0 -% \end{macrocode} -% -% \subsection{Version information} -% -% Make |\luatexversion| and |\luatexrevision| available from Lua. -% -% \begin{macrocode} -\luatexbase@directlua{% - luatexbase = luatexbase or {} - luatexbase.luatexversion = \number\luatexversion\space - luatexbase.luatexrevision = \number\luatexrevision\space} -% \end{macrocode} -% -% \subsection{Primitives} -% -% Try reasonably hard to activate a primitive. First, check if it is -% already activated an do nothing in this case. -% -% \begin{macrocode} -\begingroup -\expandafter\ifx\csname newcommand\endcsname\relax - \toks0{\def\luatexbase@ensure@primitive#1} -\else - \toks0{\newcommand*\luatexbase@ensure@primitive[1]} -\fi -\toks2{}\def\x#1{\toks2\expandafter{\the\toks2 #1}} -\x{% - \ifcsname luatex#1\endcsname \else} -\ifnum\luatexversion<37\relax -% \end{macrocode} -% -% |tex.enableprimitives()| not available. If the unprefixed primitive is -% undefined, issue an error. -% -% \begin{macrocode} - \x{% - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname #1\endcsname\relax} - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname PackageError\endcsname\relax - \x{% - \errmessage{% - Package luatexbase-compat error: failed to enable `#1'.}} - \else - \x{% - \PackageError{luatexbase-compat}{% - Package luatexbase-compat error: failed to enable `#1'.}{}} - \fi - \x{% - \else} -% \end{macrocode} -% -% Use the unprefixed primitive to define the prefixed version. -% -% \begin{macrocode} - \x{% - \expandafter\let\csname luatex#1\expandafter\endcsname - \csname#1\endcsname - \fi} -\else -% \end{macrocode} -% -% |tex.enableprimitives()| available, use it. -% -% \begin{macrocode} - \x{% - \luatexbase@directlua{tex.enableprimitives('luatex', {'#1'})}} -\fi -\x{% - \fi} -\toks0\expandafter{\the\toks0\expandafter{\the\toks2}} -\expandafter\endgroup -\the\toks0 -% \end{macrocode} -% -% That's all folks! -% -% \begin{macrocode} -\luatexbase@compat@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \section{Test files} -% -% Test fils for Plain and LaTeX -% -% \begin{macrocode} -%<testplain>\input luatexbase-compat.sty -%<testlatex>\RequirePackage{luatexbase-compat} -%<*testplain,testlatex> -\catcode64 11 -\luatexbase@directlua{local answer = 42} -\luatexbase@ensure@primitive{primitive} -\luatexprimitive\relax -\luatexbase@directlua{assert(type(luatexbase.luatexversion) == 'number')} -\luatexbase@directlua{assert(type(luatexbase.luatexrevision) == 'number')} -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-loader.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-loader.dtx deleted file mode 100644 index c4bd008a9b6..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-loader.dtx +++ /dev/null @@ -1,412 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-loader.dtx -% and the derived files -% luatexbase-loader.sty luatexbase.loader.lua -% test-loader-plain.tex test-loader-latex.tex -% -% Unpacking: -% tex luatexbase-loader.dtx -% Documentation: -% pdflatex luatexbase-loader.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\let\MetaPrefix\relax - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\let\MetaPrefix\DoubleperCent - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-loader.sty}{\from{luatexbase-loader.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-loader-plain.tex}{\from{luatexbase-loader.dtx}{testplain}}% - \file{test-loader-latex.tex}{\from{luatexbase-loader.dtx}{testlatex}}% -} - -\def\MetaPrefix{-- } - -\def\luapostamble{% - \MetaPrefix^^J% - \MetaPrefix\space End of File `\outFileName'.% -} - -\def\currentpostamble{\luapostamble}% - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase.loader.lua}{\from{luatexbase-loader.dtx}{luamodule}}% - \usedir{doc/luatex/luatexbase}% - \file{test-loader.lua}{\from{luatexbase-loader.dtx}{testdummy}}% - \file{test-loader.sub.lua}{\from{luatexbase-loader.dtx}{testdummy}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-loader.sty luatex.loader.lua} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\documentclass{ltxdoc} -\input{lltxb-dtxstyle} -\begin{document} - \DocInput{luatexbase-loader.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-loader}{v0.6 2013-05-11} -% -% \maketitle -% -% \begin{abstract} -% Lua modules are loaded using the |require()| function which, similarly to -% \tex's |\input|, takes care of locating the file to be loaded. This package -% adapts the way the files are searched in order to accommodate the TDS as -% well as usual Lua naming conventions. -% -% For higher-level functions related to Lua modules, see -% \href{file:luatexbase-modutils.pdf}{\pk{luatexbase-modutils}}, which also -% loads the present package. -% \end{abstract} -% -% \section{Documentation} -% -% Starting with \luatex 0.45, |require()| uses Kpathsea for file searching -% when the library is initialised (which is always the case in \tex mode, -% unless explicitly disabled by the user). However, it did not respect the -% Lua convention that |require("foo.bar")| should look for |foo/bar.lua| until -% version 0.60. \luatex 0.74 ships with Lua 5.2 that has a different loading -% system. -% -% The aim of this package is to have a coherent behaviour between versions of -% LuaTeX, and to get the loaded file's name printed in the output (\LaTeX -% style). The first versions did ensure backward compatibilty to \luatex 0.25 -% but as \luatex development is quite fast, this version supports only \luatex -% 0.45 and higher. -% -% More precisely, when asked for |foo.bar| (or |foo.bar.lua|), it first looks -% for file |foo/bar| using Kpathsea with the format |lua|, and then for -% |foo.bar|, removing the possible extension. -% -% \section{Implementation} -% -% \subsection{\tex package} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsubsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 34 12 % " - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@loader@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-loader}[2013/05/11 v0.6 Lua module loader for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-loader}{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.} - \expandafter\luatexbase@loader@sty@endinput% -\fi -% \end{macrocode} -% -% \subsubsection{Main content} -% -% First load \pk{luatexbase-compat}. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-compat.sty -\else - \RequirePackage{luatexbase-compat} -\fi -% \end{macrocode} -% -% Load the supporting Lua module. This one doesn't follow the usual naming -% conventions, since it won't be loaded with the usual functions for -% obvious bootstraping reasons. -% -% \begin{macrocode} -\luatexbase@directlua{% - local file = "luatexbase.loader.lua" - local path = assert(kpse.find_file(file, 'lua'), - "File '"..file.."' not found") - texio.write_nl("("..path..")") - dofile(path)} -% \end{macrocode} -% -% That's all, folks! -% -% \begin{macrocode} -\luatexbase@loader@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \subsection{Lua module} -% -% \begin{macrocode} -%<*luamodule> -luatexbase = luatexbase or { } -local luatexbase = luatexbase -% \end{macrocode} -% -% Just in case it's called from a \TeX Lua script... -% -% \begin{macrocode} -kpse.set_program_name("luatex") -% \end{macrocode} -% -% In \LaTeX, it's traditional to print the included file paths. We don't want -% to do this for scripts using texlua... Currently there is no perfect check -% of texlua vs. luatex, so we check for the token table. -% -% \begin{macrocode} -local print_included_path = false -if token then - print_included_path = true -end -% \end{macrocode} -% -% Emulate (approximatively) kpse's lua format search. More precisely, -% combine the search path of |texmfscripts| and |tex| in order to -% approximate |LUAINPUTS|. But we need to handle suffixes ourselves. -% -% |lua_suffixes| is taken verbatim from Kpathsea's source -% (\file{tex-file.c}, constant |LUA_SUFFIXES|).\footnote{Last checked 2013-04-12.} -% -% \begin{macrocode} -local lua_suffixes = { - ".luc", ".luctex", ".texluc", ".lua", ".luatex", ".texlua", -} -% \end{macrocode} -% -% Auxiliary function for suffixes: says if |suffix| is a suffix of |name|. -% -% \begin{macrocode} -local function ends_with(suffix, name) - return name:sub(-suffix:len()) == suffix -end -% \end{macrocode} -% -% Auxiliary function for suffixes: returns the basename of a file if it end -% by one of the suffixes. -% -% \begin{macrocode} -local function basename(name) - for _, suffix in ipairs(lua_suffixes) do - if ends_with(suffix, name) then - return name:sub(1, -(suffix:len()+1)) - end - end - return name -end -% \end{macrocode} -% -% The main function, emulating the behaviour of |packages.searchers[2]|, -% with a small improvement that eliminates the possible extension. -% -% \begin{macrocode} -local function find_module_file(mod) - local compat = basename(mod):gsub('%.', '/') - return kpse.find_file(compat, 'lua') or kpse.find_file(mod, 'lua') -end -% \end{macrocode} -% -% Combined searcher, using primarily the new kpse searcher, and the -% original as a fall-back. Starting from \luatex 0.75, Lua 5.2 is used. Among -% the changes, |package.loaders| is renamed as |package.searchers|. -% -% The main improvement is thus the printing of the filename in the output. -% -% \begin{macrocode} -local package_loader_two -if not package.searchers then - package.searchers = package.loaders -end -package_loader_two = package.searchers[2] -local function load_module(mod) - local file = find_module_file(mod) - if not file then - local msg = "\n\t[luatexbase.loader] Search failed" - local ret = package_loader_two(mod) - if type(ret) == 'string' then - return msg..ret - elseif type(ret) == 'nil' then - return msg - else - return ret - end - end - local loader, error = loadfile(file) - if not loader then - return "\n\t[luatexbase.loader] Loading error:\n\t"..error - end - if print_included_path then - texio.write_nl("("..file..")") - end - return loader -end -% \end{macrocode} -% -% Finally install this combined loader as loader 2. -% -% \begin{macrocode} -package.searchers[2] = load_module -%</luamodule> -% \end{macrocode} -% -% \section{Test files} -% -% A dummy lua file for tests. -% -% \begin{macrocode} -%<*testdummy> -return true -%</testdummy> -% \end{macrocode} -% -% Check that the package loads properly, under both LaTeX and Plain TeX, -% and load a dummy module in the current diretory. -% -% \begin{macrocode} -%<testplain>\input luatexbase-loader.sty -%<testlatex>\RequirePackage{luatexbase-loader} -%<*testplain,testlatex> -\catcode64 11 -\luatexbase@directlua{require "test-loader"} -\luatexbase@directlua{require "test-loader.sub"} -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-mcb.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-mcb.dtx deleted file mode 100644 index b0ae1c9c4e4..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-mcb.dtx +++ /dev/null @@ -1,1122 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% Copyright 2013 by Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-mcb.dtx -% and the derived files -% luatexbase-mcb.sty, mcb.lua, luatexbase-mcb.pdf, -% test-mcb-plain.tex test-mcb-latex.tex -% -% Unpacking: -% tex luatexbase-mcb.dtx -% Documentation: -% pdflatex luatexbase-mcb.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\let\MetaPrefix\relax - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\let\MetaPrefix\DoubleperCent - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-mcb.sty}{\from{luatexbase-mcb.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-mcb-plain.tex}{\from{luatexbase-mcb.dtx}{testplain}}% - \file{test-mcb-latex.tex}{\from{luatexbase-mcb.dtx}{testlatex}}% -} - -\def\MetaPrefix{-- } - -\def\luapostamble{% - \MetaPrefix^^J% - \MetaPrefix\space End of File `\outFileName'.% -} - -\def\currentpostamble{\luapostamble}% - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{mcb.lua}{\from{luatexbase-mcb.dtx}{lua}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-mcb.lua}{\from{luatexbase-mcb.dtx}{testlua}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-mcb.sty mcb.lua} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\documentclass{ltxdoc} -\input{lltxb-dtxstyle} -\begin{document} - \DocInput{luatexbase-mcb.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-mcb}{2013/05/11 v0.6} -% -% \maketitle -% -% \begin{abstract} -% The primary feature of this package is to allow many functions to be -% registered in the same callback. Depending of the type of the callback, the -% functions will be combined in some way when the callback is called. Functions -% are provided for addition and removal of individual functions from a -% callback's list, with a priority system.\par -% Additionally, you can create new callbacks that will be handled the same way -% as predefined callbacks, except that they must be called explicitly. -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% Before we start, let me mention that test files are provided (they should be -% in the same directory as this PDF file). You can have a look at them, -% compile them and have a look at the log, if you want examples of how this -% module works. -% -% \subsection{Managing functions in callbacks} -% -% \luatex provides an extremely interesting feature, named callbacks. It -% allows to call some Lua functions at some points of the \TeX\ algorithm (a -% \emph{callback}), like when \TeX\ breaks lines, puts vertical spaces, etc. -% The \luatex core offers a function called \texttt{callback.register} that -% enables to register a function in a callback. -% -% The problem with |callback.register| is that is registers only one function -% in a callback. This package solves the problem by disabling -% |callback.register| and providing a new interface allowing many functions to -% be registered in a single callback. -% -% The way the functions are combined together depends on -% the type of the callback. There are currently 4 types of callback, depending -% on the calling convention of the functions the callback can hold: -% \begin{description} -% \item[simple] is for functions that don't return anything: they are called -% in order, all with the same argument; -% \item[data] is for functions receiving a piece of data of any type -% except node list head (and possibly other arguments) and returning it -% (possibly modified): the functions are called in order, and each is -% passed the return value of the previous (and the other arguments -% untouched, if any). The return value is that of the last function; -% \item[list] is a specialized variant of \emph{data} for functions -% filtering node lists. Such functions may return either the head of a -% modified node list, or the boolean values |true| or |false|. The -% functions are chained the same way as for \emph{data} except that for -% the following. If -% one function returns |false|, then |false| is immediately returned and -% the following functions are \emph{not} called. If one function returns -% |true|, then the same head is passed to the next function. If all -% functions return |true|, then |true| is returned, otherwise the return -% value of the last function not returning |true| is used. -% \item[first] is for functions with more complex signatures; functions in -% this type of callback are \emph{not} combined: only the first one -% (according to priorities) is executed. -% \end{description} -% -% To add a function to a callback, use: -% \begin{verbatim} -% luatexbase.add_to_callback(name, func, description, priority) -% \end{verbatim} -% The first argument is the name of the callback, the second is a function, -% the third one is a string used to identify the function later, and the -% optional priority is a positive integer, representing the rank of the -% function in the list of functions to be executing for this callback. So, -% |1| is the highest priority. If no priority is specified, the function is -% appended to the list, that is, its priority is the one of the last function -% plus one. -% -% The priority system is intended to help resolving conflicts between packages -% competing on the same callback, but it cannot solve every possible issue. If -% two packages request priority |1| on the same callback, then the last one -% loaded will win. -% -% To remove a function from a callback, use: -% \begin{verbatim} -% luatexbase.remove_from_callback(name, description) -% \end{verbatim} -% The first argument must be the name of the callback, and the second one the -% description used when adding the function to this callback. You can also -% remove all functions from a callback at once using -% \begin{verbatim} -% luatexbase.reset_callback(name, make_false) -% \end{verbatim} -% The |make_false| argument is optional. If it is |true| (repeat: |true|, not -% |false|) then the value |false| is registered in the callback, which has a -% special meaning for some callback. -% -% Note that |reset_callback| is very invasive since it removes all functions -% possibly installed by other packages in this callback. So, use it with care -% if there is any chance that another package wants to share this callback -% with you. -% -% When new functions are added at the beginning of the list, other functions -% are shifted down the list. To get the current rank of a function in a -% callback's list, use: -% \begin{verbatim} -% priority = luatexbase.priority_in_callback(name, description) -% \end{verbatim} -% Again, the description is the string used when adding the function. If the -% function identified by this string is not in this callback's list, the -% priority returned is the boolean value |false|. -% -% \subsection{Creating new callbacks} -% -% This package also provides a way to create and call new callbacks, in -% addition to the default \luatex callbacks. -% \begin{verbatim} -% luatexbase.create_callback(name, type, default) -% \end{verbatim} -% The first argument is the callback's name, it must be unique. Then, the type -% goes as explained above, it is given as a string. Finally all user-defined -% callbacks have a default function which must\footnote{You can obviously -% provide a dummy function. If you're doing so often, please tell me, I may -% want to make this argument optional.} be provided as the third -% argument. It will be used when no other function is registered for this -% callback. -% -% Functions are added to and removed from user-defined callbacks just the same -% way as predefined callback, so the previous section still applies. There is -% one difference, however: user-defined callbacks must be called explicitly at -% some point in your code, while predefined callbacks are called automatically -% by \luatex. To do so, use: -% \begin{verbatim} -% luatexbase.call_callback(name, arguments...) -% \end{verbatim} -% The functions registered for this callback (or the default function) will be -% called with |arguments...| as arguments. -% -% \subsubsection{Limitations} -% -% For callbacks of type |first|, our new management system isn't actually -% better than good old |callback.register|. For some of them, is may be -% possible to split them into many callbacks, so that these callbacks can -% accept multiple functions. However, its seems risky and limited in use and -% is therefore nor implemented. -% -% At some point, \pk{luatextra} used to split |open_read_file| that way, but -% support for this was removed. It may be added back (as well as support for -% other split callbacks) if it appears there is an actual need for it. -% -% \subsection{Compatibility} -% -% Some callbacks have a calling convention that varies depending on the -% version of \luatex used. This package \emph{does not} try to track the type -% of the callbacks in every possible version of \luatex. The types are based -% on the last stable beta version (0.60.2 at the time this doc is written). -% -% However, for callbacks that have the same calling convention for every -% version of \luatex, this package should work with the same range of \luatex -% version as other packages in the \pk{luatexbase} bundle (currently, 0.25.4 -% to 0.60.2). -% -% \section{Implementation} -% -% \subsection{\tex package} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsubsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@mcb@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-mcb}[2013/05/11 v0.6 Callback management for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-mcb}{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.} - \expandafter\luatexbase@mcb@sty@endinput% -\fi -% \end{macrocode} -% -% \subsubsection{Load supporting Lua module} -% -% First load \pk{luatexbase-modutils} (hence \pk{luatexbase-loader} -% and \pk{luatexbase-compat}), then the supporting Lua module. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-modutils.sty -\else - \RequirePackage{luatexbase-modutils} -\fi -\luatexbase@directlua{require('luatexbase.mcb')} -% \end{macrocode} -% -% That's all folks! -% -% \begin{macrocode} -\luatexbase@mcb@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \subsection{Lua module} -% -% \begin{macrocode} -%<*lua> -% \end{macrocode} -% -% \subsubsection{Module identification} -% -% \begin{macrocode} -luatexbase = luatexbase or { } -local luatexbase = luatexbase -local err, warning, info, log = luatexbase.provides_module({ - name = "luatexbase-mcb", - version = 0.6, - date = "2013/05/11", - description = "register several functions in a callback", - author = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - copyright = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - license = "CC0", -}) -% \end{macrocode} -% -% First we declare the function references for the entire scope. -% -% \begin{macrocode} -local add_to_callback -local call_callback -local create_callback -local priority_in_callback -local remove_from_callback -local reset_callback -% \end{macrocode} -% -% \subsubsection{Housekeeping} -% -% The main table: keys are callback names, and values are the associated -% lists of functions. More precisely, the entries in the list are tables -% holding the actual function as |func| and the identifying description as -% |description|. Only callbacks with a non-empty list of functions have an -% entry in this list. -% -% \begin{macrocode} -local callbacklist = callbacklist or { } -% \end{macrocode} -% -% Numerical codes for callback types, and name to value association (the -% table keys are strings, the values are numbers). -% -% \begin{macrocode} -local list, data, first, simple = 1, 2, 3, 4 -local types = { - list = list, - data = data, - first = first, - simple = simple, -} -% \end{macrocode} -% -% Now, list all predefined callbacks with their current type, based on the -% LuaTeX manual version 0.60.2. -% -% \begin{macrocode} -local callbacktypes = callbacktypes or { -% \end{macrocode} -% -% Section 4.1.1: file discovery callbacks. -% -% \begin{macrocode} - find_read_file = first, - find_write_file = first, - find_font_file = data, - find_output_file = data, - find_format_file = data, - find_vf_file = data, - find_ocp_file = data, - find_map_file = data, - find_enc_file = data, - find_sfd_file = data, - find_pk_file = data, - find_data_file = data, - find_opentype_file = data, - find_truetype_file = data, - find_type1_file = data, - find_image_file = data, -% \end{macrocode} -% -% Section 4.1.2: file reading callbacks. -% -% \begin{macrocode} - open_read_file = first, - read_font_file = first, - read_vf_file = first, - read_ocp_file = first, - read_map_file = first, - read_enc_file = first, - read_sfd_file = first, - read_pk_file = first, - read_data_file = first, - read_truetype_file = first, - read_type1_file = first, - read_opentype_file = first, -% \end{macrocode} -% -% Section 4.1.3: data processing callbacks. -% -% \begin{macrocode} - process_input_buffer = data, - process_output_buffer = data, - token_filter = first, -% \end{macrocode} -% -% Section 4.1.4: node list processiong callbacks. -% -% \begin{macrocode} - buildpage_filter = simple, - pre_linebreak_filter = list, - linebreak_filter = list, - post_linebreak_filter = list, - hpack_filter = list, - vpack_filter = list, - pre_output_filter = list, - hyphenate = simple, - ligaturing = simple, - kerning = simple, - mlist_to_hlist = list, -% \end{macrocode} -% -% Section 4.1.5: information reporting callbacks. -% -% \begin{macrocode} - start_run = simple, - stop_run = simple, - start_page_number = simple, - stop_page_number = simple, - show_error_hook = simple, -% \end{macrocode} -% -% Section 4.1.6: font-related callbacks. -% -% \begin{macrocode} - define_font = first, -} -% \end{macrocode} -% -% All user-defined callbacks have a default function. The following table's -% keys are the names of the user-defined callback, the associated value is -% the default functon for this callback. This table is also used to -% identify the user-defined callbacks. -% -% \begin{macrocode} -local lua_callbacks_defaults = { } -% \end{macrocode} -% -% Overwrite |callback.register|, but save it first. Also define a wrapper -% that automatically raise an error when something goes wrong. -% -% \begin{macrocode} -local original_register = original_register or callback.register -callback.register = function () - err("function callback.register has been trapped,\n" - .."please use luatexbase.add_to_callback instead.") -end -local function register_callback(...) - return assert(original_register(...)) -end -% \end{macrocode} -% -% \subsubsection{Handlers} -% -% Normal (as opposed to user-defined) callbacks have handlers depending on -% their type. The handler function is registered into the callback when the -% first function is added to this callback's list. Then, when the callback -% is called, then handler takes care of running all functions in the list. -% When the last function is removed from the callback's list, the handler -% is unregistered. -% -% More precisely, the functions below are used to generate a specialized -% function (closure) for a given callback, which is the actual handler. -% -% Handler for |list| callbacks. -% -% \begin{macrocode} -local function listhandler (name) - return function(head,...) - local ret - local alltrue = true - for _, f in ipairs(callbacklist[name]) do - ret = f.func(head, ...) - if ret == false then - warning("function '%s' returned false\nin callback '%s'", - f.description, name) - break - end - if ret ~= true then - alltrue = false - head = ret - end - end - return alltrue and true or head - end -end -% \end{macrocode} -% -% Handler for |data| callbacks. -% -% \begin{macrocode} -local function datahandler (name) - return function(data, ...) - for _, f in ipairs(callbacklist[name]) do - data = f.func(data, ...) - end - return data - end -end -% \end{macrocode} -% -% Handler for |first| callbacks. We can assume |callbacklist[name]| is not -% empty: otherwise, the function wouldn't be registered in the callback any -% more. -% -% \begin{macrocode} -local function firsthandler (name) - return function(...) - return callbacklist[name][1].func(...) - end -end -% \end{macrocode} -% -% Handler for |simple| callbacks. -% -% \begin{macrocode} -local function simplehandler (name) - return function(...) - for _, f in ipairs(callbacklist[name]) do - f.func(...) - end - end -end -% \end{macrocode} -% -% Finally, keep a handlers table for indexed access. -% -% \begin{macrocode} -local handlers = { - [list] = listhandler, - [data] = datahandler, - [first] = firsthandler, - [simple] = simplehandler, -} -% \end{macrocode} -% -% \subsubsection{Public functions for functions management} -% -% Add a function to a callback. First check arguments. -% -% \begin{macrocode} -function add_to_callback (name,func,description,priority) - if type(func) ~= "function" then - return err("unable to add function:\nno proper function passed") - end - if not name or name == "" then - err("unable to add function:\nno proper callback name passed") - return - elseif not callbacktypes[name] then - err("unable to add function:\n'%s' is not a valid callback", name) - return - end - if not description or description == "" then - err("unable to add function to '%s':\nno proper description passed", - name) - return - end - if priority_in_callback(name, description) then - err("function '%s' already registered\nin callback '%s'", - description, name) - return - end -% \end{macrocode} -% -% Then test if this callback is already in use. If not, initialise its list -% and register the proper handler. -% -% \begin{macrocode} - local l = callbacklist[name] - if not l then - l = {} - callbacklist[name] = l - if not lua_callbacks_defaults[name] then - register_callback(name, handlers[callbacktypes[name]](name)) - end - end -% \end{macrocode} -% -% Actually register the function. -% -% \begin{macrocode} - local f = { - func = func, - description = description, - } - priority = tonumber(priority) - if not priority or priority > #l then - priority = #l+1 - elseif priority < 1 then - priority = 1 - end - table.insert(l,priority,f) -% \end{macrocode} -% -% Keep user informed. -% -% \begin{macrocode} - if callbacktypes[name] == first and #l ~= 1 then - warning("several functions in '%s',\n" - .."only one will be active.", name) - end - log("inserting '%s'\nat position %s in '%s'", - description, priority, name) -end -luatexbase.add_to_callback = add_to_callback -% \end{macrocode} -% -% Remove a function from a callback. First check arguments. -% -% \begin{macrocode} -function remove_from_callback (name, description) - if not name or name == "" then - err("unable to remove function:\nno proper callback name passed") - return - elseif not callbacktypes[name] then - err("unable to remove function:\n'%s' is not a valid callback", name) - return - end - if not description or description == "" then - err( - "unable to remove function from '%s':\nno proper description passed", - name) - return - end - local l = callbacklist[name] - if not l then - err("no callback list for '%s'",name) - return - end -% \end{macrocode} -% -% Then loop over the callback's function list until we find a matching -% entry. Remove it and check if the list gets empty: if so, unregister the -% callback handler unless the callback is user-defined. -% -% \begin{macrocode} - local index = false - for k,v in ipairs(l) do - if v.description == description then - index = k - break - end - end - if not index then - err("unable to remove '%s'\nfrom '%s'", description, name) - return - end - table.remove(l, index) - log("removing '%s'\nfrom '%s'", description, name) - if #l == 0 then - callbacklist[name] = nil - if not lua_callbacks_defaults[name] then - register_callback(name, nil) - end - end - return -end -luatexbase.remove_from_callback = remove_from_callback -% \end{macrocode} -% -% Remove all the functions registered in a callback. Unregisters the -% callback handler unless the callback is user-defined. -% -% \begin{macrocode} -function reset_callback (name, make_false) - if not name or name == "" then - err("unable to reset:\nno proper callback name passed") - return - elseif not callbacktypes[name] then - err("unable to reset '%s':\nis not a valid callback", name) - return - end - log("resetting callback '%s'", name) - callbacklist[name] = nil - if not lua_callbacks_defaults[name] then - if make_false == true then - log("setting '%s' to false", name) - register_callback(name, false) - else - register_callback(name, nil) - end - end -end -luatexbase.reset_callback = reset_callback -% \end{macrocode} -% -% Get a function's priority in a callback list, or false if the function is -% not in the list. -% -% \begin{macrocode} -function priority_in_callback (name, description) - if not name or name == "" - or not callbacktypes[name] - or not description then - return false - end - local l = callbacklist[name] - if not l then return false end - for p, f in pairs(l) do - if f.description == description then - return p - end - end - return false -end -luatexbase.priority_in_callback = priority_in_callback -% \end{macrocode} -% -% \subsubsection{Public functions for user-defined callbacks} -% -% This first function creates a new callback. The signature is -% \texttt{create(name, ctype, default)} where \texttt{name} is the name of -% the new callback to create, \texttt{ctype} is the type of callback, and -% \texttt{default} is the default function to call if no function is -% registered in this callback. -% -% The created callback will behave the same way Lua\TeX\ callbacks do, you -% can add and remove functions in it. The difference is that the callback -% is not automatically called, the package developer creating a new -% callback must also call it, see next function. -% -% \begin{macrocode} -function create_callback(name, ctype, default) - if not name then - err("unable to call callback:\nno proper name passed", name) - return nil - end - if not ctype or not default then - err("unable to create callback '%s':\n" - .."callbacktype or default function not specified", name) - return nil - end - if callbacktypes[name] then - err("unable to create callback '%s':\ncallback already exists", name) - return nil - end - ctype = types[ctype] - if not ctype then - err("unable to create callback '%s':\ntype '%s' undefined", name, ctype) - return nil - end - log("creating '%s' type %s", name, ctype) - lua_callbacks_defaults[name] = default - callbacktypes[name] = ctype -end -luatexbase.create_callback = create_callback -% \end{macrocode} -% -% This function calls a callback. It can only call a callback created by -% the \texttt{create} function. -% -% \begin{macrocode} -function call_callback(name, ...) - if not name then - err("unable to call callback:\nno proper name passed", name) - return nil - end - if not lua_callbacks_defaults[name] then - err("unable to call lua callback '%s':\nunknown callback", name) - return nil - end - local l = callbacklist[name] - local f - if not l then - f = lua_callbacks_defaults[name] - else - f = handlers[callbacktypes[name]](name) - if not f then - err("unknown callback type") - return - end - end - return f(...) -end -luatexbase.call_callback = call_callback -% \end{macrocode} -% -% That's all folks! -% -% \begin{macrocode} -%</lua> -% \end{macrocode} -% -% \section{Test files} -% -% A few basic tests for Plain and LaTeX. Use a separate Lua file for -% convenience, since this package works on the Lua side of the force. -% -% \begin{macrocode} -%<*testlua> -local msg = texio.write_nl -% \end{macrocode} -% -% Test the management functions with a predefined callback. -% -% \begin{macrocode} -local function sample(head,...) - return head, true -end -local prio = luatexbase.priority_in_callback -msg("\n*********\n* Testing management functions\n*********") -luatexbase.add_to_callback("hpack_filter", sample, "sample one", 1) -luatexbase.add_to_callback("hpack_filter", sample, "sample two", 2) -luatexbase.add_to_callback("hpack_filter", sample, "sample three", 1) -assert(prio("hpack_filter", "sample three")) -luatexbase.remove_from_callback("hpack_filter", "sample three") -assert(not prio("hpack_filter", "sample three")) -luatexbase.reset_callback("hpack_filter") -assert(not prio("hpack_filter", "sample one")) -% \end{macrocode} -% -% Create a callback, and check that the managment functions work with this -% callback too. -% -% \begin{macrocode} -local function data_one(s) - texio.write_nl("I'm data 1 whith argument: "..s) - return s -end -local function data_two(s) - texio.write_nl("I'm data 2 whith argument: "..s) - return s -end -local function data_three(s) - texio.write_nl("I'm data 3 whith argument: "..s) - return s -end -msg("\n*********\n* Testing user-defined callbacks\n*********") -msg("* create one") -luatexbase.create_callback("fooback", "data", data_one) -msg("* call it") -luatexbase.call_callback("fooback", "default") -msg("* add two functions") -luatexbase.add_to_callback("fooback", data_two, "function two", 2) -luatexbase.add_to_callback("fooback", data_three, "function three", 1) -msg("* call") -luatexbase.call_callback("fooback", "all") -msg("* rm one function") -luatexbase.remove_from_callback("fooback", "function three") -msg("* call") -luatexbase.call_callback("fooback", "all but three") -msg("* reset") -luatexbase.reset_callback("fooback") -msg("* call") -luatexbase.call_callback("fooback", "default") -% \end{macrocode} -% -% Now, we want to make each handler run at least once. So, define dummy -% functions and register them in various callbacks. We will make sure the -% callbacks are executed on the \tex end. Also, we want to check that -% everything works when we unload the functions either one by one, or using -% reset. -% -% A |list| callback. -% -% \begin{macrocode} -function add_hpack_filter() - luatexbase.add_to_callback('hpack_filter', function(head, ...) - texio.write_nl("I'm a dummy hpack_filter") - return head - end, - 'dummy hpack filter') - luatexbase.add_to_callback('hpack_filter', function(head, ...) - texio.write_nl("I'm an optimized dummy hpack_filter") - return true - end, - 'optimized dummy hpack filter') -end -function rm_one_hpack_filter() - luatexbase.remove_from_callback('hpack_filter', 'dummy hpack filter') -end -function rm_two_hpack_filter() - luatexbase.remove_from_callback('hpack_filter', - 'optimized dummy hpack filter') -end -% \end{macrocode} -% -% A |simple| callback. -% -% \begin{macrocode} -function add_hyphenate() - luatexbase.add_to_callback('hyphenate', function(head, tail) - texio.write_nl("I'm a dummy hyphenate") - end, - 'dummy hyphenate') - luatexbase.add_to_callback('hyphenate', function(head, tail) - texio.write_nl("I'm an other dummy hyphenate") - end, - 'other dummy hyphenate') -end -function rm_one_hyphenate() - luatexbase.remove_from_callback('hyphenate', 'dummy hyphenate') -end -function rm_two_hyphenate() - luatexbase.remove_from_callback('hyphenate', 'other dummy hyphenate') -end -% \end{macrocode} -% -% A |first| callback. -% -% \begin{macrocode} -function add_find_write_file() - luatexbase.add_to_callback('find_write_file', function(id, name) - texio.write_nl("I'm a dummy find_write_file") - return "dummy-"..name - end, - 'dummy find_write_file') - luatexbase.add_to_callback('find_write_file', function(id, name) - texio.write_nl("I'm an other dummy find_write_file") - return "dummy-other-"..name - end, - 'other dummy find_write_file') -end -function rm_one_find_write_file() - luatexbase.remove_from_callback('find_write_file', - 'dummy find_write_file') -end -function rm_two_find_write_file() - luatexbase.remove_from_callback('find_write_file', - 'other dummy find_write_file') -end -% \end{macrocode} -% -% A |data| callback. -% -% \begin{macrocode} -function add_process_input_buffer() - luatexbase.add_to_callback('process_input_buffer', function(buffer) - return buffer.."\\msg{dummy}" - end, - 'dummy process_input_buffer') - luatexbase.add_to_callback('process_input_buffer', function(buffer) - return buffer.."\\msg{otherdummy}" - end, - 'other dummy process_input_buffer') -end -function rm_one_process_input_buffer() - luatexbase.remove_from_callback('process_input_buffer', - 'dummy process_input_buffer') -end -function rm_two_process_input_buffer() - luatexbase.remove_from_callback('process_input_buffer', - 'other dummy process_input_buffer') -end -% \end{macrocode} -% -% \begin{macrocode} -%</testlua> -% \end{macrocode} -% -% \begin{macrocode} -%<testplain>\input luatexbase-mcb.sty -%<testlatex>\RequirePackage{luatexbase-mcb} -%<*testplain,testlatex> -\catcode 64 11 -\def\msg{\immediate\write16} -\msg{===== BEGIN =====} -% \end{macrocode} -% -% Loading the lua files tests that the management functions can be called -% without raising errors. -% -% \begin{macrocode} -\luatexbase@directlua{dofile('test-mcb.lua')} -% \end{macrocode} -% -% We now want to load and unload stuff from the various callbacks have them -% called to test the handlers. Here is a helper macro for that. -% -% \begin{macrocode} -\def\test#1#2{% - \msg{^^J*********^^J* Testing #1 (type #2)^^J*********} - \msg{* Add two functions} - \luatexbase@directlua{add_#1()} - \csname test_#1\endcsname - \msg{* Remove one} - \luatexbase@directlua{rm_one_#1()} - \csname test_#1\endcsname - \msg{* Remove the second} - \luatexbase@directlua{rm_two_#1()} - \csname test_#1\endcsname - \msg{* Add two functions again} - \luatexbase@directlua{add_#1()} - \csname test_#1\endcsname - \msg{* Remove all functions} - \luatexbase@directlua{luatexbase.reset_callback("#1")} - \csname test_#1\endcsname -} -% \end{macrocode} -% -% For each callback, we need a specific macro that triggers it. For the -% hyphenate test, we need to untrap |\everypar| first, in the \latex case. -% -% \begin{macrocode} -\catcode`\_ 11 -%<testlatex>\everypar{} -\def\test_hpack_filter{\setbox0=\hbox{bla}} -\def\test_hyphenate{\showhyphens{hyphenation}} -\def\test_find_write_file{\immediate\openout15 test-mcb-out.log} -\def\test_process_input_buffer{\input test-mcb-aux.tex} -% \end{macrocode} -% -% Now actually test them -% -% \begin{macrocode} -\test{hpack_filter}{list} -\test{hyphenate}{simple} -\test{find_write_file}{first} -\test{process_input_buffer}{data} -% \end{macrocode} -% -% Done. -% -% \begin{macrocode} -\msg{===== END =====} -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-modutils.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-modutils.dtx deleted file mode 100644 index f411e465df1..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-modutils.dtx +++ /dev/null @@ -1,750 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-modutils.dtx -% and the derived files -% luatexbase-modutils.sty modutils.lua -% test-modutils-plain.tex test-modutils-latex.tex test-modutils.lua -% -% Unpacking: -% tex luatexbase-modutils.dtx -% Documentation: -% pdflatex luatexbase-modutils.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\let\MetaPrefix\relax - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\let\MetaPrefix\DoubleperCent - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-modutils.sty}{\from{luatexbase-modutils.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-modutils-plain.tex}{\from{luatexbase-modutils.dtx}{testplain}}% - \file{test-modutils-latex.tex}{\from{luatexbase-modutils.dtx}{testlatex}}% -} - -\def\MetaPrefix{-- } - -\def\luapostamble{% - \MetaPrefix^^J% - \MetaPrefix\space End of File `\outFileName'.% -} - -\def\currentpostamble{\luapostamble}% - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{modutils.lua}{\from{luatexbase-modutils.dtx}{luamodule}}% - \usedir{doc/luatex/luatexbase}% - \file{test-modutils.lua}{\from{luatexbase-modutils.dtx}{testdummy}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-modutils.sty modutils.lua} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\documentclass{ltxdoc} -\input{lltxb-dtxstyle} -\begin{document} - \DocInput{luatexbase-modutils.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-modutils}{v0.6 2013-05-11} -% -% \maketitle -% -% \begin{abstract} -% This package provides functions similar to \latex's |\usepackage| and -% |\ProvidesPackage| macros,\footnote{and their variants or synonyms such as -% \cs{documentclass} and \cs{RequirePackage} or \cs{ProvidesClass} and -% \cs{ProvidesFiles}} or more precisely the part of these macros that deals -% with identification and version checking (no attempt is done at implementing -% an option mechanism). It also provides functions for reporting errors and -% warnings in a standardised format. -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% \subsection{Scope of this package} -% -% Lua's standard function |require()| is similar to \tex's |\input| primitive -% but is somehow more evolved in that it makes a few checks to avoid loading -% the same module twice. In the \tex world, this needs to be taken care of by -% macro packages; in the \latex world this is done by |\usepackage|. -% -% But |\usepackage| also takes care of many other things. Most notably, it -% implements a complex option system, and does some identification and version -% checking. The present package doesn't try to provide anything for options, -% but implements a system for identification and version checking similar to -% \latex's system. -% -% \medskip -% -% It is important to note that Lua's unction |module()| is deprecated in -% Lua 5.2 and should be avoided. For examples of good practices for creating -% modules, see section~\ref{template}. Chapter 15 -% of \href{http://www.lua.org/pil/15.html}{Programming in Lua, 3rd ed.} -% discusses various methods for managing packages. -% -% \subsection{\tex macros} -% -% \begin{qcode} -% \cs{RequireLuaModule}\marg{name}\oarg{date} -% \end{qcode} -% -% The macro |\RequireLuaModule| is an interface to the Lua function -% |require_module|; it take the same arguments with the same meaning. The -% second argument is optional. -% -% \subsection{Lua functions} -% -% \begin{qcode} -% luatexbase.require_module({\meta{name}} [, \meta{required date}]) -% \end{qcode} -% -% The function |luatexbase.require_module()| may be used as a replacement to -% |require()|. If only one argument is given, the only difference with -% |require()| is it checks that the module properly identifies itself (as -% explained below) with the same name. -% -% The second argument is optional; if used, it must be a -% string\footnote{Previous versions of the package supported floating-point -% version numbers as well, but it caused confusion with authors trying to use -% version strings such as |0.3a| and probably isn't worth the trouble.} -% containing a date in |YYYY//MM/DD| format which specifies the minimum -% version of the module required. -% -% \begin{qcode} -% luatexbase.provides_module(\meta{info}) -% \end{qcode} -% This function is used by modules to identify themselves; the argument is a -% table containing information about the module. The required field |name| -% must contain the name of the module. It is recommended to provide a field -% |date| with the same format as above. Optional fields |version| (number or -% string) and |description| may be used if present. Other fields are ignored. -% -% If a date was required, then a warning is issued if the required date is -% strictly newer than the declared date (or if no date was declared). A list -% of loaded modules and their associated information is kept, and used to -% check the date without reloading the module (since |require()| won't reload -% it anyway) if a module is required several times. -% -% \begin{qcode} -% luatexbase.module_error(\meta{name}, \meta{message}, ...) -% luatexbase.module_warning(\meta{name}, \meta{message}, ...) -% luatexbase.module_info(\meta{name}, \meta{message}, ...) -% luatexbase.module_log(\meta{name}, \meta{message}, ...) -% \end{qcode} -% These functions are similar to \latex's |\PackageError|, |\PackageWarning| -% and |\PackageInfo| in the way they format the output. No automatic line -% breaking is done, you may still use |\n| as usual for that, and the name of -% the package will be prepended to each output line (except for |log| which is -% intended for short messages in a non-verbose format). The first argument -% is the name of the current module; the remaining arguments are passed to -% |string.format()|. -% -% Note that |module_error| raises an actual Lua error with |error()|, which -% currently means a call stack will be dumped. While this may not look pretty, -% at least it provides useful information for tracking the error down. -% -% \begin{qcode} -% local err, warn, info, log = luatexbase.errwarinf(\meta{name}) -% local err, warn, info, log = luatexbase.provides_module(\meta{name}) -% \end{qcode} -% Customised versions of the above commands maybe obtained by invoking -% |errwarinf()| and are also returned by |provides_module()|. They don't take -% the name of the module as their first argument any more, so that you don't -% need to repeat it all over the place. (Notice that |error| is the name of a -% standard Lua function, so you may want to avoid overwriting it, hence the -% use of |err| in the above example.) -% -% \begin{qcode} -% local module_info = luatexbase.get_module_info(\meta{name}) -% local version = luatexbase.get_module_version(\meta{name}) -% local date = luatexbase.get_module_date(\meta{name}) -% local date_int = luatexbase.get_module_date_int(\meta{name}) -% local is_loaded = luatexbase.is_module_loaded(\meta{name}) -% \end{qcode} -% These functions check for the availability or version of a module, and can -% even return a copy of the |module_info| table. -% -% \subsection{Templates}\label{template} -% -% Now, here is a module header template showing all the recommended elements: -% \begin{verbatim} -% local err, warn, info, log = luatexbase.provides_module({ -% -- required -% name = 'mymodule', -% -- recommended -% date = '1970/01/01', -% version = 0.0, -- or version = '0.0a', -% description = 'a Lua module template', -% -- optional and ignored -% author = 'A. U. Thor', -% licence = 'LPPL v1.3+', -% }) -% -% mynamespace = mynamespace or { } -% local mynamespace = mynamespace -% -% \end{verbatim} -% -% Alternatively, if you don't want to assume \pk{luatexbase-modutils} is -% loaded, you may load your module with: -% \begin{verbatim} -% (luatexbase.require_module or require)('mymodule') -% \end{verbatim} -% and begin your module's code with: -% \begin{verbatim} -% if luatexbase._provides_module then -% luatexbase.provides_module({ -% -- required -% name = 'mymodule', -% -- recommended -% date = '1970/01/01', -% version = 0.0, -- or version = '0.0a', -% description = 'a Lua module template', -% -- optional and ignored -% author = 'A. U. Thor', -% licence = 'LPPL v1.3+', -% }) -% end -% -% mynamespace = mynamespace or { } -% local mynamespace = mynamespace -% -% local function err(msg) -% -- etc. -% \end{verbatim} -% -% \section{Implementation} -% -% \subsection{\tex package} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsubsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 34 12 % " - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@modutils@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-modutils}[2013/05/11 v0.6 Module utilities for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-modutils}{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.} - \expandafter\luatexbase@modutils@sty@endinput% -\fi -% \end{macrocode} -% -% Load \pk{luatexbase-loader} (hence \pk{luatexbase-compat}), require the -% supporting Lua module and make sure |luaescapestring| is available. -% -% \begin{macrocode} -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-loader.sty -\else - \RequirePackage{luatexbase-loader} -\fi -\luatexbase@directlua{require('luatexbase.modutils')} -\luatexbase@ensure@primitive{luaescapestring} -% \end{macrocode} -% -% \subsection{Auxiliary definitions} -% -% We need a version of |\@ifnextchar|. The definitions for the not-\latex -% case are stolen from \pk{ltxcmds} verbatim, only the prefix is changed. -% -% \begin{macrocode} -\ifdefined\kernel@ifnextchar - \let\lltxb@ifnextchar\kernel@ifnextchar -\else - \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 -% \end{macrocode} -% -% \subsubsection{User macro} -% -% Interface to the Lua function for module loading. Avoid passing a second -% argument to the function if empty (most probably not specified). -% -% \begin{macrocode} -\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)}} -% \end{macrocode} -% -% \begin{macrocode} -\luatexbase@modutils@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \subsection{Lua module} -% -% \begin{macrocode} -%<*luamodule> -luatexbase = luatexbase or { } -local luatexbase = luatexbase -local string_gsub = string.gsub -% \end{macrocode} -% -% \subsection{Internal functions and data} -% -% Tables holding informations about the modules loaded and the versions -% required. Keys are module names and values are the info tables as passed -% to |provides_module()|. -% -% \begin{macrocode} -local modules = modules or {} -% \end{macrocode} -% -% Convert a date in YYYY/MM/DD format into a number. -% -% \begin{macrocode} -local function date_to_int(date) - if date == '' then return -1 end - local numbers = string_gsub(date, "(%d+)/(%d+)/(%d+)", "%1%2%3") - return tonumber(numbers) -end -% \end{macrocode} -% -% \subsubsection{Error, warning and info function for modules} -% -% Here are the reporting functions for the modules. An internal function is -% used for error messages, so that the calling level (last argument of -% |error()| remains constant using either |module_error()| or a custom -% version as returned by |errwarinf()|. -% -% \begin{macrocode} -local function msg_format(msg_type, mod_name, ...) - local cont = '('..mod_name..')' .. ('Module: '..msg_type):gsub('.', ' ') - return 'Module '..mod_name..' '..msg_type..': ' - .. string.format(...):gsub('\n', '\n'..cont) .. '\n' -end -local function module_error_int(mod, ...) - error(msg_format('error', mod, ...), 3) -end -local function module_error(mod, ...) - module_error_int(mod, ...) -end -luatexbase.module_error = module_error -% \end{macrocode} -% -% Split the lines explicitly in order not to depend on the value of -% |\newlinechar|. -% -% \begin{macrocode} -local function module_warning(mod, ...) - for _, line in ipairs(msg_format('warning', mod, ...):explode('\n')) do - texio.write_nl(line) - end -end -luatexbase.module_warning = module_warning -local function module_info(mod, ...) - for _, line in ipairs(msg_format('info', mod, ...):explode('\n')) do - texio.write_nl(line) - end -end -luatexbase.module_info = module_info -% \end{macrocode} -% -% No line splitting or advanced formating here. -% -% \begin{macrocode} -local function module_log(mod, msg, ...) - texio.write_nl('log', mod..': '..msg:format(...)) -end -luatexbase.module_log = module_log -% \end{macrocode} -% -% Produce custom versions of the reporting functions. -% -% \begin{macrocode} -local function errwarinf(name) - return function(...) module_error_int(name, ...) end, - function(...) module_warning(name, ...) end, - function(...) module_info(name, ...) end, - function(...) module_log(name, ...) end -end -luatexbase.errwarinf = errwarinf -% \end{macrocode} -% -% For our own convenience, local functions for warning and errors in the -% present module. -% -% \begin{macrocode} -local err, warn = errwarinf('luatexbase.modutils') -% \end{macrocode} -% -% \subsubsection{module loading and providing functions} -% -% Load a module with mandatory name checking and optional version checking. -% -% \begin{macrocode} -local function require_module(name, req_date) - require(name) - local info = modules[name] - if not info then - warn("module '%s' was not properly identified", name) - elseif req_date and info.date then - if date_to_int(info.date) < date_to_int(req_date) then - warn("module '%s' required in version '%s'\n" - .. "but found in version '%s'", name, req_date, info.date) - end - end -end -luatexbase.require_module = require_module -% \end{macrocode} -% -% Provide identification information for a module. As a bonus, custom -% reporting functions are returned. No need to do any check here, -% everything done in |require_module()|. -% -% \begin{macrocode} -local function provides_module(info) - if not (info and info.name) then - err('provides_module: missing information') - end - texio.write_nl('log', string.format("Lua module: %s %s %s %s\n", - info.name, info.date or '', info.version or '', info.description or '')) - modules[info.name] = info - return errwarinf(info.name) -end -luatexbase.provides_module = provides_module -% \end{macrocode} -% -% \subsubsection{module availability and version checking} -% -% A simple table copy function. -% -% \begin{macrocode} -local fastcopy -fastcopy = table.fastcopy or function(old) - if old then - local new = { } - for k,v in next, old do - if type(v) == "table" then - new[k] = fastcopy(v) - else - new[k] = v - end - end - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) - end - return new - else - return { } - end -end -% \end{macrocode} -% -% Gives the table of the infos on a module, as given in |provides_module|. -% -% \begin{macrocode} -local function get_module_info(name) - local module_table = modules[name] - if not module_table then - return nil - else - return fastcopy(module_table) - end -end -luatexbase.get_module_info = get_module_info -% \end{macrocode} -% -% Gives the version of a module, nil if the module is not loaded and empty -% string if the module did not set its date. -% -% \begin{macrocode} -function get_module_version(name) - local module_table = modules[name] - if not module_table then - return nil - else - return module_table.version - end -end -luatexbase.get_module_version = get_module_version -% \end{macrocode} -% -% Gives the date string of a module, nil if the module is not loaded and -% empty string of the modules did not set its date. -% -% \begin{macrocode} -function get_module_date(name) - local module_table = modules[name] - if not module_table then - return nil - else - return module_table.date - end -end -luatexbase.get_module_date = get_module_date -% \end{macrocode} -% -% Gives the date number of a module, for date comparison, nil if the -% module is not loaded and -1 if the module did not set its date. The number -% is formated as |yyyymmdd|. -% -% \begin{macrocode} -function get_module_date_int(name) - local module_table = modules[name] - if not module_table then - return nil - else - return module_table.date and date_to_int(module_table.date) - end -end -luatexbase.get_module_date_int = get_module_date_int -% \end{macrocode} -% -% Returns true if the module is loaded, false otherwise. -% -% \begin{macrocode} -function is_module_loaded(name) - if modules[name] then - return true - else - return false - end -end -luatexbase.is_module_loaded = is_module_loaded -% \end{macrocode} -% -% We provide the module, for version checking. -% -% \begin{macrocode} -provides_module({ - name = 'luatexbase-modutils', - date = '2013/05/11', - version = 0.6, - description = 'Module utilities for LuaTeX', -}) -% \end{macrocode} -% -% \begin{macrocode} -%</luamodule> -% \end{macrocode} -% -% \section{Test files} -% -% A dummy lua file for tests. -% -% \begin{macrocode} -%<*testdummy> -local err, warn, info, log = luatexbase.provides_module { - name = 'test-modutils', - date = '2000/01/01', - version = 1, - description = 'dummy test package', -} -luatexbase.provides_module { - name = 'test-modutils2', - date = '', - version = 1, - description = 'dummy test package', -} -info('It works!\nOh, rly?\nYeah rly!') -log("I'm a one-line info.") -info("1 = "..luatexbase.get_module_version('test-modutils')) -if is_module_loaded('test-modutils') then - info("ok!") -else - err("problem!") -end -info("2000/01/01 = "..luatexbase.get_module_info('test-modutils').date) -info("20000101 = "..luatexbase.get_module_date_int('test-modutils')) -info("-1 = "..luatexbase.get_module_date_int('test-modutils2')) -%</testdummy> -% \end{macrocode} -% -% We just check that the package loads properly, under both LaTeX and Plain -% TeX, is able to load and identify the above dummy module. -% -% \begin{macrocode} -%<testplain>\input luatexbase-modutils.sty -%<testlatex>\RequirePackage{luatexbase-modutils} -%<*testplain,testlatex> -\RequireLuaModule{test-modutils} -\RequireLuaModule{test-modutils}[1970/01/01] -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-regs.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase-regs.dtx deleted file mode 100644 index f3a29a85868..00000000000 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase-regs.dtx +++ /dev/null @@ -1,476 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase-regs.dtx -% and the derived files -% luatexbase-regs.pdf luatexbase-regs.sty -% test-regs-plain.tex test-regs-latex.tex -% -% Unpacking: -% tex luatexbase-regs.dtx -% Documentation: -% pdflatex luatexbase-regs.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase-regs.sty}{\from{luatexbase-regs.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-regs-plain.tex}{\from{luatexbase-regs.dtx}{testplain}}% - \file{test-regs-latex.tex}{\from{luatexbase-regs.dtx}{testlatex}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase-regs.sty} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\NeedsTeXFormat{LaTeX2e} -\documentclass{ltxdoc} -\input lltxb-dtxstyle.tex -\EnableCrossrefs -\CodelineIndex -\begin{document} - \DocInput{luatexbase-regs.dtx}% -\end{document} -%</driver> -% \fi -% -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase-regs}{2011/05/24 v0.4} -% -% \maketitle -% -% \begin{abstract} -% This package extends the register allocation scheme of \plaintex and -% \latex to take advantage of the increased number of registers available in -% \luatex. -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% Since the \plaintex and \latex formats are both frozen, they fail to take -% into account the extended resources provided by newer \tex-like engines. -% This package focuses on the allocation scheme for registers. \texe provides -% $6$ kinds or registers: count, dimen, skip, muskip, box and toks and has -% $256$ registers of each kind. \eTeX\ and most of its descendants add one -% kind of register (marks) and offers $2^{15} = 32768$ of each kind. \luatex -% provides $2^{16} = 65536$ registers of each kind. (It also provides new -% register-like resources, but this package addresses only the resources -% inherited from \eTeX.) -% -% More precisely, \pk{luatexbase-regs} loads the \pk{etex} package (or -% makes sure it is preloaded in the format) and then adapts it to the new -% limits of \luatex. Thus, all macros defined by the \pk{etex} package are -% made available (most notably, |\loccount|, |\globcountblk|, -% |\loccountblk| and alike). However, if a register of some kind has been -% locally allocated before this package is loaded, then the number of -% allocatable registers of this kind will not be extended to $65536$. To avoid -% this, load \pk{luatexbase-regs} earlier. -% -% The \plaintex and \latex formats define a new kind of resource: -% \emph{inserts} which are merely a family (count, dimen, skip, box) of -% registers with the same number. Inserts allocation begins at $255$ and goes -% toward $0$. Thus we can make room for more inserts by making allocation of -% count-, dimen-, skip- and box-registers start from $256$. With real \etex, -% it may be a bad idea since registers with index greater than $256$ have -% degraded performance due to implementation details, but with \luatex the -% performance is uniform, so we just do it. -% -% \section{Implementation} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 33 12 % ! - \y 36 3 % $ $ (in etex.sty) - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 42 12 % * (in etex.sty) - \y 43 12 % + (in etex.sty) - \y 44 12 % , (in etex.sty) - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < (in etex.sty) - \y 62 12 % > (in etex.sty) - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@regs@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-regs}[2011/05/24 v0.4 Registers allocation for LuaTeX] -% \end{macrocode} -% -% Make sure \luatex is used. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-regs}{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.} - \expandafter\luatexbase@regs@sty@endinput% -\fi -% \end{macrocode} -% -% \subsection{Ensure etex.sty is loaded} -% -% If running \latex, load \file{etex.sty}. If not, either -% \file{etex.src} was loaded at format generation time, or we cannot do -% anything. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax \else - \RequirePackage{etex}[1998/03/26] -\fi -% \end{macrocode} -% -% To the best of my (mpg) knowledge, all Plain-based formats built with -% \etex-enabled engines in \texlive load \file{etex.src}. However, -% let's be careful and check that \file{etex.sty} or \file{etex.src} is -% loaded. -% -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname et@xins\endcsname\relax - \begingroup - \expandafter\ifx\csname PackageWarningNoLine\endcsname\relax - \def\x#1#2{\begingroup\newlinechar10 - \immediate\write16{Package #1 warning: #2}\endgroup} - \else - \let\x\PackageWarningNoLine - \fi - \expandafter\endgroup - \x{luatexbase-regs}{etex macros not loaded!^^J% - Registers allocation scheme will not be extended.} -\else -% \end{macrocode} -% -% \subsection{Adapt range} -% -% First, increase the upper bound for all kinds of registers. Copy code to -% avoid defining a macro. -% -% \begin{macrocode} - \ifnum\count270=32768 \count270=65536 \fi - \ifnum\count271=32768 \count271=65536 \fi - \ifnum\count272=32768 \count272=65536 \fi - \ifnum\count273=32768 \count272=65536 \fi - \ifnum\count273=32768 \count273=65536 \fi - \ifnum\count274=32768 \count274=65536 \fi - \ifnum\count275=32768 \count275=65536 \fi - \ifnum\count276=32768 \count276=65536 \fi -% \end{macrocode} -% -% \subsection{Patch macros that used \cs{mathchardef}} -% -% |\box| registers and |\mark|s were previously defined -% using |\mathchardef| since it had the biggest range under \etex -% (15-bit number). However, this is not enough for \luatex's extended -% registers. Fortunately, |\chardef|'s range is extended, and now large -% enough, so use it everywhere instead of |\mathchardef|. Do this -% inside a group and use |\toks0| to store the list of actions. -% -% \begin{macrocode} - \begingroup \toks0{} - \def\@namedef #1{\expandafter \def\csname#1\endcsname} - \def\@outerdef#1{\expandafter\outer\expandafter\def\csname#1\endcsname} -% \end{macrocode} -% -% Notice that the auxiliary macros will automatically expand to the desired -% level when necessary, see below. -% -% First, here are the definitions from \file{etex.src}, in a form adapted -% to our needs. -% -% \begin{macrocode} - \def\def@globbox #1#2{\@outerdef{#1}{\et@xglob 4 \box #2}} - \def\def@locbox #1#2{\@namedef {#1}{\et@xloc 4 \box #2}} - \def\def@globmarks #1#2{\@outerdef{#1}{\et@xglob 6 \marks #2}} - \def\def@locmarks #1#2{\@namedef {#1}{\et@xloc 6 \marks #2}} - \def\def@et@xgblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk ##1##2{##4}% - {\allocationnumber=\count 26##1 - \global \advance \count 26##1 by ##4% - \global #2##3=\allocationnumber - \wlog {\string ##3=\string ##2blk{\number ##4} - at \the \allocationnumber}% - }% - }} - \def\def@et@xlblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk ##1##2{##4}% - {\advance \count 27##1 by -##4% - \allocationnumber=\count 27##1 - #2##3=\allocationnumber - \wlog {\string ##3=\string ##2blk{\number ##4} - at \the \allocationnumber \space (local)% - }% - }% - }} -% \end{macrocode} -% -% Then, the definitions from \file{etex.sty} since they are subtly -% different (|\outer| status, but also optional spaces or |=| -% signs). -% -% \begin{macrocode} - \def\alt@globbox #1#2{\@namedef{#1}{\et@xglob 4\box #2}} - \def\alt@locbox #1#2{\@namedef{#1}{\et@xloc 4\box #2}} - \def\alt@globmarks #1#2{\@namedef{#1}{\et@xglob 6\marks #2}} - \def\alt@locmarks #1#2{\@namedef{#1}{\et@xloc 6\marks #2}} - \def\alt@et@xgblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk##1##2{##4}% - {\allocationnumber\count26##1% - \global\advance\count26##1by##4% - \global#2##3\allocationnumber - \wlog{\string##3=\string##2blk{\number##4} at - \the\allocationnumber}% - }% - }} - \def\alt@et@xlblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk##1##2{##4}% - {\advance\count27##1-##4% - \allocationnumber\count27##1% - #2##3\allocationnumber - \et@xwlog{\string##3=\string##2blk{\number##4} at - \the\allocationnumber\space(local)}% - }% - }} -% \end{macrocode} -% -% Now, a macro checking the definitions, and making the appropriate -% re-definition. -% -% \begin{macrocode} - \def\check@def#1{% - \csname def@#1\endcsname{test@#1}\mathchardef - \expandafter\ifx\csname test@#1\expandafter\endcsname - \csname #1\endcsname - \expandafter\let\csname #1\endcsname\relax - \toks0\expandafter{\the\toks0\csname def@#1\endcsname{#1}\chardef} - \else - \csname alt@#1\endcsname{test@#1}\mathchardef - \expandafter\ifx\csname test@#1\expandafter\endcsname - \csname #1\endcsname - \toks0\expandafter{\the\toks0\csname alt@#1\endcsname{#1}\chardef} - \else - \expandafter\show\csname BAD#1\endcsname - \fi - \fi} -% \end{macrocode} -% -% Now, actually do it. -% -% \begin{macrocode} - \check@def{globbox} - \check@def{locbox} - \check@def{globmarks} - \check@def{locmarks} - \check@def{et@xgblk} - \check@def{et@xlblk} - \expandafter \endgroup - \the\toks0 -% \end{macrocode} -% -% \subsection{Make room for inserts} -% -% Finally, make allocation of |\count|, |\dimen|, |skip| and -% |\box| start with numbers $>255$, in order to free the lower numbers -% for insertions. Be careful with |\new...| macros which are -% |\outer| in Plain, since we're in the middle of an |\if| test. -% -% \begin{macrocode} - \expandafter\let\csname newcount\endcsname\globcount - \expandafter\let\csname newdimen\endcsname\globdimen - \expandafter\let\csname newskip\endcsname\globskip - \expandafter\let\csname newbox\endcsname\globbox -\fi -% \end{macrocode} -% -% That's all folks! -% -% \begin{macrocode} -\luatexbase@regs@sty@endinput% -%</texpackage> -% \end{macrocode} -% -% \section{Test files} -% -% Here we test only the two main formats: \plaintex (with \file{etex.src} -% loaded) and \latex, both with the \luatex engine. Those correspond to -% the \cmdname{luatex} and \cmdname{lualatex} commands in \texlive. -% -% We want to make sure we can globally and locally allocate $30000$ -% registers of each kind, and still globally allocate $100$ |\insert|s. -% Next we globally allocate a bloc of $3000$ registers of each kind, and -% locally a block of $1000$. (Those numbers are not optimal, but they -% should be enough for testing purposes.) -% -% \begin{macrocode} -%<testplain>\input luatexbase-regs.sty -%<testlatex>\RequirePackage{luatexbase-regs} -%<*testplain,testlatex> -\def\checkregister#1{% - \edef\newregister{\expandafter\noexpand\csname new#1\endcsname}% - \edef\locregister{\expandafter\noexpand\csname loc#1\endcsname}% - \count0 1 - \loop - \newregister\dummy - \locregister\dummy - \ifnum\count0<30000 - \advance\count0 1 - \repeat} -\checkregister{count} -\checkregister{dimen} -\checkregister{skip} -\checkregister{muskip} -\checkregister{box} -\checkregister{toks} -\checkregister{marks} - -\count0 1 -\loop \ifnum\count0<100 - \csname newinsert\endcsname\dummy - \advance\count0 1 -\repeat - -\globcountblk \dummy{3000} -\globdimenblk \dummy{3000} -\globskipblk \dummy{3000} -\globmuskipblk\dummy{3000} -\globboxblk \dummy{3000} -\globtoksblk \dummy{3000} -\globmarksblk \dummy{3000} - -\loccountblk \dummy{1000} -\locdimenblk \dummy{1000} -\locskipblk \dummy{1000} -\locmuskipblk \dummy{1000} -\locboxblk \dummy{1000} -\loctoksblk \dummy{1000} -\locmarksblk \dummy{1000} -%</testplain,testlatex> -%<testplain>\bye -%<testlatex>\stop -% \end{macrocode} -% -% -% \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase.dtx b/Master/texmf-dist/source/luatex/luatexbase/luatexbase.dtx index f0ba25d76d5..cf894672d23 100644 --- a/Master/texmf-dist/source/luatex/luatexbase/luatexbase.dtx +++ b/Master/texmf-dist/source/luatex/luatexbase/luatexbase.dtx @@ -1,304 +1,787 @@ % \iffalse meta-comment % -% Copyright 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu> -% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> -% -% This work is under the CC0 license. -% -% This work consists of the main source file luatexbase.dtx -% and the derived files -% luatexbase.sty -% -% Unpacking: -% tex luatexbase.dtx -% Documentation: -% pdflatex luatexbase.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex - -\keepsilent -\askforoverwritefalse - -\preamble - -See the aforementioned source file(s) for copyright and licensing information. - -\endpreamble - -\generate{% - \usedir{tex/luatex/luatexbase}% - \file{luatexbase.sty}{\from{luatexbase.dtx}{texpackage}}% -} - -\generate{% - \usedir{doc/luatex/luatexbase}% - \file{test-base-plain.tex}{\from{luatexbase.dtx}{testplain}}% - \file{test-base-latex.tex}{\from{luatexbase.dtx}{testlatex}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* luatexbase.sty} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> +% Copyright (C) 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu> +% Copyright (C) 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> +% Copyright (C) 2015 David Carlisle and Joseph Wright +% +% It may be distributed and/or modified under the conditions of +% the LaTeX Project Public License (LPPL), either version 1.3c of +% this license or (at your option) any later version. The latest +% version of this license is in the file: +% +% http://www.latex-project.org/lppl.txt +% +%<emu>\ifx\BeginCatcodeRegime\undefined\else\expandafter\endinput\fi +%<tex,sty> +%<tex,sty>\ifx +%<sty> \ProvidesPackage\undefined\begingroup\def\ProvidesPackage +%<tex> \ProvidesFile\undefined\begingroup\def\ProvidesFile +%<tex,sty> #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} +%<tex,sty>\fi +%<emu>\ProvidesPackage{luatexbase} +%<emu-cmp>\ProvidesPackage{luatexbase-compat} +%<emu-mod>\ProvidesPackage{luatexbase-modutils} +%<emu-loa>\ProvidesPackage{luatexbase-loader} +%<emu-reg>\ProvidesPackage{luatexbase-regs} +%<emu-att>\ProvidesPackage{luatexbase-attr} +%<emu-cct>\ProvidesPackage{luatexbase-cctb} +%<emu-mcb>\ProvidesPackage{luatexbase-mcb} +%<*driver> +\ProvidesFile{luatexbase.dtx} +%</driver> +%<*tex,sty> +[2015/10/01 v1.0 +%</tex,sty> +%<emu> luatexbase interface to LuaTeX +%<emu-cmp> luatexbase interface to LuaTeX (legacy subpackage) +%<emu-mod> luatexbase interface to LuaTeX (legacy subpackage) +%<emu-loa> luatexbase interface to LuaTeX (legacy subpackage) +%<emu-reg> luatexbase interface to LuaTeX (legacy subpackage) +%<emu-att> luatexbase interface to LuaTeX (legacy subpackage) +%<emu-cct> luatexbase interface to LuaTeX (legacy subpackage) +%<emu-mcb> luatexbase interface to LuaTeX (legacy subpackage) +%<*tex,sty> +] +%</tex,sty> %<*driver> \documentclass{ltxdoc} -\input{lltxb-dtxstyle} -\luatexbasetrue -\newcommand\subpk[1]{% - \item[\href{luatexbase-#1.pdf}{luatexbase-#1}\normalfont:]} +\GetFileInfo{luatexbase.dtx} \begin{document} - \DocInput{luatexbase.dtx}% +\title{\filename\\(Lua\TeX{}-specific support, luatexbase interface)} +\author{David Carlisle and Joseph Wright\footnote{Significant portions + of the code here are adapted/simplified from the packages \textsf{luatex} and + \textsf{luatexbase} written by Heiko Oberdiek, \'{E}lie Roux, + Manuel P\'{e}gouri\'{e}-Gonnar and Philipp Gesang.}} +\date{\filedate} +\maketitle +\setcounter{tocdepth}{2} +\tableofcontents +\DocInput{\filename} \end{document} %</driver> % \fi % -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \pkdate{luatexbase}{v0.6 2013-05-11} -% -% \maketitle -% -% \begin{abstract} -% This package provides resource management for the LuaTeX macro programmer. -% It is divided in sub-packages which can be used independantly if desired. -% \end{abstract} -% -% \tableofcontents -% -% \section{Documentation} -% -% The \pk{luatexbase} package consists of the following sub-packages: -% \begin{description} -% \subpk{compat} compatibility helpers for \verb+\directlua+, primitive -% names and version information from Lua. -% \subpk{loader} extension of \luatex's Lua module loader (since version -% 0.60.0, this is more of a compatibility layer for older versions than a -% real extension). -% \subpk{regs} extented allocation scheme for registers and the like, -% \emph{\`a la} \pk{etex}. -% \subpk{cctb} catcode table allocation. -% \subpk{attr} attribute and whatsit node allocation. -% \subpk{mcb} callbacks extensions allowing to register many functions in a -% single callback, and declare new callbacks for packages. -% \subpk{modutils} Lua module declaration, including version checks. -% \end{description} -% -% This package collection is considered stable: no backward-incompatible -% change should happen in the future, except the removal of the deprecated -% commands (currently only \cs{setcatcoderange}). It works with the Plain and -% \latex formats adapted for \luatex as provided by \texlive and MiK\tex. -% Currently the oldest version supported is 0.40.6 with formats from -% \texlive 2009 and greater. -% -% \subsection{History} -% -% The first package for managing \luatex's new resources was the \pk{luatex} -% package by Heiko Oberdiek. Later, \'Elie Roux wrote \pk{luatextra} which -% reprised many features of \pk{luatex} with little extensions to some of them -% and added independant low-level features (currently found in the -% \pk{modutils} and \pk{mcb} subpackages), as well as user-level things. -% Later, \pk{luatexbase} was created by Manuel P\'egouri\'e-Gonnard by isolating -% the general low-level features of \pk{luatextra}, and later expanding on -% them. -% -% For some time there was two conflicting packages controling access to -% \luatex's resources: \pk{luatex} and \pk{luatexbase}, neither of which was a -% subset of the other, and with small differences in their overlapping parts -% (mainly macro names). -% -% Then \pk{luatexbase} was expanded by absorbing the features of \pk{luatex} -% that were previously missing (essentially the advanced scheme for catcode -% table management). It currently provides the \pk{luatex} package as a -% wrapper around the relevant subpackages, so that the two are no longer in -% conflict. -% -% \medskip -% -% For a detailled history of changes in \pk{luatexbase} since its split from -% \pk{luatextra}, see the \file{Changes} file in the distribution. For even -% more details, see the git history. -% -% \section{Implementation} -% -% \begin{macrocode} -%<*texpackage> -% \end{macrocode} -% -% \subsection{Preliminaries} -% -% Catcode defenses and reload protection. -% -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@sty@endinput\endcsname% -% \end{macrocode} -% -% Package declaration. -% -% \begin{macrocode} -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} +% \section{Overview} +% +% Lua\TeX{} adds a number of engine-specific functions to \TeX{}. Support +% for those is now available for this area in the \LaTeX{} kernel and as +% an equivalent stand-alone file |ltluatex.tex| for plain users. The +% functionality there is derived from the earlier \textsf{luatex} +% and \textsf{luatexbase} packages by Heiko Oberdiek, \'{E}lie Roux, +% Manuel P\'{e}gouri\'{e}-Gonnar and Philipp Gesang. However, the +% interfaces are not all identical. +% +% The interfaces defined in this package are closely modelled on the original +% \textsf{luatexbase} package, and provide a compatibility layer between +% the new kernel-level support and existing code using \textsf{luatexbase}. +% +% \section{The \textsf{luatexbase} package interface} +% +% \subsection +% [Catcode tables] +% {Catcode tables\footnote{This +% interface was previously defined in the \textsf{luatexbase-cctbl} +% sub-package.}} +% +% \subsubsection{\TeX} +% +% +% \noindent +% \DescribeMacro{\CatcodeTableIniTeX} +% \DescribeMacro{\CatcodeTableString} +% \DescribeMacro{\CatcodeTableLaTeX} +% \DescribeMacro{\CatcodeTableLaTeXAtLetter} +% \DescribeMacro{\CatcodeTableOther} +% \DescribeMacro{\CatcodeTableExpl} +% \TeX\ access to predefined catcode tables. +% +% The first four tables are aliases giving alternative names for some +% catcodetables that are defined in the \textsf{ltluatex} core. +% +% |\CatcodeTableOther| is like |\CatcodeTableString| except that +% the catcode of space is $12$ (other). +% +% |\CatcodeTableExpl| is similar to the environment set by the +% \textsf{expl3} command |\ExplSyntaxOn| note that this only affects +% catcode settings, not for example |\endlinechar|. +% +% One difference between this implementation and the tables defined +% in the earlier \textsf{luatexbase} package is that these tables are +% defined to match the settings used by \LaTeX\ over the full Unicode +% range (as set in the file \textsf{unicode-letters.def}). +% +% \noindent +% \DescribeMacro{\SetCatcodeRange} +% An alias for |\@setrangecatcode| which is defined in the +% \textsf{ctablestack} package imported into this version of +% \textsf{luatexbase}. (The order of arguments is the +% same despite the variation in the naming). This is useful for +% setting up a new catcode table and assigns a given catcode to a +% range of characters. +% +% \noindent +% \DescribeMacro{\BeginCatcodeRegime} +% \DescribeMacro{\EndCatcodeRegime} +% A simple wrapper around |\@pushcatcodetable| providing a slightly +% different interface. The usage is:\\% +% \verb|\BeginCatcodeRegime|\meta{catcode table}\\ +% \verb| |\meta{code}\\ +% \verb|\EndCatcodeRegime| +% +% \noindent +% \DescribeMacro{\PushCatcodeTableNumStack} +% \DescribeMacro{\PopCatcodeTableNumStack} +% These are defined to be aliases for |\@pushcatcodetable| and +% |\@popcatcodetable| although the actual implementation is quite different +% to the older packages, the use of the commands should match. +% +% \noindent +% \DescribeMacro{\newluatexcatcodetable} +% \DescribeMacro{\setluatexcatcodetable} +% Aliases for the \textsf{ltluatex} functions +% dropping |luatex| from the name to match the convention of not +% using |luatex|-prefixed names for the Lua\TeX\ primitives. +% +% \subsubsection{Lua} +% +% The standard way to access catcode table numbers from Lua in +% \textsf{ltluatex} is the |registernumber| function. This +% package provides a |catcodetables| table with a metatable +% that accesses this function and is extended with aliases for the +% predefined tables so you can use |catcodetables.expl| as an +% alternative to |catcodetables.CatcodeTableExpl|, both being +% equivalent to\\ +% |registernumber('CatcodeTableExpl')|. +% +% +% \subsection +% [Lua Callbacks] +% {Lua Callbacks\footnote{This +% interface was previously defined in the \textsf{luatexbase-mcb} +% sub-package.}} +% +% The |luatexbase| table is extended with some additional Lua +% functions to provide the interfaces provided by the previous +% implementation. +% +% +% \noindent +% \DescribeMacro{priority\_in\_callback}\meta{name}\meta{description}\\% +% As in the earlier interfaces the function +% is provided to return a number indicating the position of a +% specified function in a callback list. However it is usually used +% just as a boolean test that the function is registered with the +% callback. Kernel-level support does not directly expose the priority numbers, +% however the function here is defined to return the number of the specified +% function in the list returned by |luatexbase.callback_descriptions|. +% +% +% \noindent +% \DescribeMacro{is\_active\_callback}\meta{name}\meta{description}\\% +% This boolean function was defined in the development sources +% of the previous implementation. Here it is defined as an alias for +% the function |in_callback| provided by \textsf{ltluatex}. +% Given a callback and a description string, it returns true if a +% callback function with that description is currently registered. +% +% \noindent +% \DescribeMacro{reset\_callback}\meta{name}\meta{make\_false}\\ +% This function unregisters all functions registered for the callback +% \meta{name}. If \meta{make\_false} is true, the callback is then set +% to false (rather than nil). Unlike the earlier implementation +% This version does call |remove_from_callback| on each function in +% the callback list for \meta{name}, and each removal will be recorded +% in the log. +% +% \noindent +% \DescribeMacro{remove\_from\_callback}\meta{name}\meta{description}\\% +% This function is unchanged from the kernel-level implementation. +% It is backward compatible with the previous \textsf{luatexbase} +% package but enhanced as it returns the removed callback and its +% description. +% Together with the |callback_descriptions| function this allows much +% finer control over the order of functions in a callback list as the +% functions can be removed then re-added to the list in any desired order. +% +% \noindent +% \DescribeMacro{add\_to\_callback}\meta{name}\meta{function}\meta{description}\meta{priority}\\% +% This function is mostly unchanged from the kernel-level +% implementation, which does not have the fourth \meta{priority} +% argument. The priority argument is ignored except for one case: +% If multiple callbacks are registered to a callback of type +% \textsf{exclusive} then \textsf{ltluatex} raises an error, but +% here it is allowed if \texttt{priority} is $1$, in which case the +% \verb|reset_callback| is first called to remove the existing +% callback. This makes the use more comatible with the ``first'' +% callbacktype implemented in the original \textsf{luatexbase}, which +% executed (only) the first fuction in a callback list. +% +% As noted above +% the kernel code offers more explicit control over the order of +% functions in a callback list when required. +% +% \noindent +% \DescribeMacro{create\_callback}\meta{name}\meta{type}\meta{default}\\% +% This function is unchanged from kernel-level +% implementation, the only change is a change of terminology for the +% types of callback, the type |first| is now classified as |exclusive| +% and the kernel code raises an error if multiple callback functions +% are registered. The previous \textsf{luatexbase} implementation +% allowed multiple functions to be registered, but only activated the +% first in the list. +% +% \subsection +% [Module declaration] +% {Module declaration\footnote{This +% interface was previously defined in the \textsf{luatexbase-modutils} +% sub-package.}} +% +% \subsubsection{\TeX} +% +% \noindent +% \DescribeMacro{\RequireLuaModule}\meta{file}\oarg{info}\\ +% This command is provided as a wrapper around +% |\directlua{require(|\meta{file}|}|, and executes the Lua code in +% the specified file. +% The optional argument is accepted but ignored. +% +% Current versions of Lua\TeX\ all use the |kpse| \TeX\ path searching +% library with the |require| function, so the more complicated +% definition used in earlier implementations is no +% longer needed. +% +% \subsubsection{Lua} +% +% \noindent +% \DescribeMacro{provides\_module}\meta{info}\\ +% The \textsf{luatexbase} version of |provides_module| returns a list of log +% and error functions so that it is usually called as:\\ +% |local err, warning, info, log = luatexbase.provides_module({name=..| +% +% The returned functions are all instances of the functions provided by +% the kernel: |module_error|, +% |module_warning| and |module_info|. +% +% \DescribeMacro{errwarinf}\meta{name}\\ +% Returns four error and warning functions associated with \meta{name} +% mostly a helper function for \verb|provides\_module|, but can be called +% separately. +% +% \subsection +% [Lua Attributes] +% {Lua Attributes and Whatsits\footnote{This +% interface was previously defined in the \textsf{luatexbase-attr} +% sub-package.}} +% +% +% \subsubsection{\TeX} +% +% \noindent +% \DescribeMacro{\newluatexattribute} +% \DescribeMacro{\setluatexattribute} +% \DescribeMacro{\unsetluatexattribute} +% As for catcode tables, aliases for the attribute allocation functions are +% provided with |luatex| in the names. +% +% +% \subsubsection{Lua} +% The lua code in this section is concerned with an experimental +% whatsit handling suite of functions in the original package. +% This is not fully documented here and is guraded by the +% \textsf{docstrip} guard \verb|whatsit| so it may optionally be +% included or excluded from the sources when the package is built. +% +% \subsection{Prefixed names for lua\TeX\ primitives} +% \noindent +% \DescribeMacro{\luatexattributedef} +% \DescribeMacro{\luatexcatcodetable} +% \DescribeMacro{\luatexluaescapestring} +% \DescribeMacro{\luatexlatelua} +% \DescribeMacro{\luatexoutputbox} +% \DescribeMacro{\luatexscantextokens} +% Aliases for commonly ued lua\TeX\ primitives that existing packages +% using \textsf{luatexbase} use with prefixed names. +% +% If additional primtives are required it is recommended that the +% code is updated to use unprefixed names. To ensure that the code +% works with the original \textsf{luatexbase} package on older formats +% you may use the lua function \texttt{tex.enableprimitives} to enable +% some or all primitives to be available with unprefixed names. +% +% \StopEventually{} +% +% \section{Implementation} +% +% \subsection{\textsf{luatexbase} interface} +% +% \begin{macrocode} +%<*emu> +\edef\emuatcatcode{\the\catcode`\@} +\catcode`\@=11 +% \end{macrocode} +% +% Load |ctablestack|. +% \begin{macrocode} +\ifx\@setrangecatcode\@undefined + \ifx\RequirePackage\@undefined + \input{ctablestack.sty}% \else - \let\x\ProvidesPackage + \RequirePackage{ctablestack} \fi -\expandafter\endgroup -\x{luatexbase}[2013/05/11 v0.6 Resource management for the LuaTeX macro programmer] +\fi % \end{macrocode} % -% Make sure \luatex is used. +% Simple require wrapper as we now assume |require| implicitly uses the +% |kpathsea| search library. +% \begin{macrocode} +\def\RequireLuaModule#1{\directlua{require("#1")}\@gobbleoptarg} +% \end{macrocode} % +% In \LaTeX\ (or plain macro package that has defined |\@ifnextchar|) +% use |\@ifnextchar| otherwise use a simple alternative, in practice this +% will never be followed by a brace group, so full version of |\@ifnextchar| +% not needed. % \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty +\ifdefined\@ifnextchar +\def\@gobbleoptarg{\@ifnextchar[\@gobble@optarg{}}% \else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase}{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.} - \expandafter\luatexbase@sty@endinput% +\long\def\@gobbleoptarg#1{\ifx[#1\expandafter\@gobble@optarg\fi#1}% \fi % \end{macrocode} % -% %\subsection{luatex.sty compatibility} +% \begin{macrocode} +\def\@gobble@optarg[#1]{} +% \end{macrocode} +% +% Extended catcode table support. Use the names from the previous +% \textsf{luatexbase} and \textsf{luatex} packages. +% \begin{macrocode} +\let\CatcodeTableIniTeX\catcodetable@initex +\let\CatcodeTableString\catcodetable@string +\let\CatcodeTableLaTeX\catcodetable@latex +\let\CatcodeTableLaTeXAtLetter\catcodetable@atletter +% \end{macrocode} % -% Currently, |luatex.sty| has to be loaded before luatexbase, otherwise it -% raises an error, as the same names are used between luatexbase and luatex. +% Additional tables declared in the previous interface. +% \begin{macrocode} +\newcatcodetable\CatcodeTableOther +\@setcatcodetable\CatcodeTableOther{% + \catcodetable\CatcodeTableString + \catcode32 12 } +% \end{macrocode} % -% This is a quite strange situation, but we hope to clarify it. +% \begin{macrocode} +\newcatcodetable\CatcodeTableExpl +\@setcatcodetable\CatcodeTableExpl{% + \catcodetable\CatcodeTableLaTeX + \catcode126 10 % tilde is a space char + \catcode32 9 % space is ignored + \catcode9 9 % tab also ignored + \catcode95 11 % underscore letter + \catcode58 11 % colon letter +} +% \end{macrocode} % +% Top level access to catcodetable stack. % \begin{macrocode} -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatex.sty -\else - \RequirePackage{luatex} +\def\BeginCatcodeRegime#1{% + \@pushcatcodetable + \catcodetable#1\relax} +% \end{macrocode} +% +% \begin{macrocode} +\def\EndCatcodeRegime{% + \@popcatcodetable} +% \end{macrocode} +% +% The implementation of the stack is completely +% different, but usage should match. +% \begin{macrocode} +\let\PushCatcodeTableNumStack\@pushcatcodetable +\let\PopCatcodeTableNumStack\@popcatcodetable +% \end{macrocode} +% +% A simple copy. +% \begin{macrocode} +\let\SetCatcodeRange\@setrangecatcode +% \end{macrocode} +% +% Another copy. +% \begin{macrocode} +\let\setcatcodetable\@setcatcodetable +% \end{macrocode} +% +% \subsubsection{Additional lua code} +% \begin{macrocode} +\directlua{ +% \end{macrocode} +% +% Remove all registered callbacks, then disable. +% Set to false if optional second argument is |true|. +% \begin{macrocode} +function luatexbase.reset_callback(name,make_false) + for _,v in pairs(luatexbase.callback_descriptions(name)) + do + luatexbase.remove_from_callback(name,v) + end + if make_false == true then + luatexbase.disable_callback(name) + end +end +% \end{macrocode} +% +% Allow exclusive callbacks to be over-written if priority argument is +% 1 to match the ``first'' semantics of the original package. +% \begin{macrocode} +luatexbase.base_add_to_callback=luatexbase.add_to_callback +function luatexbase.add_to_callback(name,fun,description,priority) +if(luatexbase.callbacktypes[name] == 3 and + priority == 1 and + \string#luatexbase.callback_descriptions(name)==1) then + luatexbase.module_warning("luatexbase", + "resetting exclusive callback: " .. name) + luatexbase.reset_callback(name) +end +return + luatexbase.base_add_to_callback(name,fun,description) +end +% \end{macrocode} +% +% Emulate the catcodetables table. +% Explicitly fill the table rather than rely on the metatable call to +% |registernumber| as that is unreliable on old Lua\TeX{}. +% \begin{macrocode} +luatexbase.catcodetables=setmetatable( + {['latex-package'] = \number\CatcodeTableLaTeXAtLetter, + ini = \number\CatcodeTableIniTeX, + string = \number\CatcodeTableString, + other = \number\CatcodeTableOther, + latex = \number\CatcodeTableLaTeX, + expl = \number\CatcodeTableExpl, + expl3 = \number\CatcodeTableExpl}, + { __index = function(t,key) + return luatexbase.registernumber(key) or nil + end} +)} +% \end{macrocode} +% +% On old Lua\TeX{} workaround hashtable issues. +% Allocate in \TeX{}, and also directly add to |luatexbase.catcodetables|. +% \begin{macrocode} +\ifnum\luatexversion<80 % +\def\newcatcodetable#1{% + \e@alloc\catcodetable\chardef + \e@alloc@ccodetable@count\m@ne{"8000}#1% + \initcatcodetable\allocationnumber + {\escapechar=\m@ne + \directlua{luatexbase.catcodetables['\string#1']=% + \the\allocationnumber}}% +} \fi % \end{macrocode} % -% \subsection{Packages loading} +% \begin{macrocode} +\directlua{ +% \end{macrocode} % +% |priority_in_callback| returns position in the callback list. +% Not provided by default by the kernel as usually it is just used +% as a boolean test, for which |in_callback| is provided. % \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-compat.sty - \input luatexbase-modutils.sty - \input luatexbase-loader.sty - \input luatexbase-regs.sty - \input luatexbase-attr.sty - \input luatexbase-cctb.sty - \input luatexbase-mcb.sty -\else - \RequirePackage{luatexbase-compat} - \RequirePackage{luatexbase-modutils} - \RequirePackage{luatexbase-loader} - \RequirePackage{luatexbase-regs} - \RequirePackage{luatexbase-attr} - \RequirePackage{luatexbase-cctb} - \RequirePackage{luatexbase-mcb} +function luatexbase.priority_in_callback (name,description) + for i,v in ipairs(luatexbase.callback_descriptions(name)) + do + if v == description then + return i + end + end + return false +end +% \end{macrocode} +% +% The (unreleased) version~0.7 of \textsf{luatexbase} provided this +% boolean test under a different name, so we provide an alias here. +% \begin{macrocode} +luatexbase.is_active_callback = luatexbase.in_callback +% \end{macrocode} +% +% \textsf{ltluatex} implementation of |provides_module| does not return +% print functions so define modified version here. +% \begin{macrocode} +luatexbase.base_provides_module=luatexbase.provides_module +function luatexbase.errwarinf(name) + return + function(s) return luatexbase.module_error(name, s) end, + function(s) return luatexbase.module_warning(name, s) end, + function(s) return luatexbase.module_info(name, s) end, + function(s) return luatexbase.module_info(name, s) end +end +function luatexbase.provides_module(info) + luatexbase.base_provides_module(info) + return luatexbase.errwarinf(info.name) +end +} +% \end{macrocode} +% +% Same for attribute table as catcode tables. In old Lua\TeX{}, add to the +% |luatexbase.attributes| table directly. +% \begin{macrocode} +\ifnum\luatexversion<80 % +\def\newattribute#1{% + \e@alloc\attribute\attributedef + \e@alloc@attribute@count\m@ne\e@alloc@top#1% + {\escapechar=\m@ne + \directlua{luatexbase.attributes['\string#1']=% + \the\allocationnumber}}% +} \fi % \end{macrocode} % -% This is the end, my friend\dots the end. +% Define a safe percent command for plain \TeX. +% \begin{macrocode} +\ifx\@percentchar\@undefined + {\catcode`\%=12 \gdef\@percentchar{%}} +\fi +% \end{macrocode} +% +% \begin{macrocode} +%<*whatsit> +\directlua{% +% \end{macrocode} + % % \begin{macrocode} -\luatexbase@sty@endinput% -%</texpackage> +local user_whatsits = { __unassociated = { } } +local whatsit_ids = { } +local anonymous_whatsits = 0 +local anonymous_prefix = "anon" % \end{macrocode} % -% \section{Test file} +% User whatsit allocation is split into two functions: +% \verb|new_user_whatsit_id| registers a new id (an integer) +% and returns it. This is a wrapper around \verb|new_whatsit| +% but with the extra \texttt{package} argument, and recording +% the mapping in lua tables % -% Very minimal, just check that the package correctly loads. +% If no name given, generate a name from a counter. % % \begin{macrocode} -%<testplain>\input luatexbase.sty -%<testlatex>\RequirePackage{luatexbase} -%<testplain>\bye -%<testlatex>\stop +local new_user_whatsit_id = function (name, package) + if name then + if not package then + package = unassociated + end + else % anonymous + anonymous_whatsits = anonymous_whatsits + 1 + warning("defining anonymous user whatsit no. \@percentchar + d", anonymous_whatsits) + package = unassociated + name = anonymous_prefix .. tostring(anonymous_whatsits) + end + + local whatsitdata = user_whatsits[package] + if not whatsitdata then + whatsitdata = { } + user_whatsits[package] = whatsitdata + end + + local id = whatsitdata[name] + if id then %- warning + warning("replacing whatsit \@percentchar s:\@percentchar + s (\@percentchar d)", package, name, id) + else %- new id + id=luatexbase.new_whatsit(name) + whatsitdata[name] = id + whatsit_ids[id] = { name, package } + end + return id +end +luatexbase.new_user_whatsit_id = new_user_whatsit_id % \end{macrocode} % +% \verb|new_user_whatsit| first registers a new id and then also +% creates the corresponding whatsit node of subtype “user-defined”. +% Return a nullary function that delivers copies of the whatsit. +% +% Alternatively, the first argument can be a whatsit node that +% will then be used as prototype. +% +% \begin{macrocode} +local new_user_whatsit = function (req, package) + local id, whatsit + if type(req) == "string" then + id = new_user_whatsit_id(req, package) + whatsit = newnode(whatsit_t, user_defined_t) + whatsit.user_id = id + elseif req.id == whatsit_t and req.subtype == user_defined_t then + id = req.user_id + whatsit = copynode(req) + if not whatsit_ids[id] then + warning("whatsit id \@percentchar d unregistered; " + .. "inconsistencies may arise", id) + end + end + return function () return copynode(whatsit) end, id +end +luatexbase.new_user_whatsit = new_user_whatsit +% \end{macrocode} +% +% If one knows the name of a user whatsit, its corresponding id +% can be retrieved by means of \verb|get_user_whatsit_id|. +% +% \begin{macrocode} +local get_user_whatsit_id = function (name, package) + if not package then + package = unassociated + end + return user_whatsits[package][name] +end +luatexbase.get_user_whatsit_id = get_user_whatsit_id +% \end{macrocode} +% +% The inverse lookup is also possible via \verb|get_user_whatsit_name|. +% \begin{macrocode} +local get_user_whatsit_name = function (asked) + local id + if type(asked) == "number" then + id = asked + elseif type(asked) == "function" then + %- node generator + local n = asked() + id = n.user_id + else %- node + id = asked.user_id + end + local metadata = whatsit_ids[id] + if not metadata then % unknown + warning("whatsit id \@percentchar d unregistered; + inconsistencies may arise", id) + return "", "" + end + return tableunpack(metadata) +end +luatexbase.get_user_whatsit_name = get_user_whatsit_name +% \end{macrocode} +% A function that outputs the +% current allocation status to the terminal. +% +% \begin{macrocode} +local dump_registered_whatsits = function (asked_package) + local whatsit_list = { } + if asked_package then + local whatsitdata = user_whatsits[asked_package] + if not whatsitdata then + error("(no user whatsits registered for package + \@percentchar s)", asked_package) + return + end + texiowrite_nl("(user whatsit allocation stats for " .. + asked_package) + for name, id in next, whatsitdata do + whatsit_list[\string#whatsit_list+1] = + stringformat("(\@percentchar s:\@percentchar + s \@percentchar d)", asked_package, name, id) + end + else + texiowrite_nl("(user whatsit allocation stats") + texiowrite_nl(stringformat(" ((total \@percentchar d)\string\n + (anonymous \@percentchar d))", + current_whatsit, anonymous_whatsits)) + for package, whatsitdata in next, user_whatsits do + for name, id in next, whatsitdata do + whatsit_list[\string#whatsit_list+1] = + stringformat("(\@percentchar s:\@percentchar + s \@percentchar d)", package, name, id) + end + end + end + texiowrite_nl" (" + local first = true + for i=1, \string#whatsit_list do + if first then + first = false + else % indent + texiowrite_nl" " + end + texiowrite(whatsit_list[i]) + end + texiowrite"))\string\n" +end +luatexbase.dump_registered_whatsits = dump_registered_whatsits +% \end{macrocode} +% Lastly, we define a couple synonyms for convenience. +% \begin{macrocode} +luatexbase.newattribute = new_attribute +luatexbase.newuserwhatsit = new_user_whatsit +luatexbase.newuserwhatsitid = new_user_whatsit_id +luatexbase.getuserwhatsitid = get_user_whatsit_id +luatexbase.getuserwhatsitname = get_user_whatsit_name +luatexbase.dumpregisteredwhatsits = dump_registered_whatsits +% \end{macrocode} +% +% \begin{macrocode} +} +%</whatsit> +% \end{macrocode} +% +% Resolve name clashes and prefixed name issues. +% +% Top level \textsf{luatexbase} macros +% \begin{macrocode} +\let\newluatexattribute\newattribute +\let\setluatexattribute\setattribute +\let\unsetluatexattribute\unsetattribute +\let\newluatexcatcodetable\newcatcodetable +\let\setluatexcatcodetable\setcatcodetable +% \end{macrocode} +% +% Internal \textsf{luatexbase} macros +% \begin{macrocode} +\let\luatexbase@directlua\directlua +\let\luatexbase@ensure@primitive\@gobble +% \end{macrocode} +% +% Lua\TeX\ primitives +% \begin{macrocode} +\let\luatexattribute\attribute +\let\luatexattributedef\attributedef +\let\luatexcatcodetable\catcodetable +\let\luatexluaescapestring\luaescapestring +\let\luatexlatelua\latelua +\let\luatexoutputbox\outputbox +\let\luatexscantextokens\scantextokens +% \end{macrocode} +% +% Reset catcode of |@|. +% \begin{macrocode} +\catcode`\@=\emuatcatcode\relax +% \end{macrocode} +% +% \begin{macrocode} +%</emu> +% \end{macrocode} +% +% \subsection{Legacy \textsf{luatexbase} sub-packages} +% +% The original \textsf{luatexbase} was comprised of seven sub packages +% that could in principle be loaded separately. Here we define them all +% with the same code that just loads the main package, they are +% distinguished just by the |\ProvidesPackage| specified above at the start +% of the file. +% \begin{macrocode} +%<*emu-cmp,emu-mod,emu-loa,emu-reg,emu-att,emu-cct,emu-mcb> +% \end{macrocode} +% +% \begin{macrocode} +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% +\else + \RequirePackage{luatexbase} +\fi +% \end{macrocode} +% +% \begin{macrocode} +%</emu-cmp,emu-mod,emu-loa,emu-reg,emu-att,emu-cct,emu-mcb> +% \end{macrocode} % % \Finale -\endinput diff --git a/Master/texmf-dist/source/luatex/luatexbase/luatexbase.ins b/Master/texmf-dist/source/luatex/luatexbase/luatexbase.ins new file mode 100644 index 00000000000..5ebba2f69e4 --- /dev/null +++ b/Master/texmf-dist/source/luatex/luatexbase/luatexbase.ins @@ -0,0 +1,17 @@ +\input docstrip +\keepsilent +\nopreamble +\nopostamble + +\askforoverwritefalse + +\generate{\file{luatexbase.sty}{\from{luatexbase.dtx}{sty,emu,whatsit}}} +\generate{\file{luatexbase-compat.sty}{\from{luatexbase.dtx}{sty,emu-cmp}}} +\generate{\file{luatexbase-modutils.sty}{\from{luatexbase.dtx}{sty,emu-mod}}} +\generate{\file{luatexbase-loader.sty}{\from{luatexbase.dtx}{sty,emu-loa}}} +\generate{\file{luatexbase-regs.sty}{\from{luatexbase.dtx}{sty,emu-reg}}} +\generate{\file{luatexbase-attr.sty}{\from{luatexbase.dtx}{sty,emu-att}}} +\generate{\file{luatexbase-cctb.sty}{\from{luatexbase.dtx}{sty,emu-cct}}} +\generate{\file{luatexbase-mcb.sty}{\from{luatexbase.dtx}{sty,emu-mcb}}} + +\endbatchfile diff --git a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua deleted file mode 100644 index e86bbdedfda..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua +++ /dev/null @@ -1,223 +0,0 @@ --- --- This is file `attr.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-attr.dtx (with options: `luamodule') --- --- See the aforementioned source file(s) for copyright and licensing information. --- ---- locals -local copynode = node.copy -local newnode = node.new -local nodesubtype = node.subtype -local nodetype = node.id -local stringfind = string.find -local stringformat = string.format -local tableunpack = unpack or table.unpack -local texiowrite_nl = texio.write_nl -local texiowrite = texio.write ---- luatex internal types -local whatsit_t = nodetype"whatsit" -local user_defined_t = nodesubtype"user_defined" -local unassociated = "__unassociated" -luatexbase = luatexbase or { } -local luatexbase = luatexbase -local err, warning, info, log = luatexbase.provides_module({ - name = "luatexbase-attr", - version = 0.6, - date = "2013/05/11", - description = "Attributes allocation for LuaTeX", - author = "Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - copyright = "Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - license = "CC0", -}) -luatexbase.attributes = luatexbase.attributes or { } -local attributes = luatexbase.attributes -local new_attribute -local unset_attribute -local luatex_sty_counter = 'LuT@AllocAttribute' -if tex.count[luatex_sty_counter] then - if tex.count[luatex_sty_counter] > -1 then - error("luatexbase error: attribute 0 has already been set by \newattribute" - .."macro from luatex.sty, not belonging to this package, this makes" - .."luaotfload unusable. Please report to the maintainer of luatex.sty") - else - tex.count[luatex_sty_counter] = 0 - end -end -local last_alloc = 0 -function new_attribute(name, silent) - if last_alloc >= 65535 then - if silent then - return -1 - else - error("No room for a new \\attribute", 1) - end - end - local lsc = tex.count[luatex_sty_counter] - if lsc and lsc > last_alloc then - last_alloc = lsc - end - last_alloc = last_alloc + 1 - if lsc then - tex.setcount('global', luatex_sty_counter, last_alloc) - end - attributes[name] = last_alloc - unset_attribute(name) - if not silent then - log('luatexbase.attributes[%q] = %d', name, last_alloc) - end - return last_alloc -end -luatexbase.new_attribute = new_attribute -local unset_value = (luatexbase.luatexversion < 37) and -1 or -2147483647 -function unset_attribute(name) - tex.setattribute(attributes[name], unset_value) -end -luatexbase.unset_attribute = unset_attribute -luatexbase.get_unset_value = function () return unset_value end ---- cf. luatexref-t.pdf, sect. 8.1.4.25 -local user_whatsits = { --- (package, (name, id hash)) hash - __unassociated = { }, --- those without package name -} -local whatsit_ids = { } --- (id, (name * package)) hash -local whatsit_cap = 2^53 --- Lua numbers are doubles -local current_whatsit = 0 -local anonymous_whatsits = 0 -local anonymous_prefix = "anon" ---- string -> string -> int -local new_user_whatsit_id = function (name, package) - if name then - if not package then - package = unassociated - end - else -- anonymous - anonymous_whatsits = anonymous_whatsits + 1 - warning("defining anonymous user whatsit no. %d", anonymous_whatsits) - warning("dear package authors, please name your whatsits!") - package = unassociated - name = anonymous_prefix .. tostring(anonymous_whatsits) - end - - local whatsitdata = user_whatsits[package] - if not whatsitdata then - whatsitdata = { } - user_whatsits[package] = whatsitdata - end - - local id = whatsitdata[name] - if id then --- warning - warning("replacing whatsit %s:%s (%d)", package, name, id) - else --- new id - current_whatsit = current_whatsit + 1 - if current_whatsit >= whatsit_cap then - warning("maximum of %d integral user whatsit ids reached", - whatsit_cap) - warning("further whatsit allocation may be inconsistent") - end - id = current_whatsit - whatsitdata[name] = id - whatsit_ids[id] = { name, package } - end - log("new user-defined whatsit %d (%s:%s)", id, package, name) - return id -end -luatexbase.new_user_whatsit_id = new_user_whatsit_id ---- (string | node_t) -> string -> ((unit -> node_t) * int) -local new_user_whatsit = function (req, package) - local id, whatsit - if type(req) == "string" then - id = new_user_whatsit_id(req, package) - whatsit = newnode(whatsit_t, user_defined_t) - whatsit.user_id = id - elseif req.id == whatsit_t and req.subtype == user_defined_t then - id = req.user_id - whatsit = copynode(req) - if not whatsit_ids[id] then - warning("whatsit id %d unregistered; " - .. "inconsistencies may arise", id) - end - end - return function () return copynode(whatsit) end, id -end -luatexbase.new_user_whatsit = new_user_whatsit ---- string -> string -> int -local get_user_whatsit_id = function (name, package) - if not package then - package = unassociated - end - return user_whatsits[package][name] -end -luatexbase.get_user_whatsit_id = get_user_whatsit_id ---- int | fun | node -> (string, string) -local get_user_whatsit_name = function (asked) - local id - if type(asked) == "number" then - id = asked - elseif type(asked) == "function" then - --- node generator - local n = asked() - id = n.user_id - else --- node - id = asked.user_id - end - local metadata = whatsit_ids[id] - if not metadata then -- unknown - warning("whatsit id %d unregistered; inconsistencies may arise", id) - return "", "" - end - return tableunpack(metadata) -end -luatexbase.get_user_whatsit_name = get_user_whatsit_name ---- string -> unit -local dump_registered_whatsits = function (asked_package) - local whatsit_list = { } - if asked_package then - local whatsitdata = user_whatsits[asked_package] - if not whatsitdata then - error("(no user whatsits registered for package %s)", - asked_package) - return - end - texiowrite_nl("(user whatsit allocation stats for " .. asked_package) - for name, id in next, whatsitdata do - whatsit_list[#whatsit_list+1] = - stringformat("(%s:%s %d)", asked_package, name, id) - end - else - texiowrite_nl("(user whatsit allocation stats") - texiowrite_nl(stringformat(" ((total %d)\n (anonymous %d))", - current_whatsit, anonymous_whatsits)) - for package, whatsitdata in next, user_whatsits do - for name, id in next, whatsitdata do - whatsit_list[#whatsit_list+1] = - stringformat("(%s:%s %d)", package, name, id) - end - end - end - - texiowrite_nl" (" - --- in an attempt to be clever the texio.write* functions - --- mess up line breaking, so concatenation is unusable ... - local first = true - for i=1, #whatsit_list do - if first then - first = false - else -- indent - texiowrite_nl" " - end - texiowrite(whatsit_list[i]) - end - texiowrite"))\n" -end -luatexbase.dump_registered_whatsits = dump_registered_whatsits -luatexbase.newattribute = new_attribute -luatexbase.newuserwhatsit = new_user_whatsit -luatexbase.newuserwhatsitid = new_user_whatsit_id -luatexbase.getuserwhatsitid = get_user_whatsit_id -luatexbase.getuserwhatsitname = get_user_whatsit_name -luatexbase.dumpregisteredwhatsits = dump_registered_whatsits --- --- End of File `attr.lua'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/cctb.lua b/Master/texmf-dist/tex/luatex/luatexbase/cctb.lua deleted file mode 100644 index 86b7297a440..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexbase/cctb.lua +++ /dev/null @@ -1,41 +0,0 @@ --- --- This is file `cctb.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-cctb.dtx (with options: `luamodule') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -luatexbase = luatexbase or { } -local luatexbase = luatexbase -luatexbase.provides_module({ - name = "luatexbase-cctb", - version = 0.6, - date = "2013/05/11", - description = "Catcodetable allocation for LuaTeX", - author = "Heiko Oberdiek, Elie Roux and Manuel Pegourie-Gonnard", - copyright = "Heiko Oberdiek, Elie Roux and Manuel Pegourie-Gonnard", - license = "CC0", -}) -luatexbase.catcodetables = luatexbase.catcodetables or { } -local catcodetables = luatexbase.catcodetables -local function catcodetabledef_from_tex(name, number) - catcodetables[name] = tonumber(number) -end -luatexbase.catcodetabledef_from_tex = catcodetabledef_from_tex -local function catcodetable_do_shortcuts() - local cat = catcodetables - cat['latex'] = cat.CatcodeTableLaTeX - cat['latex-package'] = cat.CatcodeTableLaTeXAtLetter - cat['latex-atletter'] = cat.CatcodeTableLaTeXAtLetter - cat['ini'] = cat.CatcodeTableIniTeX - cat['expl3'] = cat.CatcodeTableExpl - cat['expl'] = cat.CatcodeTableExpl - cat['string'] = cat.CatcodeTableString - cat['other'] = cat.CatcodeTableOther -end -luatexbase.catcodetable_do_shortcuts = catcodetable_do_shortcuts --- --- End of File `cctb.lua'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty index be0e86947cd..ac46ebea69f 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty @@ -1,111 +1,14 @@ -%% -%% This is file `luatexbase-attr.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-attr.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 34 12 % " - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < - \y 62 12 % > - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@attr@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-attr}[2013/05/11 v0.6 Attributes allocation for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \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.} - \expandafter\luatexbase@attr@sty@endinput% + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} \fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-modutils.sty - \input luatex.sty +\ProvidesPackage{luatexbase-attr} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \RequirePackage{luatexbase-modutils} - \RequirePackage{luatex} + \RequirePackage{luatexbase} \fi -\luatexbase@ensure@primitive{luaescapestring} -\luatexbase@ensure@primitive{attributedef} -\luatexbase@ensure@primitive{attribute} -\luatexbase@directlua{require('luatexbase.attr')} -\def\newluatexattribute#1{% - \begingroup\escapechar\m@ne \expandafter\expandafter\expandafter - \endgroup \expandafter\expandafter\expandafter - \allocationnumber \luatexbase@directlua{tex.write( - luatexbase.new_attribute("\luatexluaescapestring{\string#1}", true))}% - \ifnum\allocationnumber>\m@ne - \global\luatexattributedef#1=\allocationnumber - \wlog{\string#1=\string\luatexattribute\the\allocationnumber}% - \else - \errmessage{No room for a new \string\attribute}% - \fi} -\newcount\lltxb@attr@unsetvalue -\lltxb@attr@unsetvalue=\ifnum\luatexversion<37 -1\else -2147483647\fi\relax -\def\unsetluatexattribute#1{% - #1\lltxb@attr@unsetvalue} -\def\setluatexattribute#1#2{% - #1=\numexpr#2\relax} -\luatexbase@attr@sty@endinput% -\endinput -%% -%% End of file `luatexbase-attr.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty index 69c45b25466..098c6442667 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty @@ -1,242 +1,14 @@ -%% -%% This is file `luatexbase-cctb.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-cctb.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < - \y 62 12 % > - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@cctb@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-cctb}[2013/05/11 v0.6 Catcodetable allocation for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} +\fi +\ProvidesPackage{luatexbase-cctb} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \RequirePackage{ifluatex} + \RequirePackage{luatexbase} \fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-cctb}{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.} - \expandafter\luatexbase@cctb@sty@endinput% -\fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-modutils.sty -\else - \RequirePackage{luatexbase-modutils} -\fi -\luatexbase@directlua{require('luatexbase.cctb')} -\luatexbase@ensure@primitive{luaescapestring} -\luatexbase@ensure@primitive{catcodetable} -\luatexbase@ensure@primitive{initcatcodetable} -\luatexbase@ensure@primitive{savecatcodetable} -\newcount\lltxb@catcodetable@alloc -\lltxb@catcodetable@alloc\m@ne -\newcount\CatcodeTableStack -\CatcodeTableStack\z@ -\def\newluatexcatcodetable#1{% - \ifnum\lltxb@catcodetable@alloc<65535\relax - \global\advance\lltxb@catcodetable@alloc\tw@ - \allocationnumber\lltxb@catcodetable@alloc - \global\chardef#1\allocationnumber - \luatexinitcatcodetable\allocationnumber - \begingroup\escapechar\m@ne - \luatexbase@directlua{luatexbase.catcodetabledef_from_tex( - '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}% - \endgroup - \wlog{\string#1=\string\luatexcatcodetable\the\allocationnumber}% - \else - \errmessage{No room for a new \string\luatexcatcodetable}% - \fi} -\def\IncCatcodeTableStack{% - \ifnum\CatcodeTableStack<65534\relax - \global\advance\CatcodeTableStack\tw@ - \else - \errmessage{CatcodeTableStack overflow}% - \fi} -\def\DecCatcodeTableStack{% - \ifnum\CatcodeTableStack>\z@ - \global\advance\CatcodeTableStack-2\relax - \else - \errmessage{CatcodeTableStack underflow}% - \fi} -\expandafter\ifx\csname @tempcnta\endcsname\relax - \csname newcount\endcsname\@tempcnta -\fi -\expandafter\ifx\csname @tempcntb\endcsname\relax - \csname newcount\endcsname\@tempcntb -\fi -\def\SetCatcodeRange#1#2#3{% - \edef\luaSCR@temp{% - \noexpand\@tempcnta=\the\@tempcnta - \noexpand\@tempcntb=\the\@tempcntb - \noexpand\count@=\the\count@ - \relax}% - \@tempcnta=#1\relax - \@tempcntb=#2\relax - \count@=#3\relax - \loop\unless\ifnum\@tempcnta>\@tempcntb - \catcode\@tempcnta=\count@ - \advance\@tempcnta\@ne - \repeat - \luaSCR@temp} -\def\lltxb@synonym#1#2{% - \def#1{% - \begingroup - \ifdefined\PackageWarning - \let\x\PackageWarning - \else - \def\x####1####2{% - \begingroup \endlinechar10 - \message{Package ####1 warning: ####2}% - \endgroup} - \fi - \expandafter\endgroup - \x{luatex}{\string#1 is deprecated^^J% - and will be removed in the next version of the package.^^J% - Please use \string#2 instead.} - \let#1#2% - #1}} -\lltxb@synonym \setcatcoderange \SetCatcodeRange -\def\setluatexcatcodetable#1#2{% - \begingroup - #2% - \luatexsavecatcodetable#1% - \endgroup} -\newluatexcatcodetable\CatcodeTableIniTeX -\newluatexcatcodetable\CatcodeTableString -\setluatexcatcodetable\CatcodeTableString{% - \luatexcatcodetable\CatcodeTableIniTeX - \catcode0 12 % nul - \catcode13 12 % carriage return - \catcode37 12 % percent - \SetCatcodeRange{65}{90}{12}% A-Z - \SetCatcodeRange{97}{122}{12}% a-z - \catcode92 12 % backslash - \catcode127 12 } -\newluatexcatcodetable\CatcodeTableOther -\setluatexcatcodetable\CatcodeTableOther{% - \luatexcatcodetable\CatcodeTableString - \catcode32 12 } -\newluatexcatcodetable\CatcodeTableLaTeX -\setluatexcatcodetable\CatcodeTableLaTeX{% - \luatexcatcodetable\CatcodeTableIniTeX - \SetCatcodeRange{0}{31}{15}% - \catcode9 10 % tab - \catcode10 12 % newline - \catcode12 13 % form feed - \catcode13 5 % carriage return - \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 } -\newluatexcatcodetable\CatcodeTableLaTeXAtLetter -\setluatexcatcodetable\CatcodeTableLaTeXAtLetter{% - \luatexcatcodetable\CatcodeTableLaTeX - \catcode64=11 } -\newluatexcatcodetable\CatcodeTableExpl -\setluatexcatcodetable\CatcodeTableExpl{% - \luatexcatcodetable\CatcodeTableLaTeX - \catcode126 10 % tilde is a space char - \catcode32 9 % space is ignored - \catcode9 9 % tab also ignored - \catcode95 11 % underscore letter - \catcode58 11 % colon letter - } -\luatexbase@directlua{luatexbase.catcodetable_do_shortcuts()} -\def\lltxb@cctb@numstack{0} -\def\PushCatcodeTableNumStack{% - \xdef\lltxb@cctb@numstack{{\the\luatexcatcodetable}\lltxb@cctb@numstack}} -\def\PopCatcodeTableNumStack{% - \expandafter\lltxb@cctb@numstack@pop\lltxb@cctb@numstack\@nil} -\def\lltxb@cctb@numstack@pop#1#2\@nil{% - \ifx\empty#2\empty - \begingroup - \ifdefined\PackageWarning - \let\x\PackageWarning - \else - \def\x####1####2{% - \begingroup \endlinechar10 - \message{Package ####1 warning: ####2}% - \endgroup}% - \fi - \expandafter\endgroup - \x{luatexbase-cctb}{Popping from an empty CatcodeTableNumStack}% - \luatexcatcodetable\z@ - \else - \gdef\lltxb@cctb@numstack{#2}% - \luatexcatcodetable#1\relax - \fi} -\def\BeginCatcodeRegime#1{% - \PushCatcodeTableNumStack - \IncCatcodeTableStack - \setluatexcatcodetable\CatcodeTableStack{\luatexcatcodetable#1}% - \luatexcatcodetable\CatcodeTableStack} -\def\EndCatcodeRegime{% - \DecCatcodeTableStack - \PopCatcodeTableNumStack} -\luatexbase@cctb@sty@endinput% -\endinput -%% -%% End of file `luatexbase-cctb.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty index 43852a72b1d..42fe852fc12 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty @@ -1,135 +1,14 @@ -%% -%% This is file `luatexbase-compat.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-compat.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 42 12 % * - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@compat@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-compat}[2011/05/24 v0.4 Compatibility tools for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-compat}{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.} - \expandafter\luatexbase@compat@sty@endinput% -\fi -\begingroup -\expandafter\ifx\csname newcommand\endcsname\relax - \toks0{\long\def\luatexbase@directlua}% -\else - \toks0{\newcommand\luatexbase@directlua}% -\fi -\ifnum\luatexversion<36 - \toks0\expandafter{\the\toks0{\directlua0}}% -\else - \toks0\expandafter{\the\toks0{\directlua}}% -\fi -\expandafter\endgroup -\the\toks0 -\luatexbase@directlua{% - luatexbase = luatexbase or {} - luatexbase.luatexversion = \number\luatexversion\space - luatexbase.luatexrevision = \number\luatexrevision\space} -\begingroup -\expandafter\ifx\csname newcommand\endcsname\relax - \toks0{\def\luatexbase@ensure@primitive#1} -\else - \toks0{\newcommand*\luatexbase@ensure@primitive[1]} + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} \fi -\toks2{}\def\x#1{\toks2\expandafter{\the\toks2 #1}} -\x{% - \ifcsname luatex#1\endcsname \else} -\ifnum\luatexversion<37\relax - \x{% - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname #1\endcsname\relax} - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname PackageError\endcsname\relax - \x{% - \errmessage{% - Package luatexbase-compat error: failed to enable `#1'.}} - \else - \x{% - \PackageError{luatexbase-compat}{% - Package luatexbase-compat error: failed to enable `#1'.}{}} - \fi - \x{% - \else} - \x{% - \expandafter\let\csname luatex#1\expandafter\endcsname - \csname#1\endcsname - \fi} +\ProvidesPackage{luatexbase-compat} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \x{% - \luatexbase@directlua{tex.enableprimitives('luatex', {'#1'})}} + \RequirePackage{luatexbase} \fi -\x{% - \fi} -\toks0\expandafter{\the\toks0\expandafter{\the\toks2}} -\expandafter\endgroup -\the\toks0 -\luatexbase@compat@sty@endinput% -\endinput -%% -%% End of file `luatexbase-compat.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty index 7279cf073a3..0f58870b475 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty @@ -1,92 +1,14 @@ -%% -%% This is file `luatexbase-loader.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-loader.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 34 12 % " - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@loader@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-loader}[2013/05/11 v0.6 Lua module loader for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-loader}{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.} - \expandafter\luatexbase@loader@sty@endinput% + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} \fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-compat.sty +\ProvidesPackage{luatexbase-loader} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \RequirePackage{luatexbase-compat} + \RequirePackage{luatexbase} \fi -\luatexbase@directlua{% - local file = "luatexbase.loader.lua" - local path = assert(kpse.find_file(file, 'lua'), - "File '"..file.."' not found") - texio.write_nl("("..path..")") - dofile(path)} -\luatexbase@loader@sty@endinput% -\endinput -%% -%% End of file `luatexbase-loader.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty index d2291653992..5defd977263 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty @@ -1,84 +1,14 @@ -%% -%% This is file `luatexbase-mcb.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-mcb.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@mcb@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-mcb}[2013/05/11 v0.6 Callback management for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty -\else - \RequirePackage{ifluatex} -\fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-mcb}{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.} - \expandafter\luatexbase@mcb@sty@endinput% + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} \fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-modutils.sty +\ProvidesPackage{luatexbase-mcb} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \RequirePackage{luatexbase-modutils} + \RequirePackage{luatexbase} \fi -\luatexbase@directlua{require('luatexbase.mcb')} -\luatexbase@mcb@sty@endinput% -\endinput -%% -%% End of file `luatexbase-mcb.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty index 7579f464a45..cd6cb4d0e6c 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty @@ -1,132 +1,14 @@ -%% -%% This is file `luatexbase-modutils.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-modutils.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 34 12 % " - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 44 12 % , - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 95 8 % _ - \y 96 12 % ` - \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 luatexbase@modutils@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-modutils}[2013/05/11 v0.6 Module utilities for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} +\fi +\ProvidesPackage{luatexbase-modutils} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \RequirePackage{ifluatex} + \RequirePackage{luatexbase} \fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-modutils}{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.} - \expandafter\luatexbase@modutils@sty@endinput% -\fi -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-loader.sty -\else - \RequirePackage{luatexbase-loader} -\fi -\luatexbase@directlua{require('luatexbase.modutils')} -\luatexbase@ensure@primitive{luaescapestring} -\ifdefined\kernel@ifnextchar - \let\lltxb@ifnextchar\kernel@ifnextchar -\else - \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)}} -\luatexbase@modutils@sty@endinput% -\endinput -%% -%% End of file `luatexbase-modutils.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty index 968e0f6e6d6..53e03cc877d 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty @@ -1,185 +1,14 @@ -%% -%% This is file `luatexbase-regs.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase-regs.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 33 12 % ! - \y 36 3 % $ $ (in etex.sty) - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 42 12 % * (in etex.sty) - \y 43 12 % + (in etex.sty) - \y 44 12 % , (in etex.sty) - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 60 12 % < (in etex.sty) - \y 62 12 % > (in etex.sty) - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@regs@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} - \else - \let\x\ProvidesPackage - \fi -\expandafter\endgroup -\x{luatexbase-regs}[2011/05/24 v0.4 Registers allocation for LuaTeX] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} +\fi +\ProvidesPackage{luatexbase-regs} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX (legacy subpackage) +] +\ifx\RequirePackage\undefined + \input{luatexbase.sty}% \else - \RequirePackage{ifluatex} + \RequirePackage{luatexbase} \fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase-regs}{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.} - \expandafter\luatexbase@regs@sty@endinput% -\fi -\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 - \begingroup - \expandafter\ifx\csname PackageWarningNoLine\endcsname\relax - \def\x#1#2{\begingroup\newlinechar10 - \immediate\write16{Package #1 warning: #2}\endgroup} - \else - \let\x\PackageWarningNoLine - \fi - \expandafter\endgroup - \x{luatexbase-regs}{etex macros not loaded!^^J% - Registers allocation scheme will not be extended.} -\else - \ifnum\count270=32768 \count270=65536 \fi - \ifnum\count271=32768 \count271=65536 \fi - \ifnum\count272=32768 \count272=65536 \fi - \ifnum\count273=32768 \count272=65536 \fi - \ifnum\count273=32768 \count273=65536 \fi - \ifnum\count274=32768 \count274=65536 \fi - \ifnum\count275=32768 \count275=65536 \fi - \ifnum\count276=32768 \count276=65536 \fi - \begingroup \toks0{} - \def\@namedef #1{\expandafter \def\csname#1\endcsname} - \def\@outerdef#1{\expandafter\outer\expandafter\def\csname#1\endcsname} - \def\def@globbox #1#2{\@outerdef{#1}{\et@xglob 4 \box #2}} - \def\def@locbox #1#2{\@namedef {#1}{\et@xloc 4 \box #2}} - \def\def@globmarks #1#2{\@outerdef{#1}{\et@xglob 6 \marks #2}} - \def\def@locmarks #1#2{\@namedef {#1}{\et@xloc 6 \marks #2}} - \def\def@et@xgblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk ##1##2{##4}% - {\allocationnumber=\count 26##1 - \global \advance \count 26##1 by ##4% - \global #2##3=\allocationnumber - \wlog {\string ##3=\string ##2blk{\number ##4} - at \the \allocationnumber}% - }% - }} - \def\def@et@xlblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk ##1##2{##4}% - {\advance \count 27##1 by -##4% - \allocationnumber=\count 27##1 - #2##3=\allocationnumber - \wlog {\string ##3=\string ##2blk{\number ##4} - at \the \allocationnumber \space (local)% - }% - }% - }} - \def\alt@globbox #1#2{\@namedef{#1}{\et@xglob 4\box #2}} - \def\alt@locbox #1#2{\@namedef{#1}{\et@xloc 4\box #2}} - \def\alt@globmarks #1#2{\@namedef{#1}{\et@xglob 6\marks #2}} - \def\alt@locmarks #1#2{\@namedef{#1}{\et@xloc 6\marks #2}} - \def\alt@et@xgblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk##1##2{##4}% - {\allocationnumber\count26##1% - \global\advance\count26##1by##4% - \global#2##3\allocationnumber - \wlog{\string##3=\string##2blk{\number##4} at - \the\allocationnumber}% - }% - }} - \def\alt@et@xlblk#1#2{\@namedef{#1}##1##2##3##4% - {\et@xchkblk##1##2{##4}% - {\advance\count27##1-##4% - \allocationnumber\count27##1% - #2##3\allocationnumber - \et@xwlog{\string##3=\string##2blk{\number##4} at - \the\allocationnumber\space(local)}% - }% - }} - \def\check@def#1{% - \csname def@#1\endcsname{test@#1}\mathchardef - \expandafter\ifx\csname test@#1\expandafter\endcsname - \csname #1\endcsname - \expandafter\let\csname #1\endcsname\relax - \toks0\expandafter{\the\toks0\csname def@#1\endcsname{#1}\chardef} - \else - \csname alt@#1\endcsname{test@#1}\mathchardef - \expandafter\ifx\csname test@#1\expandafter\endcsname - \csname #1\endcsname - \toks0\expandafter{\the\toks0\csname alt@#1\endcsname{#1}\chardef} - \else - \expandafter\show\csname BAD#1\endcsname - \fi - \fi} - \check@def{globbox} - \check@def{locbox} - \check@def{globmarks} - \check@def{locmarks} - \check@def{et@xgblk} - \check@def{et@xlblk} - \expandafter \endgroup - \the\toks0 - \expandafter\let\csname newcount\endcsname\globcount - \expandafter\let\csname newdimen\endcsname\globdimen - \expandafter\let\csname newskip\endcsname\globskip - \expandafter\let\csname newbox\endcsname\globbox -\fi -\luatexbase@regs@sty@endinput% -\endinput -%% -%% End of file `luatexbase-regs.sty'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua deleted file mode 100644 index fce0ab79ea4..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua +++ /dev/null @@ -1,65 +0,0 @@ --- --- This is file `luatexbase.loader.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-loader.dtx (with options: `luamodule') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -luatexbase = luatexbase or { } -local luatexbase = luatexbase -kpse.set_program_name("luatex") -local print_included_path = false -if token then - print_included_path = true -end -local lua_suffixes = { - ".luc", ".luctex", ".texluc", ".lua", ".luatex", ".texlua", -} -local function ends_with(suffix, name) - return name:sub(-suffix:len()) == suffix -end -local function basename(name) - for _, suffix in ipairs(lua_suffixes) do - if ends_with(suffix, name) then - return name:sub(1, -(suffix:len()+1)) - end - end - return name -end -local function find_module_file(mod) - local compat = basename(mod):gsub('%.', '/') - return kpse.find_file(compat, 'lua') or kpse.find_file(mod, 'lua') -end -local package_loader_two -if not package.searchers then - package.searchers = package.loaders -end -package_loader_two = package.searchers[2] -local function load_module(mod) - local file = find_module_file(mod) - if not file then - local msg = "\n\t[luatexbase.loader] Search failed" - local ret = package_loader_two(mod) - if type(ret) == 'string' then - return msg..ret - elseif type(ret) == 'nil' then - return msg - else - return ret - end - end - local loader, error = loadfile(file) - if not loader then - return "\n\t[luatexbase.loader] Loading error:\n\t"..error - end - if print_included_path then - texio.write_nl("("..file..")") - end - return loader -end -package.searchers[2] = load_module --- --- End of File `luatexbase.loader.lua'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.sty b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.sty index 6355abad35f..bc985aab9ab 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.sty +++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.sty @@ -1,100 +1,277 @@ -%% -%% This is file `luatexbase.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% luatexbase.dtx (with options: `texpackage') -%% -%% See the aforementioned source file(s) for copyright and licensing information. -%% -\begingroup\catcode61\catcode48\catcode32=10\relax% = and space - \catcode123 1 % { - \catcode125 2 % } - \catcode 35 6 % # - \toks0\expandafter{\expandafter\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 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 10 12 % new line ^^J - \y 39 12 % ' - \y 40 12 % ( - \y 41 12 % ) - \y 45 12 % - - \y 46 12 % . - \y 47 12 % / - \y 58 12 % : - \y 91 12 % [ - \y 93 12 % ] - \y 94 7 % ^ - \y 96 12 % ` - \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 luatexbase@sty@endinput\endcsname% -\begingroup - \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1[#2]{\immediate\write16{Package: #1 #2}} +\ifx\BeginCatcodeRegime\undefined\else\expandafter\endinput\fi + +\ifx + \ProvidesPackage\undefined\begingroup\def\ProvidesPackage + #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}} +\fi +\ProvidesPackage{luatexbase} +[2015/10/01 v1.0 + luatexbase interface to LuaTeX +] +\edef\emuatcatcode{\the\catcode`\@} +\catcode`\@=11 +\ifx\@setrangecatcode\@undefined + \ifx\RequirePackage\@undefined + \input{ctablestack.sty}% \else - \let\x\ProvidesPackage + \RequirePackage{ctablestack} \fi -\expandafter\endgroup -\x{luatexbase}[2013/05/11 v0.6 Resource management for the LuaTeX macro programmer] -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input ifluatex.sty +\fi +\def\RequireLuaModule#1{\directlua{require("#1")}\@gobbleoptarg} +\ifdefined\@ifnextchar +\def\@gobbleoptarg{\@ifnextchar[\@gobble@optarg{}}% \else - \RequirePackage{ifluatex} +\long\def\@gobbleoptarg#1{\ifx[#1\expandafter\@gobble@optarg\fi#1}% \fi -\ifluatex\else - \begingroup - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2#3{\begingroup \newlinechar10 - \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup} - \else - \let\x\PackageError - \fi - \expandafter\endgroup - \x{luatexbase}{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.} - \expandafter\luatexbase@sty@endinput% +\def\@gobble@optarg[#1]{} +\let\CatcodeTableIniTeX\catcodetable@initex +\let\CatcodeTableString\catcodetable@string +\let\CatcodeTableLaTeX\catcodetable@latex +\let\CatcodeTableLaTeXAtLetter\catcodetable@atletter +\newcatcodetable\CatcodeTableOther +\@setcatcodetable\CatcodeTableOther{% + \catcodetable\CatcodeTableString + \catcode32 12 } +\newcatcodetable\CatcodeTableExpl +\@setcatcodetable\CatcodeTableExpl{% + \catcodetable\CatcodeTableLaTeX + \catcode126 10 % tilde is a space char + \catcode32 9 % space is ignored + \catcode9 9 % tab also ignored + \catcode95 11 % underscore letter + \catcode58 11 % colon letter +} +\def\BeginCatcodeRegime#1{% + \@pushcatcodetable + \catcodetable#1\relax} +\def\EndCatcodeRegime{% + \@popcatcodetable} +\let\PushCatcodeTableNumStack\@pushcatcodetable +\let\PopCatcodeTableNumStack\@popcatcodetable +\let\SetCatcodeRange\@setrangecatcode +\let\setcatcodetable\@setcatcodetable +\directlua{ +function luatexbase.reset_callback(name,make_false) + for _,v in pairs(luatexbase.callback_descriptions(name)) + do + luatexbase.remove_from_callback(name,v) + end + if make_false == true then + luatexbase.disable_callback(name) + end +end +luatexbase.base_add_to_callback=luatexbase.add_to_callback +function luatexbase.add_to_callback(name,fun,description,priority) +if(luatexbase.callbacktypes[name] == 3 and + priority == 1 and + \string#luatexbase.callback_descriptions(name)==1) then + luatexbase.module_warning("luatexbase", + "resetting exclusive callback: " .. name) + luatexbase.reset_callback(name) +end +return + luatexbase.base_add_to_callback(name,fun,description) +end +luatexbase.catcodetables=setmetatable( + {['latex-package'] = \number\CatcodeTableLaTeXAtLetter, + ini = \number\CatcodeTableIniTeX, + string = \number\CatcodeTableString, + other = \number\CatcodeTableOther, + latex = \number\CatcodeTableLaTeX, + expl = \number\CatcodeTableExpl, + expl3 = \number\CatcodeTableExpl}, + { __index = function(t,key) + return luatexbase.registernumber(key) or nil + end} +)} +\ifnum\luatexversion<80 % +\def\newcatcodetable#1{% + \e@alloc\catcodetable\chardef + \e@alloc@ccodetable@count\m@ne{"8000}#1% + \initcatcodetable\allocationnumber + {\escapechar=\m@ne + \directlua{luatexbase.catcodetables['\string#1']=% + \the\allocationnumber}}% +} \fi -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatex.sty -\else - \RequirePackage{luatex} +\directlua{ +function luatexbase.priority_in_callback (name,description) + for i,v in ipairs(luatexbase.callback_descriptions(name)) + do + if v == description then + return i + end + end + return false +end +luatexbase.is_active_callback = luatexbase.in_callback +luatexbase.base_provides_module=luatexbase.provides_module +function luatexbase.errwarinf(name) + return + function(s) return luatexbase.module_error(name, s) end, + function(s) return luatexbase.module_warning(name, s) end, + function(s) return luatexbase.module_info(name, s) end, + function(s) return luatexbase.module_info(name, s) end +end +function luatexbase.provides_module(info) + luatexbase.base_provides_module(info) + return luatexbase.errwarinf(info.name) +end +} +\ifnum\luatexversion<80 % +\def\newattribute#1{% + \e@alloc\attribute\attributedef + \e@alloc@attribute@count\m@ne\e@alloc@top#1% + {\escapechar=\m@ne + \directlua{luatexbase.attributes['\string#1']=% + \the\allocationnumber}}% +} \fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \input luatexbase-compat.sty - \input luatexbase-modutils.sty - \input luatexbase-loader.sty - \input luatexbase-regs.sty - \input luatexbase-attr.sty - \input luatexbase-cctb.sty - \input luatexbase-mcb.sty -\else - \RequirePackage{luatexbase-compat} - \RequirePackage{luatexbase-modutils} - \RequirePackage{luatexbase-loader} - \RequirePackage{luatexbase-regs} - \RequirePackage{luatexbase-attr} - \RequirePackage{luatexbase-cctb} - \RequirePackage{luatexbase-mcb} +\ifx\@percentchar\@undefined + {\catcode`\%=12 \gdef\@percentchar{%}} \fi -\luatexbase@sty@endinput% -\endinput -%% -%% End of file `luatexbase.sty'. +\directlua{% + +local user_whatsits = { __unassociated = { } } +local whatsit_ids = { } +local anonymous_whatsits = 0 +local anonymous_prefix = "anon" +local new_user_whatsit_id = function (name, package) + if name then + if not package then + package = unassociated + end + else % anonymous + anonymous_whatsits = anonymous_whatsits + 1 + warning("defining anonymous user whatsit no. \@percentchar + d", anonymous_whatsits) + package = unassociated + name = anonymous_prefix .. tostring(anonymous_whatsits) + end + + local whatsitdata = user_whatsits[package] + if not whatsitdata then + whatsitdata = { } + user_whatsits[package] = whatsitdata + end + + local id = whatsitdata[name] + if id then %- warning + warning("replacing whatsit \@percentchar s:\@percentchar + s (\@percentchar d)", package, name, id) + else %- new id + id=luatexbase.new_whatsit(name) + whatsitdata[name] = id + whatsit_ids[id] = { name, package } + end + return id +end +luatexbase.new_user_whatsit_id = new_user_whatsit_id +local new_user_whatsit = function (req, package) + local id, whatsit + if type(req) == "string" then + id = new_user_whatsit_id(req, package) + whatsit = newnode(whatsit_t, user_defined_t) + whatsit.user_id = id + elseif req.id == whatsit_t and req.subtype == user_defined_t then + id = req.user_id + whatsit = copynode(req) + if not whatsit_ids[id] then + warning("whatsit id \@percentchar d unregistered; " + .. "inconsistencies may arise", id) + end + end + return function () return copynode(whatsit) end, id +end +luatexbase.new_user_whatsit = new_user_whatsit +local get_user_whatsit_id = function (name, package) + if not package then + package = unassociated + end + return user_whatsits[package][name] +end +luatexbase.get_user_whatsit_id = get_user_whatsit_id +local get_user_whatsit_name = function (asked) + local id + if type(asked) == "number" then + id = asked + elseif type(asked) == "function" then + %- node generator + local n = asked() + id = n.user_id + else %- node + id = asked.user_id + end + local metadata = whatsit_ids[id] + if not metadata then % unknown + warning("whatsit id \@percentchar d unregistered; + inconsistencies may arise", id) + return "", "" + end + return tableunpack(metadata) +end +luatexbase.get_user_whatsit_name = get_user_whatsit_name +local dump_registered_whatsits = function (asked_package) + local whatsit_list = { } + if asked_package then + local whatsitdata = user_whatsits[asked_package] + if not whatsitdata then + error("(no user whatsits registered for package + \@percentchar s)", asked_package) + return + end + texiowrite_nl("(user whatsit allocation stats for " .. + asked_package) + for name, id in next, whatsitdata do + whatsit_list[\string#whatsit_list+1] = + stringformat("(\@percentchar s:\@percentchar + s \@percentchar d)", asked_package, name, id) + end + else + texiowrite_nl("(user whatsit allocation stats") + texiowrite_nl(stringformat(" ((total \@percentchar d)\string\n + (anonymous \@percentchar d))", + current_whatsit, anonymous_whatsits)) + for package, whatsitdata in next, user_whatsits do + for name, id in next, whatsitdata do + whatsit_list[\string#whatsit_list+1] = + stringformat("(\@percentchar s:\@percentchar + s \@percentchar d)", package, name, id) + end + end + end + texiowrite_nl" (" + local first = true + for i=1, \string#whatsit_list do + if first then + first = false + else % indent + texiowrite_nl" " + end + texiowrite(whatsit_list[i]) + end + texiowrite"))\string\n" +end +luatexbase.dump_registered_whatsits = dump_registered_whatsits +luatexbase.newattribute = new_attribute +luatexbase.newuserwhatsit = new_user_whatsit +luatexbase.newuserwhatsitid = new_user_whatsit_id +luatexbase.getuserwhatsitid = get_user_whatsit_id +luatexbase.getuserwhatsitname = get_user_whatsit_name +luatexbase.dumpregisteredwhatsits = dump_registered_whatsits +} +\let\newluatexattribute\newattribute +\let\setluatexattribute\setattribute +\let\unsetluatexattribute\unsetattribute +\let\newluatexcatcodetable\newcatcodetable +\let\setluatexcatcodetable\setcatcodetable +\let\luatexbase@directlua\directlua +\let\luatexbase@ensure@primitive\@gobble +\let\luatexattribute\attribute +\let\luatexattributedef\attributedef +\let\luatexcatcodetable\catcodetable +\let\luatexluaescapestring\luaescapestring +\let\luatexlatelua\latelua +\let\luatexoutputbox\outputbox +\let\luatexscantextokens\scantextokens +\catcode`\@=\emuatcatcode\relax diff --git a/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua b/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua deleted file mode 100644 index ae9e8a78523..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua +++ /dev/null @@ -1,313 +0,0 @@ --- --- This is file `mcb.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-mcb.dtx (with options: `lua') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -luatexbase = luatexbase or { } -local luatexbase = luatexbase -local err, warning, info, log = luatexbase.provides_module({ - name = "luatexbase-mcb", - version = 0.6, - date = "2013/05/11", - description = "register several functions in a callback", - author = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - copyright = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", - license = "CC0", -}) -local add_to_callback -local call_callback -local create_callback -local priority_in_callback -local remove_from_callback -local reset_callback -local callbacklist = callbacklist or { } -local list, data, first, simple = 1, 2, 3, 4 -local types = { - list = list, - data = data, - first = first, - simple = simple, -} -local callbacktypes = callbacktypes or { - find_read_file = first, - find_write_file = first, - find_font_file = data, - find_output_file = data, - find_format_file = data, - find_vf_file = data, - find_ocp_file = data, - find_map_file = data, - find_enc_file = data, - find_sfd_file = data, - find_pk_file = data, - find_data_file = data, - find_opentype_file = data, - find_truetype_file = data, - find_type1_file = data, - find_image_file = data, - open_read_file = first, - read_font_file = first, - read_vf_file = first, - read_ocp_file = first, - read_map_file = first, - read_enc_file = first, - read_sfd_file = first, - read_pk_file = first, - read_data_file = first, - read_truetype_file = first, - read_type1_file = first, - read_opentype_file = first, - process_input_buffer = data, - process_output_buffer = data, - token_filter = first, - buildpage_filter = simple, - pre_linebreak_filter = list, - linebreak_filter = list, - post_linebreak_filter = list, - hpack_filter = list, - vpack_filter = list, - pre_output_filter = list, - hyphenate = simple, - ligaturing = simple, - kerning = simple, - mlist_to_hlist = list, - start_run = simple, - stop_run = simple, - start_page_number = simple, - stop_page_number = simple, - show_error_hook = simple, - define_font = first, -} -local lua_callbacks_defaults = { } -local original_register = original_register or callback.register -callback.register = function () - err("function callback.register has been trapped,\n" - .."please use luatexbase.add_to_callback instead.") -end -local function register_callback(...) - return assert(original_register(...)) -end -local function listhandler (name) - return function(head,...) - local ret - local alltrue = true - for _, f in ipairs(callbacklist[name]) do - ret = f.func(head, ...) - if ret == false then - warning("function '%s' returned false\nin callback '%s'", - f.description, name) - break - end - if ret ~= true then - alltrue = false - head = ret - end - end - return alltrue and true or head - end -end -local function datahandler (name) - return function(data, ...) - for _, f in ipairs(callbacklist[name]) do - data = f.func(data, ...) - end - return data - end -end -local function firsthandler (name) - return function(...) - return callbacklist[name][1].func(...) - end -end -local function simplehandler (name) - return function(...) - for _, f in ipairs(callbacklist[name]) do - f.func(...) - end - end -end -local handlers = { - [list] = listhandler, - [data] = datahandler, - [first] = firsthandler, - [simple] = simplehandler, -} -function add_to_callback (name,func,description,priority) - if type(func) ~= "function" then - return err("unable to add function:\nno proper function passed") - end - if not name or name == "" then - err("unable to add function:\nno proper callback name passed") - return - elseif not callbacktypes[name] then - err("unable to add function:\n'%s' is not a valid callback", name) - return - end - if not description or description == "" then - err("unable to add function to '%s':\nno proper description passed", - name) - return - end - if priority_in_callback(name, description) then - err("function '%s' already registered\nin callback '%s'", - description, name) - return - end - local l = callbacklist[name] - if not l then - l = {} - callbacklist[name] = l - if not lua_callbacks_defaults[name] then - register_callback(name, handlers[callbacktypes[name]](name)) - end - end - local f = { - func = func, - description = description, - } - priority = tonumber(priority) - if not priority or priority > #l then - priority = #l+1 - elseif priority < 1 then - priority = 1 - end - table.insert(l,priority,f) - if callbacktypes[name] == first and #l ~= 1 then - warning("several functions in '%s',\n" - .."only one will be active.", name) - end - log("inserting '%s'\nat position %s in '%s'", - description, priority, name) -end -luatexbase.add_to_callback = add_to_callback -function remove_from_callback (name, description) - if not name or name == "" then - err("unable to remove function:\nno proper callback name passed") - return - elseif not callbacktypes[name] then - err("unable to remove function:\n'%s' is not a valid callback", name) - return - end - if not description or description == "" then - err( - "unable to remove function from '%s':\nno proper description passed", - name) - return - end - local l = callbacklist[name] - if not l then - err("no callback list for '%s'",name) - return - end - local index = false - for k,v in ipairs(l) do - if v.description == description then - index = k - break - end - end - if not index then - err("unable to remove '%s'\nfrom '%s'", description, name) - return - end - table.remove(l, index) - log("removing '%s'\nfrom '%s'", description, name) - if #l == 0 then - callbacklist[name] = nil - if not lua_callbacks_defaults[name] then - register_callback(name, nil) - end - end - return -end -luatexbase.remove_from_callback = remove_from_callback -function reset_callback (name, make_false) - if not name or name == "" then - err("unable to reset:\nno proper callback name passed") - return - elseif not callbacktypes[name] then - err("unable to reset '%s':\nis not a valid callback", name) - return - end - log("resetting callback '%s'", name) - callbacklist[name] = nil - if not lua_callbacks_defaults[name] then - if make_false == true then - log("setting '%s' to false", name) - register_callback(name, false) - else - register_callback(name, nil) - end - end -end -luatexbase.reset_callback = reset_callback -function priority_in_callback (name, description) - if not name or name == "" - or not callbacktypes[name] - or not description then - return false - end - local l = callbacklist[name] - if not l then return false end - for p, f in pairs(l) do - if f.description == description then - return p - end - end - return false -end -luatexbase.priority_in_callback = priority_in_callback -function create_callback(name, ctype, default) - if not name then - err("unable to call callback:\nno proper name passed", name) - return nil - end - if not ctype or not default then - err("unable to create callback '%s':\n" - .."callbacktype or default function not specified", name) - return nil - end - if callbacktypes[name] then - err("unable to create callback '%s':\ncallback already exists", name) - return nil - end - ctype = types[ctype] - if not ctype then - err("unable to create callback '%s':\ntype '%s' undefined", name, ctype) - return nil - end - log("creating '%s' type %s", name, ctype) - lua_callbacks_defaults[name] = default - callbacktypes[name] = ctype -end -luatexbase.create_callback = create_callback -function call_callback(name, ...) - if not name then - err("unable to call callback:\nno proper name passed", name) - return nil - end - if not lua_callbacks_defaults[name] then - err("unable to call lua callback '%s':\nunknown callback", name) - return nil - end - local l = callbacklist[name] - local f - if not l then - f = lua_callbacks_defaults[name] - else - f = handlers[callbacktypes[name]](name) - if not f then - err("unknown callback type") - return - end - end - return f(...) -end -luatexbase.call_callback = call_callback --- --- End of File `mcb.lua'. diff --git a/Master/texmf-dist/tex/luatex/luatexbase/modutils.lua b/Master/texmf-dist/tex/luatex/luatexbase/modutils.lua deleted file mode 100644 index 1c5b5ca1488..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexbase/modutils.lua +++ /dev/null @@ -1,150 +0,0 @@ --- --- This is file `modutils.lua', --- generated with the docstrip utility. --- --- The original source files were: --- --- luatexbase-modutils.dtx (with options: `luamodule') --- --- See the aforementioned source file(s) for copyright and licensing information. --- -luatexbase = luatexbase or { } -local luatexbase = luatexbase -local string_gsub = string.gsub -local modules = modules or {} -local function date_to_int(date) - if date == '' then return -1 end - local numbers = string_gsub(date, "(%d+)/(%d+)/(%d+)", "%1%2%3") - return tonumber(numbers) -end -local function msg_format(msg_type, mod_name, ...) - local cont = '('..mod_name..')' .. ('Module: '..msg_type):gsub('.', ' ') - return 'Module '..mod_name..' '..msg_type..': ' - .. string.format(...):gsub('\n', '\n'..cont) .. '\n' -end -local function module_error_int(mod, ...) - error(msg_format('error', mod, ...), 3) -end -local function module_error(mod, ...) - module_error_int(mod, ...) -end -luatexbase.module_error = module_error -local function module_warning(mod, ...) - for _, line in ipairs(msg_format('warning', mod, ...):explode('\n')) do - texio.write_nl(line) - end -end -luatexbase.module_warning = module_warning -local function module_info(mod, ...) - for _, line in ipairs(msg_format('info', mod, ...):explode('\n')) do - texio.write_nl(line) - end -end -luatexbase.module_info = module_info -local function module_log(mod, msg, ...) - texio.write_nl('log', mod..': '..msg:format(...)) -end -luatexbase.module_log = module_log -local function errwarinf(name) - return function(...) module_error_int(name, ...) end, - function(...) module_warning(name, ...) end, - function(...) module_info(name, ...) end, - function(...) module_log(name, ...) end -end -luatexbase.errwarinf = errwarinf -local err, warn = errwarinf('luatexbase.modutils') -local function require_module(name, req_date) - require(name) - local info = modules[name] - if not info then - warn("module '%s' was not properly identified", name) - elseif req_date and info.date then - if date_to_int(info.date) < date_to_int(req_date) then - warn("module '%s' required in version '%s'\n" - .. "but found in version '%s'", name, req_date, info.date) - end - end -end -luatexbase.require_module = require_module -local function provides_module(info) - if not (info and info.name) then - err('provides_module: missing information') - end - texio.write_nl('log', string.format("Lua module: %s %s %s %s\n", - info.name, info.date or '', info.version or '', info.description or '')) - modules[info.name] = info - return errwarinf(info.name) -end -luatexbase.provides_module = provides_module -local fastcopy -fastcopy = table.fastcopy or function(old) - if old then - local new = { } - for k,v in next, old do - if type(v) == "table" then - new[k] = fastcopy(v) - else - new[k] = v - end - end - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) - end - return new - else - return { } - end -end -local function get_module_info(name) - local module_table = modules[name] - if not module_table then - return nil - else - return fastcopy(module_table) - end -end -luatexbase.get_module_info = get_module_info -function get_module_version(name) - local module_table = modules[name] - if not module_table then - return nil - else - return module_table.version - end -end -luatexbase.get_module_version = get_module_version -function get_module_date(name) - local module_table = modules[name] - if not module_table then - return nil - else - return module_table.date - end -end -luatexbase.get_module_date = get_module_date -function get_module_date_int(name) - local module_table = modules[name] - if not module_table then - return nil - else - return module_table.date and date_to_int(module_table.date) - end -end -luatexbase.get_module_date_int = get_module_date_int -function is_module_loaded(name) - if modules[name] then - return true - else - return false - end -end -luatexbase.is_module_loaded = is_module_loaded -provides_module({ - name = 'luatexbase-modutils', - date = '2013/05/11', - version = 0.6, - description = 'Module utilities for LuaTeX', -}) --- --- End of File `modutils.lua'. |