summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexbase
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-14 18:33:36 +0000
committerKarl Berry <karl@freefriends.org>2010-05-14 18:33:36 +0000
commit09a722e13fe00b1a17488d358d8ebf0329e53691 (patch)
tree18d3dd81a75658b26719391e0b2645c00fd69b1e /Master/texmf-dist/tex/luatex/luatexbase
parent37056aa438ffe6895f43f303d6de45bdafefdccd (diff)
new package luatexbase (13may10)
git-svn-id: svn://tug.org/texlive/trunk@18256 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexbase')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/attr.lua20
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/cctb.lua31
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty118
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty181
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty133
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty90
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty85
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty98
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty179
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua76
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/mcb.lua349
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/modutils.lua115
12 files changed, 1475 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
new file mode 100644
index 00000000000..f794e350812
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
@@ -0,0 +1,20 @@
+--
+-- This is file `attr.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luatexbase-attr.dtx (with options: `luamodule')
+--
+-- Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+--
+-- This work is under the CC0 license.
+-- See source file 'luatexbase-attr.dtx' for details.
+--
+module('luatexbase', package.seeall)
+attributes = {}
+function attributedef_from_tex(name, number)
+ attributes[name] = tonumber(number)
+end
+--
+-- 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
new file mode 100644
index 00000000000..8d02dbb9b8e
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/cctb.lua
@@ -0,0 +1,31 @@
+--
+-- This is file `cctb.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luatexbase-cctb.dtx (with options: `luamodule')
+--
+-- Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+--
+-- This work is under the CC0 license.
+-- See source file 'luatexbase-cctb.dtx' for details.
+--
+module('luatexbase', package.seeall)
+catcodetables = {}
+function catcodetabledef_from_tex(name, number)
+ catcodetables[name] = tonumber(number)
+end
+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
+--
+-- 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
new file mode 100644
index 00000000000..d839e544bb3
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty
@@ -0,0 +1,118 @@
+%%
+%% This is file `luatexbase-attr.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-attr.dtx (with options: `texpackage')
+%%
+%% Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-attr.dtx' for details.
+%%
+ \csname lltxb@attr@loaded\endcsname
+\expandafter\let\csname lltxb@attr@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@attr@AtEnd\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}[2010/05/12 v0.2 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 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-attr}{LuaTeX is required for this package. Aborting.}
+ \lltxb@attr@AtEnd
+ \expandafter\endinput
+\fi
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-compat.sty
+\else
+ \RequirePackage{luatexbase-compat}
+\fi
+\luatexbase@ensure@primitive{luaescapestring}
+\luatexbase@ensure@primitive{attributedef}
+\luatexbase@ensure@primitive{attribute}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-loader.sty
+\else
+ \RequirePackage{luatexbase-loader}
+\fi
+\luatexbase@directlua{require('luatexbase.attr')}
+\newcount\lltxb@attribute@alloc
+\lltxb@attribute@alloc\m@ne
+\def\newluatexattribute#1{%
+ \ifnum\lltxb@attribute@alloc<65535\relax
+ \global\advance\lltxb@attribute@alloc\@ne
+ \allocationnumber\lltxb@attribute@alloc
+ \global\luatexattributedef#1=\allocationnumber
+ \unsetluatexattribute#1%
+ \begingroup\escapechar\m@ne
+ \luatexbase@directlua{luatexbase.attributedef_from_tex(
+ '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
+ \endgroup
+ \wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
+ \else
+ \errmessage{No room for a new \string\attribute}%
+ \fi}
+\def\unsetluatexattribute#1{%
+ \ifnum\luatexversion<37\relax
+ #1=-1\relax
+ \else
+ #1=-"7FFFFFFF\relax
+ \fi}
+\def\setluatexattribute#1#2{%
+ #1=\numexpr#2\relax}
+\lltxb@attr@AtEnd
+\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
new file mode 100644
index 00000000000..ce4cbeda89e
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty
@@ -0,0 +1,181 @@
+%%
+%% This is file `luatexbase-cctb.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-cctb.dtx (with options: `texpackage')
+%%
+%% Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-cctb.dtx' for details.
+%%
+ \csname lltxb@cctb@loaded\endcsname
+\expandafter\let\csname lltxb@cctb@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@cctb@AtEnd\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}[2010/05/11 v0.2 Catcodetable 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 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-cctb}{LuaTeX is required for this package. Aborting.}
+ \lltxb@cctb@AtEnd
+ \expandafter\endinput
+\fi
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-loader.sty
+\else
+ \RequirePackage{luatexbase-loader}
+\fi
+\luatexbase@directlua{require('luatexbase.cctb')}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-compat.sty
+\else
+ \RequirePackage{luatexbase-compat}
+\fi
+\luatexbase@ensure@primitive{luaescapestring}
+\luatexbase@ensure@primitive{catcodetable}
+\luatexbase@ensure@primitive{initcatcodetable}
+\luatexbase@ensure@primitive{savecatcodetable}
+\newcount\lltxb@catcodetable@alloc
+\lltxb@catcodetable@alloc\z@
+\def\newluatexcatcodetable#1{%
+ \ifnum\lltxb@catcodetable@alloc<65535\relax
+ \global\advance\lltxb@catcodetable@alloc\@ne
+ \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}
+\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\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
+ \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()}
+\lltxb@cctb@AtEnd
+\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
new file mode 100644
index 00000000000..672645ee0c1
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty
@@ -0,0 +1,133 @@
+%%
+%% This is file `luatexbase-compat.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-compat.dtx (with options: `texpackage')
+%%
+%% Written in 2010 by Manuel Pegourie-Gonnard.
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-compat.dtx' for details.
+%%
+ \csname lltxb@compat@loaded\endcsname
+\expandafter\let\csname lltxb@compat@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@compat@AtEnd\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}[2010/05/12 v0.2 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 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-compat}{LuaTeX is required for this package. Aborting.}
+ \lltxb@compat@AtEnd
+ \expandafter\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]}
+\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}
+\else
+ \x{%
+ \luatexbase@directlua{tex.enableprimitives('luatex', '#1')}}
+\fi
+\x{%
+ \fi}
+\toks0\expandafter{\the\toks0\expandafter{\the\toks2}}
+\expandafter\endgroup
+\the\toks0
+\lltxb@compat@AtEnd
+\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
new file mode 100644
index 00000000000..f6c300e445f
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty
@@ -0,0 +1,90 @@
+%%
+%% This is file `luatexbase-loader.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-loader.dtx (with options: `texpackage')
+%%
+%% Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-loader.dtx' for details.
+%%
+ \csname lltxb@loader@loaded\endcsname
+\expandafter\let\csname lltxb@loader@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@loader@AtEnd\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}[2010/05/12 v0.2 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 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-loader}{LuaTeX is required for this package. Aborting.}
+ \lltxb@loader@AtEnd
+ \expandafter\endinput
+\fi
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-compat.sty
+\else
+ \RequirePackage{luatexbase-compat}
+\fi
+\luatexbase@directlua{%
+ local file = "luatexbase.loader.lua"
+ local path = assert(kpse.find_file(file, 'tex'),
+ "File '"..file.."' no found")
+ texio.write_nl("("..path..")")
+ dofile(path)}
+\lltxb@loader@AtEnd
+\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
new file mode 100644
index 00000000000..f761f74a575
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty
@@ -0,0 +1,85 @@
+%%
+%% This is file `luatexbase-mcb.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-mcb.dtx (with options: `texpackage')
+%%
+%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-mcb.dtx' for details.
+%%
+ \csname lltxb@mcb@loaded\endcsname
+\expandafter\let\csname lltxb@mcb@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@mcb@AtEnd\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}[2010/05/12 v0.2 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 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-mcb}{LuaTeX is required for this package. Aborting.}
+ \lltxb@mcb@AtEnd
+ \expandafter\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.mcb')}
+\lltxb@mcb@AtEnd
+\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
new file mode 100644
index 00000000000..0d46d515b2f
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty
@@ -0,0 +1,98 @@
+%%
+%% This is file `luatexbase-modutils.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-modutils.dtx (with options: `texpackage')
+%%
+%% Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-modutils.dtx' for details.
+%%
+ \csname lltxb@modutils@loaded\endcsname
+\expandafter\let\csname lltxb@modutils@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@modutils@AtEnd\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}[2010/05/12 v0.2 Module utilities 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 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-modutils}{LuaTeX is required for this package. Aborting.}
+ \lltxb@modutils@AtEnd
+ \expandafter\endinput
+\fi
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-loader.sty
+\else
+ \RequirePackage{luatexbase-loader}
+\fi
+\luatexbase@directlua{require('luatexbase.modutils')}
+\luatexbase@ensure@primitive{luaescapestring}
+\def\luatexUseModule#1{\luatexbase@directlua{%
+ luatexbase.use_module("\luatexluescapestring{#1}")}}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname newcommand\endcsname\relax
+ \def\luatexRequireModule#1#2{%
+ \luatexbase@directlua{luatexbase.require_module(
+ "\luatexluaescapestring{#1}", "\luatexluaescapestring{#2}")}}
+\else
+ \newcommand\luatexRequireModule[2][0]{%
+ \luatexbase@directlua{luatexbase.require_module(
+ "\luatexluaescapestring{#2}", "\luatexluaescapestring{#1}")}}
+\fi
+\lltxb@modutils@AtEnd
+\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
new file mode 100644
index 00000000000..7e91965b5cf
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty
@@ -0,0 +1,179 @@
+%%
+%% This is file `luatexbase-regs.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luatexbase-regs.dtx (with options: `texpackage')
+%%
+%% Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+%%
+%% This work is under the CC0 license.
+%% See source file 'luatexbase-regs.dtx' for details.
+%%
+ \csname lltxb@regs@loaded\endcsname
+\expandafter\let\csname lltxb@regs@loaded\endcsname\endinput
+\begingroup
+ \catcode123 1 % {
+ \catcode125 2 % }
+ \catcode 35 6 % #
+ \toks0{}%
+ \def\x{}%
+ \def\y#1 #2 {%
+ \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
+ \edef\x{\x \catcode#1 #2}}%
+ \y 123 1 % {
+ \y 125 2 % }
+ \y 35 6 % #
+ \y 10 12 % ^^J
+ \y 34 12 % "
+ \y 36 3 % $ $
+ \y 39 12 % '
+ \y 40 12 % (
+ \y 41 12 % )
+ \y 42 12 % *
+ \y 43 12 % +
+ \y 44 12 % ,
+ \y 45 12 % -
+ \y 46 12 % .
+ \y 47 12 % /
+ \y 60 12 % <
+ \y 61 12 % =
+ \y 64 11 % @ (letter)
+ \y 62 12 % >
+ \y 95 12 % _ (other)
+ \y 96 12 % `
+ \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}%
+\expandafter\y\csname lltxb@regs@AtEnd\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}[2010/05/12 v0.2 Registers 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 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}{LuaTeX is required for this package. Aborting.}
+ \lltxb@regs@AtEnd
+ \expandafter\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
+\lltxb@regs@AtEnd
+\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
new file mode 100644
index 00000000000..d4f30a16ed1
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua
@@ -0,0 +1,76 @@
+--
+-- This is file `luatexbase.loader.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luatexbase-loader.dtx (with options: `luamodule')
+--
+-- Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+--
+-- This work is under the CC0 license.
+-- See source file 'luatexbase-loader.dtx' for details.
+--
+module('luatexbase', package.seeall)
+local lua_suffixes = {
+ ".luc", ".luctex", ".texluc", ".lua", ".luatex", ".texlua",
+}
+local function ends_with(suffix, name)
+ return name:sub(-suffix:len()) == suffix
+end
+function find_file_lua_emul(name)
+ local search_list = {}
+ for _, suffix in ipairs(lua_suffixes) do
+ if ends_with(suffix, name) then
+ search_list = { name }
+ break
+ else
+ table.insert(search_list, name..suffix)
+ end
+ end
+ for _, search_name in ipairs(search_list) do
+ local f = kpse.find_file(search_name, 'texmfscripts')
+ or kpse.find_file(search_name, 'tex')
+ if f and ends_with(search_name, f) then
+ return f
+ end
+ end
+end
+local find_file_lua
+if pcall('kpse.find_file', 'dummy', 'lua') then
+ find_file_lua = function (name)
+ return kpse.find_file(name, 'lua') or find_file_lua_emul(name)
+ end
+else
+ find_file_lua = function (name)
+ return find_file_lua_emul(name)
+ end
+end
+local function find_module_file(mod)
+ return find_file_lua(mod:gsub('%.', '/'), 'lua')
+ or find_file_lua(mod, 'lua')
+end
+local package_loader_two = package.loaders[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
+ texio.write_nl("("..file..")")
+ return loader
+end
+package.loaders[2] = load_module
+--
+-- End of File `luatexbase.loader.lua'.
diff --git a/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua b/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua
new file mode 100644
index 00000000000..a71820582e6
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua
@@ -0,0 +1,349 @@
+--
+-- This is file `mcb.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luatexbase-mcb.dtx (with options: `lua')
+--
+-- Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>
+--
+-- This work is under the CC0 license.
+-- See source file 'luatexbase-mcb.dtx' for details.
+--
+module('luatexbase', package.seeall)
+luatexbase.provides_module({
+ name = "luamcallbacks",
+ version = 0.2,
+ date = "2010/05/12",
+ description = "register several functions in a callback",
+ author = "Hans Hagen, Elie Roux and Manuel P^^c3^^a9gourie-Gonnard",
+ copyright = "Hans Hagen, Elie Roux and Manuel P^^c3^^a9gourie-Gonnard",
+ license = "CC0",
+})
+local log = log or function(...)
+ luatexbase.module_log('luamcallbacks', string.format(...))
+end
+local info = info or function(...)
+ luatexbase.module_info('luamcallbacks', string.format(...))
+end
+local warning = warning or function(...)
+ luatexbase.module_warning('luamcallbacks', string.format(...))
+end
+local err = err or function(...)
+ luatexbase.module_error('luamcallbacks', string.format(...))
+end
+local callbacklist = callbacklist or { }
+local lua_callbacks_defaults = { }
+local list = 1
+local data = 2
+local first = 3
+local simple = 4
+local callbacktypes = callbacktypes or {
+ buildpage_filter = simple,
+ token_filter = first,
+ pre_output_filter = list,
+ hpack_filter = list,
+ process_input_buffer = data,
+ mlist_to_hlist = list,
+ vpack_filter = list,
+ define_font = first,
+ open_read_file = first,
+ linebreak_filter = list,
+ post_linebreak_filter = list,
+ pre_linebreak_filter = list,
+ start_page_number = simple,
+ stop_page_number = simple,
+ start_run = simple,
+ show_error_hook = simple,
+ stop_run = simple,
+ hyphenate = simple,
+ ligaturing = simple,
+ kerning = data,
+ find_write_file = first,
+ find_read_file = first,
+ find_vf_file = data,
+ find_map_file = data,
+ find_format_file = data,
+ find_opentype_file = data,
+ find_output_file = data,
+ find_truetype_file = data,
+ find_type1_file = data,
+ find_data_file = data,
+ find_pk_file = data,
+ find_font_file = data,
+ find_image_file = data,
+ find_ocp_file = data,
+ find_sfd_file = data,
+ find_enc_file = data,
+ read_sfd_file = first,
+ read_map_file = first,
+ read_pk_file = first,
+ read_enc_file = first,
+ read_vf_file = first,
+ read_ocp_file = first,
+ read_opentype_file = first,
+ read_truetype_file = first,
+ read_font_file = first,
+ read_type1_file = first,
+ read_data_file = first,
+}
+if luatexbase.luatexversion > 42 then
+ callbacktypes["process_output_buffer"] = data
+end
+local internalregister = internalregister or callback.register
+local function str_to_type(str)
+ if str == 'list' then
+ return list
+ elseif str == 'data' then
+ return data
+ elseif str == 'first' then
+ return first
+ elseif str == 'simple' then
+ return simple
+ else
+ return nil
+ end
+end
+-- local
+function listhandler (name)
+ return function(head,...)
+ local l = callbacklist[name]
+ if l then
+ local done = true
+ for _, f in ipairs(l) do
+ -- the returned value is either true or a new head plus true
+ rtv1, rtv2 = f.func(head,...)
+ if type(rtv1) == 'boolean' then
+ done = rtv1
+ elseif type (rtv1) == 'userdata' then
+ head = rtv1
+ end
+ if type(rtv2) == 'boolean' then
+ done = rtv2
+ elseif type(rtv2) == 'userdata' then
+ head = rtv2
+ end
+ if done == false then
+ err("function \"%s\" returned false in callback '%s'",
+ f.description, name)
+ end
+ end
+ return head, done
+ else
+ return head, false
+ end
+ end
+end
+local function datahandler (name)
+ return function(data,...)
+ local l = callbacklist[name]
+ if l then
+ for _, f in ipairs(l) do
+ data = f.func(data,...)
+ end
+ end
+ return data
+ end
+end
+local function firsthandler (name)
+ return function(...)
+ local l = callbacklist[name]
+ if l then
+ local f = l[1].func
+ return f(...)
+ else
+ return nil, false
+ end
+ end
+end
+local function simplehandler (name)
+ return function(...)
+ local l = callbacklist[name]
+ if l then
+ for _, f in ipairs(l) do
+ f.func(...)
+ end
+ end
+ end
+end
+function add_to_callback (name,func,description,priority)
+ if type(func) ~= "function" then
+ err("unable to add function, no proper function passed")
+ return
+ end
+ if not name or name == "" then
+ err("unable to add function, no proper callback name passed")
+ return
+ elseif not callbacktypes[name] then
+ err("unable to add function, '%s' is not a valid callback", name)
+ return
+ end
+ if not description or description == "" then
+ err("unable to add function to '%s', no proper description passed",
+ name)
+ return
+ end
+ if priority_in_callback(name, description) ~= 0 then
+ warning("function '%s' already registered in callback '%s'",
+ description, name)
+ end
+ local l = callbacklist[name]
+ if not l then
+ l = {}
+ callbacklist[name] = l
+ if not lua_callbacks_defaults[name] then
+ if callbacktypes[name] == list then
+ internalregister(name, listhandler(name))
+ elseif callbacktypes[name] == data then
+ internalregister(name, datahandler(name))
+ elseif callbacktypes[name] == simple then
+ internalregister(name, simplehandler(name))
+ elseif callbacktypes[name] == first then
+ internalregister(name, firsthandler(name))
+ else
+ err("unknown callback type")
+ end
+ 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
+ if callbacktypes[name] == first and (priority ~= 1 or #l ~= 0) then
+ warning("several callbacks registered in callback '%s', "
+ .."only the first function will be active.", name)
+ end
+ table.insert(l,priority,f)
+ log("inserting function '%s' at position %s in callback list for '%s'",
+ description, priority, name)
+end
+function remove_from_callback (name, description)
+ if not name or name == "" then
+ err("unable to remove function, no proper callback name passed")
+ return
+ elseif not callbacktypes[name] then
+ err("unable to remove function, '%s' is not a valid callback", name)
+ return
+ end
+ if not description or description == "" then
+ err(
+ "unable to remove function from '%s', no proper description passed",
+ name)
+ return
+ end
+ local l = callbacklist[name]
+ if not l then
+ err("no callback list for '%s'",name)
+ return
+ end
+ for k,v in ipairs(l) do
+ if v.description == description then
+ table.remove(l,k)
+ log("removing function '%s' from '%s'",description,name)
+ if not next(l) then
+ callbacklist[name] = nil
+ if not lua_callbacks_defaults[name] then
+ internalregister(name, nil)
+ end
+ end
+ return
+ end
+ end
+ warning("unable to remove function '%s' from '%s'",description,name)
+end
+function reset_callback (name)
+ if not name or name == "" then
+ err("unable to reset, no proper callback name passed")
+ return
+ elseif not callbacktypes[name] then
+ err("reset error, '%s' is not a valid callback", name)
+ return
+ end
+ if not lua_callbacks_defaults[name] then
+ internalregister(name, nil)
+ end
+ local l = callbacklist[name]
+ if l then
+ log("resetting callback list '%s'",name)
+ callbacklist[name] = nil
+ end
+end
+function create_callback(name, ctype, default)
+ if not name then
+ err("unable to call callback, no proper name passed", name)
+ return nil
+ end
+ if not ctype or not default then
+ err("unable to create callback '%s': "
+ .."callbacktype or default function not specified", name)
+ return nil
+ end
+ if callbacktypes[name] then
+ err("unable to create callback '%s', callback already exists", name)
+ return nil
+ end
+ local temp = str_to_type(ctype)
+ if not temp then
+ err("unable to create callback '%s', type '%s' undefined", name, ctype)
+ return nil
+ end
+ ctype = temp
+ lua_callbacks_defaults[name] = default
+ callbacktypes[name] = ctype
+end
+function call_callback(name, ...)
+ if not name then
+ err("unable to call callback, no proper name passed", name)
+ return nil
+ end
+ if not lua_callbacks_defaults[name] then
+ err("unable to call lua callback '%s', unknown callback", name)
+ return nil
+ end
+ local l = callbacklist[name]
+ local f
+ if not l then
+ f = lua_callbacks_defaults[name]
+ else
+ if callbacktypes[name] == list then
+ f = listhandler(name)
+ elseif callbacktypes[name] == data then
+ f = datahandler(name)
+ elseif callbacktypes[name] == simple then
+ f = simplehandler(name)
+ elseif callbacktypes[name] == first then
+ f = firsthandler(name)
+ else
+ err("unknown callback type")
+ end
+ end
+ return f(...)
+end
+function priority_in_callback (name, description)
+ if not name or name == ""
+ or not callbacktypes[name]
+ or not description then
+ return 0
+ end
+ local l = callbacklist[name]
+ if not l then return 0 end
+ for p, f in pairs(l) do
+ if f.description == description then
+ return p
+ end
+ end
+ return 0
+end
+callback.register = function ()
+err("function callback.register has been deleted by luamcallbacks, "
+.."please use callback.add instead.")
+end
+--
+-- 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
new file mode 100644
index 00000000000..5abf32c2a3b
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexbase/modutils.lua
@@ -0,0 +1,115 @@
+--
+-- This is file `modutils.lua',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- luatexbase-modutils.dtx (with options: `luamodule')
+--
+-- Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
+--
+-- This work is under the CC0 license.
+-- See source file 'luatexbase-modutils.dtx' for details.
+--
+module("luatexbase", package.seeall)
+local modules = modules or {}
+local requiredversions = {}
+local function datetonumber(date)
+ numbers = string.gsub(date, "(%d+)/(%d+)/(%d+)", "%1%2%3")
+ return tonumber(numbers)
+end
+local function isdate(date)
+ for _, _ in string.gmatch(date, "%d+/%d+/%d+") do
+ return true
+ end
+ return false
+end
+local date, number = 1, 2
+local function parse_version(version)
+ if isdate(version) then
+ return {type = date, version = datetonumber(version), orig = version}
+ else
+ return {type = number, version = tonumber(version), orig = version}
+ end
+end
+local function module_error_int(mod, ...)
+ error('Module '..mod..' error: '..string.format(...), 3)
+end
+function module_error(mod, ...)
+ module_error_int(mod, ...)
+end
+function module_warning(mod, ...)
+ texio.write_nl("Module "..mod.." warning: "..string.format(...))
+end
+function module_info(mod, ...)
+ texio.write_nl(mod..": "..string.format(...))
+end
+function module_log(mod, ...)
+ texio.write_nl('log', mod..": "..string.format(...))
+end
+function module_term(mod, ...)
+ texio.write_nl('term', mod..": "..string.format(...))
+end
+local function err(...) module_error_int('luatexbase.modutils', ...) end
+local function warn(...) module_warning('luatexbase.modutils', ...) end
+function use_module(name)
+ require(name)
+ if not modules[name] then
+ warn("Module didn't properly identified itself: %s", name)
+ end
+end
+function require_module(name, version)
+ if not version then
+ return use_module(name)
+ end
+ luaversion = parse_version(version)
+ if modules[name] then
+ if luaversion.type == date then
+ if datetonumber(modules[name].date) < luaversion.version then
+ err("found module `%s' loaded in version %s, "
+ .."but version %s was required",
+ name, modules[name].date, version)
+ end
+ else
+ if modules[name].version < luaversion.version then
+ err("found module `%s' loaded in version %.02f, "
+ .."but version %s was required",
+ name, modules[name].version, version)
+ end
+ end
+ else
+ requiredversions[name] = luaversion
+ use_module(name)
+ end
+end
+function provides_module(mod)
+ if not mod then
+ err('cannot provide nil module')
+ return
+ end
+ if not mod.version or not mod.name or not mod.date
+ or not mod.description then
+ err("invalid module registered: "
+ .."fields name, version, date and description are mandatory")
+ return
+ end
+ requiredversion = requiredversions[mod.name]
+ if requiredversion then
+ if requiredversion.type == date
+ and requiredversion.version > datetonumber(mod.date) then
+ err("loading module %s in version %s, "
+ .."but version %s was required",
+ mod.name, mod.date, requiredversion.orig)
+ elseif requiredversion.type == number
+ and requiredversion.version > mod.version then
+ err("loading module %s in version %.02f, "
+ .."but version %s was required",
+ mod.name, mod.version, requiredversion.orig)
+ end
+ end
+ modules[mod.name] = module
+ texio.write_nl('log', string.format("Lua module: %s %s v%.02f %s\n",
+ mod.name, mod.date, mod.version, mod.description))
+end
+--
+-- End of File `modutils.lua'.