summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/luatex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/luatex')
-rw-r--r--Master/texmf-dist/source/luatex/luatextra/Makefile26
-rw-r--r--Master/texmf-dist/source/luatex/luatextra/luaextra.dtx1032
-rw-r--r--Master/texmf-dist/source/luatex/luatextra/luamcallbacks.dtx857
-rw-r--r--Master/texmf-dist/source/luatex/luatextra/luatextra-reference.tex8
-rw-r--r--Master/texmf-dist/source/luatex/luatextra/luatextra.dtx951
5 files changed, 92 insertions, 2782 deletions
diff --git a/Master/texmf-dist/source/luatex/luatextra/Makefile b/Master/texmf-dist/source/luatex/luatextra/Makefile
index 766e9756e20..50656034230 100644
--- a/Master/texmf-dist/source/luatex/luatextra/Makefile
+++ b/Master/texmf-dist/source/luatex/luatextra/Makefile
@@ -7,18 +7,15 @@ SRC_TEX = luatextra-reference.tex
DOC_TEX = $(patsubst %.tex, %.pdf, $(SRC_TEX))
# Files grouped by generation mode
-UNPACKED_EXTRA = luaextra.lua
-UNPACKED_MCB = luamcallbacks-test.tex luamcallbacks.lua
-UNPACKED_TEXTRA = luatextra-latex.tex luatextra.lua luatextra.sty
-UNPACKED = $(UNPACKED_EXTRA) $(UNPACKED_MCB) $(UNPACKED_TEXTRA)
-COMPILED = $(DOC_DTX) $(DOC_TEX)
+UNPACKED= luatextra-latex.tex luatextra.lua luatextra.sty
+COMPILED = $(DOC_DTX) $(DOC_TEX)
# $(DOC_TEX) has a compiled version in the repository
GENERATED = $(UNPACKED) $(DOC_DTX)
-SOURCE = $(DTX) $(SRC_TEX) README Makefile
+SOURCE = $(DTX) $(SRC_TEX) README Makefile News
# Files grouped by installation location
-RUNFILES = $(UNPACKED_EXTRA) $(UNPACKED_TEXTRA) luamcallbacks.lua
-DOCFILES = $(DOC_DTX) $(DOC_TEX) README luamcallbacks-test.tex
+RUNFILES = $(UNPACKED)
+DOCFILES = $(DOC_DTX) $(DOC_TEX) README News
SRCFILES = $(DTX) $(SRC_TEX) Makefile
# The following definitions should be equivalent
@@ -38,7 +35,7 @@ ZIPS = $(CTAN_ZIP) $(TDS_ZIP)
DO_TEX = tex --interaction=batchmode $< >/dev/null
DO_PDFLATEX = pdflatex --interaction=batchmode $< >/dev/null
-DO_PDFLUALATEX = pdflualatex --interaction=batchmode $< >/dev/null
+DO_PDFLUALATEX = lualatex --interaction=batchmode $< >/dev/null
DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) >/dev/null 2>&1
all: $(GENERATED) $(DOC_TEX)
@@ -47,6 +44,7 @@ unpack: $(UNPACKED)
ctan: $(CTAN_ZIP)
tds: $(TDS_ZIP)
world: all ctan
+.PHONY: all doc unpack ctan tds world
%.pdf: %.dtx
$(DO_PDFLATEX)
@@ -59,13 +57,7 @@ $(DOC_TEX): $(SRC_TEX)
$(DO_PDFLUALATEX)
$(DO_PDFLUALATEX)
-$(UNPACKED_TEXTRA): luatextra.dtx
- $(DO_TEX)
-
-$(UNPACKED_EXTRA): luaextra.dtx
- $(DO_TEX)
-
-$(UNPACKED_MCB): luamcallbacks.dtx
+$(UNPACKED): luatextra.dtx
$(DO_TEX)
$(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP)
@@ -101,7 +93,7 @@ manifest:
@for f in $(GENERATED); do echo $$f; done
clean:
- @$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg
+ @$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg *.out
mrproper: clean
@$(RM) -- $(GENERATED) $(ZIPS)
diff --git a/Master/texmf-dist/source/luatex/luatextra/luaextra.dtx b/Master/texmf-dist/source/luatex/luatextra/luaextra.dtx
deleted file mode 100644
index 51b2835c403..00000000000
--- a/Master/texmf-dist/source/luatex/luatextra/luaextra.dtx
+++ /dev/null
@@ -1,1032 +0,0 @@
-% \iffalse meta-comment
-%
-% Copyright (C) 2009 by PRAGMA ADE / ConTeXt Development Team
-%
-% See ConTeXt's mreadme.pdf for the license.
-%
-% This work consists of the main source file luaextra.dtx
-% and the derived file luaextra.lua.
-%
-% Unpacking:
-% tex luatextra.dtx
-%
-% Documentation:
-% pdftex luaextra.dtx
-%
-% The class ltxdoc loads the configuration file ltxdoc.cfg
-% if available. Here you can specify further options, e.g.
-% use A4 as paper format:
-% \PassOptionsToClass{a4paper}{article}
-%
-%
-%
-%<*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
-\Msg{************************************************************************}
-\Msg{* Installation}
-\Msg{* Package: luaextra 2009/04/15 v0.91 Lua additional functions.}
-\Msg{************************************************************************}
-
-\keepsilent
-\askforoverwritefalse
-
-\let\MetaPrefix\relax
-
-\preamble
-This is a generated file.
-
-Copyright (C) 2009 by PRAGMA ADE / ConTeXt Development Team
-
-See ConTeXt's mreadme.pdf for the license.
-
-This work consists of the main source file luaextra.dtx
-and the derived file luaextra.lua.
-
-\endpreamble
-
-% The following hacks are to generate a lua file with lua comments starting by
-% -- instead of %%
-
-\def\MetaPrefix{-- }
-
-\def\luapostamble{%
- \MetaPrefix^^J%
- \MetaPrefix\space End of File `\outFileName'.%
-}
-
-\def\currentpostamble{\luapostamble}%
-
-\generate{%
- \usedir{tex/luatex/luatextra}%
- \file{luaextra.lua}{\from{luaextra.dtx}{lua}}%
-}
-
-\obeyspaces
-\Msg{************************************************************************}
-\Msg{*}
-\Msg{* To finish the installation you have to move the following}
-\Msg{* files into a directory searched by TeX:}
-\Msg{*}
-\Msg{* luaextra.lua}
-\Msg{*}
-\Msg{* Happy TeXing!}
-\Msg{*}
-\Msg{************************************************************************}
-
-\endbatchfile
-%</install>
-%<*ignore>
-\fi
-%</ignore>
-%<*driver>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{luaextra.drv}
- [2009/04/15 v0.91 Lua additional functions.]
-\documentclass{ltxdoc}
-\EnableCrossrefs
-\CodelineIndex
-\begin{document}
- \DocInput{luaextra.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 \~}
-%
-% \GetFileInfo{luaextra.drv}
-%
-% \title{The \textsf{luaextra} package}
-% \date{2009/04/15 v0.91}
-% \author{Elie Roux \\ \texttt{elie.roux@telecom-bretagne.eu}}
-%
-% \maketitle
-%
-% \begin{abstract}
-% Additional lua functions taken from the libs of Con\TeX t. For an
-% introduction on this package (among others), please refer to the document
-% \texttt{luatex-reference.pdf}.
-% \end{abstract}
-%
-% \section{Overview}
-%
-% Lua is a very minimal language, and it does not have a lot of built-in
-% functions. Some functions will certainly be needed by a lot of packages.
-% Instead of making each of them implement these functions, the aim of this
-% file is to provide a minimal set of functions. All functions are taken from
-% Con\TeX t libraries.
-%
-% There are some differences with the Con\TeX t funtions though, especially on
-% names: for example the \texttt{file.*} funtions are renamed in
-% \texttt{fpath.*}. It seems more logical as they deal with file paths, not
-% files. Also the \texttt{file.is\_readable} and \texttt{file.is\_writable}
-% are renamed \texttt{lfs.is\_readable} and \texttt{lfs.is\_writable}.
-%
-% If you use a function you think is missing in this file, please tell the
-% maintainer.
-%
-% \texttt{Warning:} Even if the names will certainly remain the same, some
-% implementations may differ, and some functions might appear or dissapear. As
-% Lua\TeX\ is not stable, this file is not neither.
-%
-% All functions are described in this document, but the one of the functions
-% you'll use most will certainly be \texttt{table.serialize} (also named
-% \texttt{table.tostring}) that takes a table and returns an intented string
-% describing the table. It describes the table so that Lua\TeX\ can read it
-% again as a table. You can do a lot of things with this functions, like
-% printing a table for debugging, or saving a table into a file. Functions are
-% also converted into bytecode to be saved.
-%
-% \section{\texttt{luaextra.lua}}
-%
-% \iffalse
-%<*lua>
-% \fi
-%
-% \begin{macrocode}
-do
- local luatextra_module = {
- name = "luaextra",
- version = 0.91,
- date = "2009/04/15",
- description = "Lua additional functions.",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "See ConTeXt's mreadme.pdf for the license",
- }
-
- luatextra.provides_module(luatextra_module)
-end
-% \end{macrocode}
-%
-% \begin{macro}{string:stripspaces}
-%
-% A function to strip the spaces at the beginning and at the end of a
-% string.
-%
-% \begin{macrocode}
-
-function string:stripspaces()
- return (self:gsub("^%s*(.-)%s*$", "%1"))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{string.is boolean}
-%
-% If the argument is a string describing a boolean, this function returns
-% the boolean, otherwise it retuns nil.
-%
-% \begin{macrocode}
-
-function string.is_boolean(str)
- if type(str) == "string" then
- if str == "true" or str == "yes" or str == "on" or str == "t" then
- return true
- elseif str == "false" or str == "no" or str == "off" or str == "f" then
- return false
- end
- end
- return nil
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{string.is number}
-%
-% Returns true if the argument string is a number.
-%
-% \begin{macrocode}
-
-function string.is_number(str)
- return str:find("^[%-%+]?[%d]-%.?[%d+]$") == 1
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{lpeg.space and lpeg.newline}
-%
-% Two small helpers for \texttt{lpeg}, that will certainly be widely used:
-% spaces and newlines.
-%
-% \begin{macrocode}
-
-lpeg.space = lpeg.S(" \t\f\v")
-lpeg.newline = lpeg.P("\r\n") + lpeg.P("\r") +lpeg.P("\n")
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.fastcopy}
-%
-% A function copying a table fastly.
-%
-% \begin{macrocode}
-
-if not table.fastcopy then do
-
- local type, pairs, getmetatable, setmetatable =
- type, pairs, getmetatable, setmetatable
-
- local function fastcopy(old) -- fast one
- if old then
- local new = { }
- for k,v in pairs(old) do
- if type(v) == "table" then
- new[k] = fastcopy(v) -- was just table.copy
- else
- new[k] = v
- end
- end
- local mt = getmetatable(old)
- if mt then
- setmetatable(new,mt)
- end
- return new
- else
- return { }
- end
- end
-
- table.fastcopy = fastcopy
-
-end end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.copy}
-%
-% A function copying a table in more cases than fastcopy, for example when
-% a key is a table.
-%
-% \begin{macrocode}
-
-if not table.copy then do
-
- local type, pairs, getmetatable, setmetatable = type, pairs, getmetatable, setmetatable
-
- local function copy(t, tables) -- taken from lua wiki, slightly adapted
- tables = tables or { }
- local tcopy = {}
- if not tables[t] then
- tables[t] = tcopy
- end
- for i,v in pairs(t) do -- brrr, what happens with sparse indexed
- if type(i) == "table" then
- if tables[i] then
- i = tables[i]
- else
- i = copy(i, tables)
- end
- end
- if type(v) ~= "table" then
- tcopy[i] = v
- elseif tables[v] then
- tcopy[i] = tables[v]
- else
- tcopy[i] = copy(v, tables)
- end
- end
- local mt = getmetatable(t)
- if mt then
- setmetatable(tcopy,mt)
- end
- return tcopy
- end
-
- table.copy = copy
-
-end end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.serialize}
-%
-% A bunch of functions leading to \texttt{table.serialize}.
-%
-% \begin{macrocode}
-
-function table.sortedkeys(tab)
- local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed
- for key,_ in pairs(tab) do
- srt[#srt+1] = key
- if kind == 3 then
- -- no further check
- else
- local tkey = type(key)
- if tkey == "string" then
- -- if kind == 2 then kind = 3 else kind = 1 end
- kind = (kind == 2 and 3) or 1
- elseif tkey == "number" then
- -- if kind == 1 then kind = 3 else kind = 2 end
- kind = (kind == 1 and 3) or 2
- else
- kind = 3
- end
- end
- end
- if kind == 0 or kind == 3 then
- table.sort(srt,function(a,b) return (tostring(a) < tostring(b)) end)
- else
- table.sort(srt)
- end
- return srt
-end
-
-do
- table.serialize_functions = true
- table.serialize_compact = true
- table.serialize_inline = true
-
- local function key(k)
- if type(k) == "number" then -- or k:find("^%d+$") then
- return "["..k.."]"
- elseif noquotes and k:find("^%a[%a%d%_]*$") then
- return k
- else
- return '["'..k..'"]'
- end
- end
-
- local function simple_table(t)
- if #t > 0 then
- local n = 0
- for _,v in pairs(t) do
- n = n + 1
- end
- if n == #t then
- local tt = { }
- for i=1,#t do
- local v = t[i]
- local tv = type(v)
- if tv == "number" or tv == "boolean" then
- tt[#tt+1] = tostring(v)
- elseif tv == "string" then
- tt[#tt+1] = ("%q"):format(v)
- else
- tt = nil
- break
- end
- end
- return tt
- end
- end
- return nil
- end
-
- local function serialize(root,name,handle,depth,level,reduce,noquotes,indexed)
- handle = handle or print
- reduce = reduce or false
- if depth then
- depth = depth .. " "
- if indexed then
- handle(("%s{"):format(depth))
- else
- handle(("%s%s={"):format(depth,key(name)))
- end
- else
- depth = ""
- local tname = type(name)
- if tname == "string" then
- if name == "return" then
- handle("return {")
- else
- handle(name .. "={")
- end
- elseif tname == "number" then
- handle("[" .. name .. "]={")
- elseif tname == "boolean" then
- if name then
- handle("return {")
- else
- handle("{")
- end
- else
- handle("t={")
- end
- end
- if root and next(root) then
- local compact = table.serialize_compact
- local inline = compact and table.serialize_inline
- local first, last = nil, 0 -- #root cannot be trusted here
- if compact then
- for k,v in ipairs(root) do -- NOT: for k=1,#root do (why)
- if not first then first = k end
- last = last + 1
- end
- end
- for _,k in pairs(table.sortedkeys(root)) do
- local v = root[k]
- local t = type(v)
- if compact and first and type(k) == "number" and k >= first and k <= last then
- if t == "number" then
- handle(("%s %s,"):format(depth,v))
- elseif t == "string" then
- if reduce and (v:find("^[%-%+]?[%d]-%.?[%d+]$") == 1) then
- handle(("%s %s,"):format(depth,v))
- else
- handle(("%s %q,"):format(depth,v))
- end
- elseif t == "table" then
- if not next(v) then
- handle(("%s {},"):format(depth))
- elseif inline then
- local st = simple_table(v)
- if st then
- handle(("%s { %s },"):format(depth,table.concat(st,", ")))
- else
- serialize(v,k,handle,depth,level+1,reduce,noquotes,true)
- end
- else
- serialize(v,k,handle,depth,level+1,reduce,noquotes,true)
- end
- elseif t == "boolean" then
- handle(("%s %s,"):format(depth,tostring(v)))
- elseif t == "function" then
- if table.serialize_functions then
- handle(('%s loadstring(%q),'):format(depth,string.dump(v)))
- else
- handle(('%s "function",'):format(depth))
- end
- else
- handle(("%s %q,"):format(depth,tostring(v)))
- end
- elseif k == "__p__" then -- parent
- if false then
- handle(("%s __p__=nil,"):format(depth))
- end
- elseif t == "number" then
- handle(("%s %s=%s,"):format(depth,key(k),v))
- elseif t == "string" then
- if reduce and (v:find("^[%-%+]?[%d]-%.?[%d+]$") == 1) then
- handle(("%s %s=%s,"):format(depth,key(k),v))
- else
- handle(("%s %s=%q,"):format(depth,key(k),v))
- end
- elseif t == "table" then
- if not next(v) then
- handle(("%s %s={},"):format(depth,key(k)))
- elseif inline then
- local st = simple_table(v)
- if st then
- handle(("%s %s={ %s },"):format(depth,key(k),table.concat(st,", ")))
- else
- serialize(v,k,handle,depth,level+1,reduce,noquotes)
- end
- else
- serialize(v,k,handle,depth,level+1,reduce,noquotes)
- end
- elseif t == "boolean" then
- handle(("%s %s=%s,"):format(depth,key(k),tostring(v)))
- elseif t == "function" then
- if table.serialize_functions then
- handle(('%s %s=loadstring(%q),'):format(depth,key(k),string.dump(v)))
- else
- handle(('%s %s="function",'):format(depth,key(k)))
- end
- else
- handle(("%s %s=%q,"):format(depth,key(k),tostring(v)))
- -- handle(('%s %s=loadstring(%q),'):format(depth,key(k),string.dump(function() return v end)))
- end
- end
- if level > 0 then
- handle(("%s},"):format(depth))
- else
- handle(("%s}"):format(depth))
- end
- else
- handle(("%s}"):format(depth))
- end
- end
-
- function table.serialize(root,name,reduce,noquotes)
- local t = { }
- local function flush(s)
- t[#t+1] = s
- end
- serialize(root, name, flush, nil, 0, reduce, noquotes)
- return table.concat(t,"\n")
- end
-
- function table.tostring(t, name)
- return table.serialize(t, name)
- end
-
- function table.tohandle(handle,root,name,reduce,noquotes)
- serialize(root, name, handle, nil, 0, reduce, noquotes)
- end
-
- -- sometimes tables are real use (zapfino extra pro is some 85M) in which
- -- case a stepwise serialization is nice; actually, we could consider:
- --
- -- for line in table.serializer(root,name,reduce,noquotes) do
- -- ...(line)
- -- end
- --
- -- so this is on the todo list
-
- table.tofile_maxtab = 2*1024
-
- function table.tofile(filename,root,name,reduce,noquotes)
- local f = io.open(filename,'w')
- if f then
- local concat = table.concat
- local maxtab = table.tofile_maxtab
- if maxtab > 1 then
- local t = { }
- local function flush(s)
- t[#t+1] = s
- if #t > maxtab then
- f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice
- t = { }
- end
- end
- serialize(root, name, flush, nil, 0, reduce, noquotes)
- f:write(concat(t,"\n"),"\n")
- else
- local function flush(s)
- f:write(s,"\n")
- end
- serialize(root, name, flush, nil, 0, reduce, noquotes)
- end
- f:close()
- end
- end
-
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.tohash}
-%
-% Returning a table with all values of the argument table as keys, and
-% \texttt{false} as values. This is what we will call a hash.
-%
-% \begin{macrocode}
-
-function table.tohash(t)
- local h = { }
- for _, v in pairs(t) do -- no ipairs here
- h[v] = true
- end
- return h
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.fromhash}
-%
-% Returning a table built from a hash, with simple integer keys.
-%
-% \begin{macrocode}
-
-function table.fromhash(t)
- local h = { }
- for k, v in pairs(t) do -- no ipairs here
- if v then h[#h+1] = k end
- end
- return h
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.contains value}
-%
-% A function returning true if the value \texttt{val} is in the table
-% \texttt{t}.
-%
-% \begin{macrocode}
-
-function table.contains_value(t, val)
- if t then
- for k, v in pairs(t) do
- if v==val then
- return true
- end
- end
- end
- return false
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.contains key}
-%
-% A function returning true if the key \texttt{key} is in the table
-% \texttt{t}
-%
-% \begin{macrocode}
-
-function table.contains_key(t, key)
- if t then
- for k, v in pairs(t) do
- if k==key then
- return true
- end
- end
- end
- return false
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.value position}
-%
-% A function returning the position of a value in a table. This will be
-% important to be able to remove a value.
-%
-% \begin{macrocode}
-
-function table.value_position(t, val)
- if t then
- local i=1
- for k, v in pairs(t) do
- if v==val then
- return i
- end
- i=i+1
- end
- end
- return 0
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.key position}
-%
-% A function returning the position of a key in a table.
-%
-% \begin{macrocode}
-
-function table.key_position(t, key)
- if t then
- local i=1
- for k,v in pairs(t) do
- if k==key then
- return i
- end
- i = i+1
- end
- end
- return -1
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.remove value}
-%
-% Removes the first occurence of a value from a table.
-%
-% \begin{macrocode}
-
-function table.remove_value(t, v)
- local p = table.value_position(t,v)
- if p ~= -1 then
- table.remove(t, table.value_position(t,v))
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.remove key}
-%
-% Removing a key from a table.
-%
-% \begin{macrocode}
-
-function table.remove_key(t, k)
- local p = table.key_position(t,k)
- if p ~= -1 then
- table.remove(t, table.key_position(t,k))
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{table.is empty}
-%
-% Returns true if a table is empty.
-%
-% \begin{macrocode}
-
-function table.is_empty(t)
- return not t or not next(t)
-end
-
-% \end{macrocode}
-%
-% \texttt{fpath} will contain all the file path manipulation functions.
-% Some functions certainly need a little update or cleanup...
-%
-% \begin{macrocode}
-
-fpath = { }
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.removesuffix}
-%
-% A function to remove the suffix (extention) of a filename.
-%
-% \begin{macrocode}
-
-function fpath.removesuffix(filename)
- return filename:gsub("%.[%a%d]+$", "")
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.addsuffix}
-%
-% A function adding a suffix to a filename, except if it already has one.
-%
-% \begin{macrocode}
-
-function fpath.addsuffix(filename, suffix)
- if not filename:find("%.[%a%d]+$") then
- return filename .. "." .. suffix
- else
- return filename
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.replacesuffix}
-%
-% A function replacing a suffix by a new one.
-%
-% \begin{macrocode}
-
-function fpath.replacesuffix(filename, suffix)
- if not filename:find("%.[%a%d]+$") then
- return filename .. "." .. suffix
- else
- return (filename:gsub("%.[%a%d]+$","."..suffix))
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.dirname}
-%
-% A function returning the directory of a file path.
-%
-% \begin{macrocode}
-
-function fpath.dirname(name)
- return name:match("^(.+)[/\\].-$") or ""
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.basename}
-%
-% A function returning the basename (the name of the file, without the directories) of a file path.
-%
-% \begin{macrocode}
-
-function fpath.basename(fname)
- if not fname then
- return nil
- end
- return fname:match("^.+[/\\](.-)$") or fname
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.nameonly}
-%
-% Returning the basename of a file without the suffix.
-%
-% \begin{macrocode}
-
-function fpath.nameonly(name)
- return ((name:match("^.+[/\\](.-)$") or name):gsub("%..*$",""))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.suffix}
-%
-% Returns the suffix of a file name.
-%
-% \begin{macrocode}
-
-function fpath.suffix(name)
- return name:match("^.+%.([^/\\]-)$") or ""
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.join}
-%
-% A function joining any number of arguments into a complete path.
-%
-% \begin{macrocode}
-
-function fpath.join(...)
- local pth = table.concat({...},"/")
- pth = pth:gsub("\\","/")
- local a, b = pth:match("^(.*://)(.*)$")
- if a and b then
- return a .. b:gsub("//+","/")
- end
- a, b = pth:match("^(//)(.*)$")
- if a and b then
- return a .. b:gsub("//+","/")
- end
- return (pth:gsub("//+","/"))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.split}
-%
-% A function returning a table with all directories from a filename.
-%
-% \begin{macrocode}
-
-function fpath.split(str)
- local t = { }
- str = str:gsub("\\", "/")
- str = str:gsub("(%a):([;/])", "%1\001%2")
- for name in str:gmatch("([^;:]+)") do
- if name ~= "" then
- name = name:gsub("\001",":")
- t[#t+1] = name
- end
- end
- return t
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.normalize sep}
-%
-% A function to change directory separators to canonical ones (\texttt{/}).
-%
-% \begin{macrocode}
-
-function fpath.normalize_sep(str)
- return str:gsub("\\", "/")
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{fpath.localize sep}
-%
-% A function changing directory separators into local ones (\texttt{/} on
-% Unix, |\| on Windows).
-%
-% \begin{macrocode}
-
-function fpath.localize_sep(str)
- if os.type == 'windows' or type == 'msdos' then
- return str:gsub("/", "\\")
- else
- return str:gsub("\\", "/")
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{lfs.is writable}
-%
-% Returns true if a file is writable. This function and the following ones
-% are a bit too expensive, they should be made with |lfs.attributes|.
-%
-% \begin{macrocode}
-
-function lfs.is_writable(name)
- local f = io.open(name, 'w')
- if f then
- f:close()
- return true
- else
- return false
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{lfs.is readable}
-%
-% Returns true if a file is readable.
-%
-% \begin{macrocode}
-
-function lfs.is_readable(name)
- local f = io.open(name,'r')
- if f then
- f:close()
- return true
- else
- return false
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{math.round}
-%
-% Returns the closest integer.
-%
-% \begin{macrocode}
-
-if not math.round then
- function math.round(x)
- return math.floor(x + 0.5)
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{math.div}
-%
-% Returns the quotient of the euclidian division of n by m.
-%
-% \begin{macrocode}
-
-if not math.div then
- function math.div(n,m)
- return floor(n/m)
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-% \begin{macro}{math.mod}
-%
-% Returns the remainder of the euclidian division of n by m.
-%
-% \begin{macrocode}
-
-if not math.mod then
- function math.mod(n,m)
- return n % m
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \iffalse
-%</lua>
-% \fi
-% \Finale
-\endinput
diff --git a/Master/texmf-dist/source/luatex/luatextra/luamcallbacks.dtx b/Master/texmf-dist/source/luatex/luatextra/luamcallbacks.dtx
deleted file mode 100644
index c23a1980139..00000000000
--- a/Master/texmf-dist/source/luatex/luatextra/luamcallbacks.dtx
+++ /dev/null
@@ -1,857 +0,0 @@
-% \iffalse meta-comment
-%
-% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>
-%
-% This work is under the CC0 license.
-%
-% This work consists of the main source file luamcallbacks.dtx
-% and the derived files
-% luamcallbacks.sty, luamcallbacks.tex, luamcallbacks.lua
-% luamcallbacks-test.tex, luamcallbacks.pdf.
-%
-% Unpacking:
-% tex luamcallbacks.dtx
-% Documentation:
-% pdflatex luamcallbacks.dtx
-%
-% The class ltxdoc loads the configuration file ltxdoc.cfg
-% if available. Here you can specify further options, e.g.
-% use A4 as paper format:
-% \PassOptionsToClass{a4paper}{article}
-%
-%<*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
-\Msg{************************************************************************}
-\Msg{* Installation}
-\Msg{* Package: luamcallbacks 2009/09/18 v0.93 LuaTeX multiple callbacks.}
-\Msg{************************************************************************}
-
-\keepsilent
-\askforoverwritefalse
-
-\let\MetaPrefix\relax
-
-\preamble
-This is a generated file.
-
-Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>
-
-This work is under the CC0 license.
-
-This work consists of the main source file luamcallbacks.dtx
-and the derived files
- luamcallbacks.lua, luamcallbacks-test.tex, luamcallbacks.pdf.
-
-\endpreamble
-
-\let\MetaPrefix\DoubleperCent
-
-\generate{%
- \usedir{doc/luatex/luatextra}%
- \file{luamcallbacks-test.tex}{\from{luamcallbacks.dtx}{test}}%
-}
-
-% The following hacks are to generate a lua file with lua comments starting by
-% -- instead of %%
-
-\def\MetaPrefix{-- }
-
-\def\luapostamble{%
- \MetaPrefix^^J%
- \MetaPrefix\space End of File `\outFileName'.%
-}
-
-\def\currentpostamble{\luapostamble}%
-
-\generate{%
- \usedir{tex/luatex/luatextra}%
- \file{luamcallbacks.lua}{\from{luamcallbacks.dtx}{lua}}%
-}
-
-\obeyspaces
-\Msg{************************************************************************}
-\Msg{*}
-\Msg{* To finish the installation you have to move the following}
-\Msg{* files into a directory searched by TeX:}
-\Msg{*}
-\Msg{* luamcallbacks.lua}
-\Msg{*}
-\Msg{* Happy TeXing!}
-\Msg{*}
-\Msg{************************************************************************}
-
-\endbatchfile
-%</install>
-%<*ignore>
-\fi
-%</ignore>
-%<*driver>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{luamcallbacks.drv}
- [2009/09/18 v0.93 LuaTeX multiple callbacks package]
-\documentclass{ltxdoc}
-\EnableCrossrefs
-\CodelineIndex
-\begin{document}
- \DocInput{luamcallbacks.dtx}%
-\end{document}
-%</driver>
-% \fi
-%
-% \CheckSum{5}
-%
-% \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 \~}
-%
-% \GetFileInfo{luamcallbacks.drv}
-%
-% \title{The \textsf{luamcallbacks} package}
-% \date{2009/09/18 v0.93}
-% \author{Elie Roux \\ \texttt{elie.roux@telecom-bretagne.eu}}
-%
-% \maketitle
-%
-% \begin{abstract}
-% This package manages the callback adding and removing, by adding
-% \texttt{callback.add} and \texttt{callback.remove}, and overwriting
-% \texttt{callback.register}. It also allows to create and call new callbacks.
-% For an introduction on this package (among others), please refer to the
-% document \texttt{luatextra-reference.pdf}.
-% \end{abstract}
-%
-% \section{Documentation}
-%
-% Lua\TeX\ 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 likes, puts vertical spaces, etc.
-% The Lua\TeX\ core offers a function called \texttt{callback.register} that
-% enables to register a function in a callback.
-%
-% The problem with \texttt{callback.register} is that is registers only one
-% function in a callback. For a lot of callbacks it can be common to have
-% several packages registering their function in a callback, and thus it is
-% impossible with them to be compatible with each other.
-%
-% This package solves this problem by adding mainly one new function
-% \texttt{callback.\\add} that adds a function in a callback. With this
-% function it is possible for packages to register their function in a
-% callback without overwriting the functions of the other packages.
-%
-% The functions are called in a certain order, and when a package registers a
-% callback it can assign a priority to its function. Conflicts can still
-% remain even with the priority mechanism, for example in the case where two
-% packages want to have the highest priority. In these cases the packages have
-% to solve the conflicts themselves.
-%
-% This package also privides a way to create and call new callbacks, in
-% addition to the default Lua\TeX\ callbacks.
-%
-% This package contains only a \texttt{.lua} file, that can be called by
-% another lua script. For example, this script is called in
-% \textsf{luatextra}.
-%
-%\subsubsection*{Limitations}
-%
-% This package only works for callbacks where it's safe to add multiple
-% functions without changing the functions' signatures. There are callbacks,
-% though, where registering several functions is not possible without changing
-% the function's signatures, like for example the readers callbacks. These
-% callbacks take a filename and give the datas in it. One solution would be to
-% change the functions' signature to open it when the function is the first,
-% and to take the datas and modify them eventually if they are called after
-% the first. But it seems rather fragile and useless, so it's not implemented.
-% With these callbacks, in this package we simply execute the first function
-% in the list.
-%
-% Other callbacks in this case are \texttt{define\_font} and
-% \texttt{open\_read\_file}. There is though a solution for several packages
-% to use these callbacks, see the implementation of \texttt{luatextra}.
-%
-% \StopEventually{
-% }
-%
-% \section{Package code}
-%
-% \iffalse
-%<*lua>
-% \fi
-%
-% The package contains \texttt{luamcallbacks.lua} with the new functions,
-% and an example of the use of luamcallbacks.
-%
-% First the \texttt{luamcallbacks} module is registered as a Lua\TeX\
-% module, with some informations.
-%
-% \begin{macrocode}
-
-luamcallbacks = { }
-
-luamcallbacks.module = {
- name = "luamcallbacks",
- version = 0.93,
- date = "2009/09/18",
- description = "Module to register several functions in a callback.",
- author = "Hans Hagen & Elie Roux",
- copyright = "Hans Hagen & Elie Roux",
- license = "CC0",
-}
-
-luatextra.provides_module(luamcallbacks.module)
-
-% \end{macrocode}
-%
-% \texttt{callbacklist} is the main list, that contains the callbacks as
-% keys and a table of the registered functions a values.
-%
-% \begin{macrocode}
-
-luamcallbacks.callbacklist = luamcallbacks.callbacklist or { }
-
-% \end{macrocode}
-%
-% A table with the default functions of the created callbacks. See
-% \texttt{luamcallbacks.create} for further informations.
-%
-% \begin{macrocode}
-
-luamcallbacks.lua_callbacks_defaults = { }
-
-local format = string.format
-
-% \end{macrocode}
-%
-% There are 4 types of callback:
-% \begin{itemize}
-% \item the ones taking a list of nodes and returning a boolean and
-% eventually a new head (\texttt{list})
-% \item the ones taking datas and returning the modified ones
-% (\texttt{data})
-% \item the ones that can't have multiple functions registered in them
-% (\texttt{first})
-% \item the ones for functions that don't return anything (\texttt{simple})
-% \end{itemize}
-%
-% \begin{macrocode}
-
-local list = 1
-local data = 2
-local first = 3
-local simple = 4
-
-% \end{macrocode}
-%
-% \texttt{callbacktypes} is the list that contains the callbacks as keys
-% and the type (list or data) as values.
-%
-% \begin{macrocode}
-
-luamcallbacks.callbacktypes = luamcallbacks.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,
-}
-
-% \end{macrocode}
-%
-% In Lua\TeX\ version 0.43, a new callback called |process_output_buffer|
-% appeared, so we enable it.
-%
-% \begin{macrocode}
-
-if tex.luatexversion > 42 then
- luamcallbacks.callbacktypes["process_output_buffer"] = data
-end
-
-% \end{macrocode}
-%
-% As we overwrite \texttt{callback.register}, we save it as
-% \texttt{luamcallbacks.internalregister}. After that we declare some
-% functions to write the errors or the logs.
-%
-% \begin{macrocode}
-
-luamcallbacks.internalregister = luamcallbacks.internalregister or callback.register
-
-local callbacktypes = luamcallbacks.callbacktypes
-
-luamcallbacks.log = luamcallbacks.log or function(...)
- luatextra.module_log('luamcallbacks', format(...))
-end
-
-luamcallbacks.info = luamcallbacks.info or function(...)
- luatextra.module_info('luamcallbacks', format(...))
-end
-
-luamcallbacks.warning = luamcallbacks.warning or function(...)
- luatextra.module_warning('luamcallbacks', format(...))
-end
-
-luamcallbacks.error = luamcallbacks.error or function(...)
- luatextra.module_error('luamcallbacks', format(...))
-end
-
-% \end{macrocode}
-%
-% A simple function we'll use later to understand the arguments of the
-% \texttt{create} function. It takes a string and returns the type
-% corresponding to the string or nil.
-%
-% \begin{macrocode}
-
-function luamcallbacks.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
-
-% \end{macrocode}
-%
-% \begin{macro}{luamcallbacks.create}
-%
-% 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 luamcallbacks.create(name, ctype, default)
- if not name then
- luamcallbacks.error(format("unable to call callback, no proper name passed", name))
- return nil
- end
- if not ctype or not default then
- luamcallbacks.error(format("unable to create callback '%s', callbacktype or default function not specified", name))
- return nil
- end
- if callbacktypes[name] then
- luamcallbacks.error(format("unable to create callback '%s', callback already exists", name))
- return nil
- end
- local temp = luamcallbacks.str_to_type(ctype)
- if not temp then
- luamcallbacks.error(format("unable to create callback '%s', type '%s' undefined", name, ctype))
- return nil
- end
- ctype = temp
- luamcallbacks.lua_callbacks_defaults[name] = default
- callbacktypes[name] = ctype
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{luamcallbacks.call}
-%
-% This function calls a callback. It can only call a callback created by
-% the \texttt{create} function.
-%
-% \begin{macrocode}
-
-function luamcallbacks.call(name, ...)
- if not name then
- luamcallbacks.error(format("unable to call callback, no proper name passed", name))
- return nil
- end
- if not luamcallbacks.lua_callbacks_defaults[name] then
- luamcallbacks.error(format("unable to call lua callback '%s', unknown callback", name))
- return nil
- end
- local l = luamcallbacks.callbacklist[name]
- local f
- if not l then
- f = luamcallbacks.lua_callbacks_defaults[name]
- else
- if callbacktypes[name] == list then
- f = luamcallbacks.listhandler(name)
- elseif callbacktypes[name] == data then
- f = luamcallbacks.datahandler(name)
- elseif callbacktypes[name] == simple then
- f = luamcallbacks.simplehandler(name)
- elseif callbacktypes[name] == first then
- f = luamcallbacks.firsthandler(name)
- else
- luamcallbacks.error("unknown callback type")
- end
- end
- return f(...)
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{luamcallbacks.add}
-%
-% The main function. The signature is \texttt{luamcallbacks.add (name,
-% func, description, priority)} with \texttt{name} being the name of the
-% callback in which the function is added; \texttt{func} is the added
-% function; \texttt{description} is a small character string describing the
-% function, and \texttt{priority} an optional argument describing the
-% priority the function will have.
-%
-% The functions for a callbacks are added in a list (in
-% \texttt{luamcallbacks.callbacklist\\.callbackname}). If they have no
-% priority or a high priority number, they will be added at the end of the
-% list, and will be called after the others. If they have a low priority
-% number, the will be added at the beginning of the list and will be called
-% before the others.
-%
-% Something that must be made clear, is that there is absolutely no
-% solution for packages conflicts: if two packages want the top priority on
-% a certain callback, they will have to decide the priority they will give
-% to their function themself. Most of the time, the priority is not needed.
-%
-% \begin{macrocode}
-
-function luamcallbacks.add (name,func,description,priority)
- if type(func) ~= "function" then
- luamcallbacks.error("unable to add function, no proper function passed")
- return
- end
- if not name or name == "" then
- luamcallbacks.error("unable to add function, no proper callback name passed")
- return
- elseif not callbacktypes[name] then
- luamcallbacks.error(
- format("unable to add function, '%s' is not a valid callback",
- name))
- return
- end
- if not description or description == "" then
- luamcallbacks.error(
- format("unable to add function to '%s', no proper description passed",
- name))
- return
- end
- if luamcallbacks.get_priority(name, description) ~= 0 then
- luamcallbacks.warning(
- format("function '%s' already registered in callback '%s'",
- description, name))
- end
- local l = luamcallbacks.callbacklist[name]
- if not l then
- l = {}
- luamcallbacks.callbacklist[name] = l
- if not luamcallbacks.lua_callbacks_defaults[name] then
- if callbacktypes[name] == list then
- luamcallbacks.internalregister(name, luamcallbacks.listhandler(name))
- elseif callbacktypes[name] == data then
- luamcallbacks.internalregister(name, luamcallbacks.datahandler(name))
- elseif callbacktypes[name] == simple then
- luamcallbacks.internalregister(name, luamcallbacks.simplehandler(name))
- elseif callbacktypes[name] == first then
- luamcallbacks.internalregister(name, luamcallbacks.firsthandler(name))
- else
- luamcallbacks.error("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
- luamcallbacks.warning(format("several callbacks registered in callback '%s', only the first function will be active.", name))
- end
- table.insert(l,priority,f)
- luamcallbacks.log(
- format("inserting function '%s' at position %s in callback list for '%s'",
- description,priority,name))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{luamcallbacks.get priority}
-%
-% This function tells if a function has already been registered in a
-% callback, and gives its current priority. The arguments are the name of
-% the callback and the description of the function. If it has already been
-% registered, it gives its priority, and if not it returns false.
-%
-% \begin{macrocode}
-
-function luamcallbacks.get_priority (name, description)
- if not name or name == "" or not callbacktypes[name] or not description then
- return 0
- end
- local l = luamcallbacks.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
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{luamcallbacks.remove}
-%
-% The function that removes a function from a callback. The signature is
-% \texttt{mcallbacks.remove (name, description)} with \texttt{name} being
-% the name of callbacks, and description the description passed to
-% \texttt{mcallbacks.add}.
-%
-% \begin{macrocode}
-
-function luamcallbacks.remove (name, description)
- if not name or name == "" then
- luamcallbacks.error("unable to remove function, no proper callback name passed")
- return
- elseif not callbacktypes[name] then
- luamcallbacks.error(
- format("unable to remove function, '%s' is not a valid callback",
- name))
- return
- end
- if not description or description == "" then
- luamcallbacks.error(
- format("unable to remove function from '%s', no proper description passed",
- name))
- return
- end
- local l = luamcallbacks.callbacklist[name]
- if not l then
- luamcallbacks.error(format("no callback list for '%s'",name))
- return
- end
- for k,v in ipairs(l) do
- if v.description == description then
- table.remove(l,k)
- luamcallbacks.log(
- format("removing function '%s' from '%s'",description,name))
- if not next(l) then
- luamcallbacks.callbacklist[name] = nil
- if not luamcallbacks.lua_callbacks_defaults[name] then
- luamcallbacks.internalregister(name, nil)
- end
- end
- return
- end
- end
- luamcallbacks.warning(
- format("unable to remove function '%s' from '%s'",description,name))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{luamcallbacks.reset}
-%
-% This function removes all the functions registered in a callback.
-%
-% \begin{macrocode}
-
-function luamcallbacks.reset (name)
- if not name or name == "" then
- luamcallbacks.error("unable to reset, no proper callback name passed")
- return
- elseif not callbacktypes[name] then
- luamcallbacks.error(
- format("reset error, '%s' is not a valid callback",
- name))
- return
- end
- if not luamcallbacks.lua_callbacks_defaults[name] then
- luamcallbacks.internalregister(name, nil)
- end
- local l = luamcallbacks.callbacklist[name]
- if l then
- luamcallbacks.log(format("resetting callback list '%s'",name))
- luamcallbacks.callbacklist[name] = nil
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% This function and the following ones are only internal. This one is the
-% handler for the first type of callbacks: the ones that take a list head
-% and return true, false, or a new list head.
-%
-% \begin{macro}{luamcallbacks.listhandler}
-%
-% \begin{macrocode}
-
-function luamcallbacks.listhandler (name)
- return function(head,...)
- local l = luamcallbacks.callbacklist[name]
- if l then
- local done = true
- for _, f in ipairs(l) do
- -- the returned value can be 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
- luamcallbacks.error(format(
- "function \"%s\" returned false in callback '%s'",
- f.description, name))
- end
- end
- return head, done
- else
- return head, false
- end
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% The handler for callbacks taking datas and returning modified ones.
-%
-% \begin{macro}{luamcallbacks.datahandler}
-%
-% \begin{macrocode}
-
-function luamcallbacks.datahandler (name)
- return function(data,...)
- local l = luamcallbacks.callbacklist[name]
- if l then
- for _, f in ipairs(l) do
- data = f.func(data,...)
- end
- end
- return data
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% This function is for the handlers that don't support more than one
-% functions in them. In this case we only call the first function of the
-% list.
-%
-% \begin{macro}{luamcallbacks.firsthandler}
-%
-% \begin{macrocode}
-
-function luamcallbacks.firsthandler (name)
- return function(...)
- local l = luamcallbacks.callbacklist[name]
- if l then
- local f = l[1].func
- return f(...)
- else
- return nil, false
- end
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% Handler for simple functions that don't return anything.
-%
-% \begin{macro}{luamcallbacks.simplehandler}
-%
-% \begin{macrocode}
-
-function luamcallbacks.simplehandler (name)
- return function(...)
- local l = luamcallbacks.callbacklist[name]
- if l then
- for _, f in ipairs(l) do
- f.func(...)
- end
- end
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% Finally we add some functions to the \texttt{callback} module, and we
-% overwrite \texttt{callback.register} so that it outputs an error.
-%
-% \begin{macrocode}
-
-callback.add = luamcallbacks.add
-callback.remove = luamcallbacks.remove
-callback.reset = luamcallbacks.reset
-callback.create = luamcallbacks.create
-callback.call = luamcallbacks.call
-callback.get_priority = luamcallbacks.get_priority
-
-callback.register = function (...)
-luamcallbacks.error("function callback.register has been deleted by luamcallbacks, please use callback.add instead.")
-end
-
-% \end{macrocode}
-%
-% \iffalse
-%</lua>
-% \fi
-%
-% \iffalse
-%<*test>
-% \fi
-%
-% \section{Test file}
-%
-% The test file is made to run in plainTeX, but is trivial to adapt for
-% LaTeX. First we input the package, and we typeset a small sentence to
-% get a non-empty document.
-%
-% \begin{macrocode}
-\input luatextra.sty
-
-This is just a test file.
-% \end{macrocode}
-%
-% Then we declare three functions that we will use.
-%
-% \begin{macrocode}
-\luadirect{
-local function one(head,...)
- texio.write_nl("I'm number 1")
- return head, true
-end
-
-local function two(head,...)
- texio.write_nl("I'm number 2")
- return head, true
-end
-
-local function three(head,...)
- texio.write_nl("I'm number 3")
- return head, true
-end
-% \end{macrocode}
-%
-% Then we add the three functions to the hpack\_filter callback
-%
-% \begin{macrocode}
-callback.add("hpack_filter",one,"my example function one",1)
-callback.add("hpack_filter",two,"my example function two",2)
-callback.add("hpack_filter",three,"my example function three",1)
-% \end{macrocode}
-%
-% We remove the function three from the callback.
-%
-% \begin{macrocode}
-callback.remove("hpack_filter","my example function three")
-% \end{macrocode}
-%
-% And we remove a non-declared function to the callback, which will
-% generate an error.
-%
-% \begin{macrocode}
-}
-
-\bye
-% \end{macrocode}
-% \iffalse
-%</test>
-% \fi
-% \Finale
-\endinput
diff --git a/Master/texmf-dist/source/luatex/luatextra/luatextra-reference.tex b/Master/texmf-dist/source/luatex/luatextra/luatextra-reference.tex
index 3fe05478d84..30a1898197e 100644
--- a/Master/texmf-dist/source/luatex/luatextra/luatextra-reference.tex
+++ b/Master/texmf-dist/source/luatex/luatextra/luatextra-reference.tex
@@ -57,7 +57,8 @@
This document describes, from the user or developer point of view, how to use
the coherent set of packages \textsf{luatextra}, \textsf{luainputenc},
-\textsf{luaotfload}, \textsf{luamcallbacks} and \textsf{luaextra}.
+\textsf{luaotfload}, \textsf{luamcallbacks} and \textsf{lualibs} (previously
+\textsf{luaextra}.
If you are looking for documentation on the \LuaTeX\ engine, please refer to
the file \texttt{luatexref-t.pdf}, but note that using these packages will
@@ -188,7 +189,8 @@ The \LuaTeX tra coherent set of packages contains:
\item \textsf{luainputenc}: adaptation of \textsf{inputenc} to \LuaTeX
\item \textsf{luamcallbacks}: pure lua package to be able to register
several functions in a callback
- \item \textsf{luaextra}: additional lua functions
+ \item \textsf{lualibs}: additional lua functions (previously
+ \textsf{luaextra}).
\end{itemize}
\subsection{Overview}
@@ -404,7 +406,7 @@ Three other very useful new functions are provided:
Some extra functions have been added to the standard lua library, mostly
coming from the Con\TeX t libraries, for the complete list of functions,
-please refer to the documentation \texttt{luaextra.pdf}.
+please refer to the documentation \texttt{lualibs.pdf}.
The most useful of these added functions is certainly \texttt{table.serialize}
that returns the string describing a given table. This string can be used for
diff --git a/Master/texmf-dist/source/luatex/luatextra/luatextra.dtx b/Master/texmf-dist/source/luatex/luatextra/luatextra.dtx
index 77013873b65..47ea3950b71 100644
--- a/Master/texmf-dist/source/luatex/luatextra/luatextra.dtx
+++ b/Master/texmf-dist/source/luatex/luatextra/luatextra.dtx
@@ -4,7 +4,7 @@
%
% This work is under the CC0 license.
%
-% This work consists of the main source file luamcallbacks.dtx
+% This work consists of the main source file luatextra.dtx
% and the derived files
% luatextra.sty, luatextra.lua, luatextra-latex.tex, luatextra.pdf.
%
@@ -32,10 +32,6 @@
%</ignore>
%<*install>
\input docstrip.tex
-\Msg{************************************************************************}
-\Msg{* Installation}
-\Msg{* Package: luatextra 2009/12/16 v0.95 Extra low level functions for LuaTeX}
-\Msg{************************************************************************}
\keepsilent
\askforoverwritefalse
@@ -100,8 +96,8 @@ and the derived files
%</ignore>
%<*driver>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{luaminimalotf.drv}%
- [2009/12/16 v0.95 LuaTeX extra low-level macros.]%
+\ProvidesFile{luatextra.drv}%
+ [2010/05/10 v0.97 LuaTeX extra low-level macros.]%
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
@@ -132,113 +128,24 @@ and the derived files
% \GetFileInfo{luatextra.drv}
%
% \title{The \textsf{luatextra} package}
-% \date{2009/12/16 v0.95}
+% \date{2010/05/10 v0.97}
% \author{Elie Roux \\ \texttt{elie.roux@telecom-bretagne.eu}}
%
% \maketitle
%
% \begin{abstract}
-% \textsf{luatextra} provides low-level addition to the formats Plain and
-% \LaTeX\ to be used with the engine Lua\TeX.
-% \end{abstract}
-%
-% \tableofcontents
-%
-% \section{Documentation}
-%
-% \subsection{Preamble}
-%
% This document is made for people wanting to understand how the package was
% made. For an introduction to the use of Lua\TeX\ with the formats Plain and
% \LaTeX , please read the document \texttt{luatextra-reference.pdf} that you
% can find in your \TeX\ distribution (\TeX Live from version 2009) or on the
% CTAN.
%
-% \subsection{History of formats and engines}
-%
-% To understand this package, one must fist understand some historical choices
-% in the \TeX\ world.
-%
-% A \TeX\ engine is a binary executable that provides some very low-level
-% primitives, for example \texttt{\string\count} to set a counter to a certain
-% value. A \TeX\ format is a macro package that provides higher-level macros
-% for the user and the package developer, for example
-% \texttt{\string\newcount} that allocates a new counter and gives it a name.
-% Examples of engines are the old \TeX\ 82, $\varepsilon$-\TeX, pdf\TeX,
-% Omega/Aleph, Lua\TeX\ and Xe\TeX. Examples of formats are Plain, \LaTeX\ and
-% Con\TeX t.
-%
-% This distinction is hard to make as only one command is invoked, for example
-% when you call the command \texttt{tex}, you often have no idea that the
-% engine \TeX\ 82 is invoked with the format Plain.
-%
-% Evolution is also something confusing in the \TeX\ world: engines often
-% evolve, and new engines have always appeared, when most formats are frozen:
-% the Plain and \LaTeX\ formats do not accept any new code to cope with the
-% new engines. In theory, this package shouldn't exist, or at least shouldn't
-% be a package, but its code should be integrated into a format. But as Plain
-% and \LaTeX\ are frozen, people wanting to take advantage of the new engines
-% have to use a package.
-%
-% This package is really necessary to take advantage of Lua\TeX\ as it
-% provides things users are expecting a macro package to provide, for example
-% \texttt{\string\newluaattribute} that acts like \texttt{\string\newcount}
-% for lua attributes. It also enables all Lua\TeX\ primitives, that are
-% disabled by default.
-%
-% \subsection{choices made in this package}
-%
-% In the very long term, it is higly possible that Lua\TeX\ will replace
-% pdf\TeX\ as the default \LaTeX\ engine, so it is necessary to keep backward
-% compatibility. This lead us to the decision of renaming Lua\TeX -only
-% primitives so that they all start by \texttt{luatex}, like the pdf\TeX -only
-% primitives start by \texttt{pdf}. Thus attributes become luatexattributes,
-% etc. This % also allows primitives to keep having the same name, even if their
-% name is changed later at the engine level. Also some new functions like
-% \texttt{newluatexattribute} are provided with the \texttt{lua} prefix, to
-% shorten the already too long name.
-%
-% \subsection{registers allocation scheme}
-%
-% The default register allocation scheme of \LaTeX\ is old and limited (like
-% the one of \TeX 82) to 256 values. The engine $\varepsilon$-\TeX allows more
-% different registers (up to 32768), and Lua\TeX\ allows even 65536 ones.
-% These new limits were not acknowledged by \LaTeX . A package \textsf{etex}
-% was created for \LaTeX\ to extends the allocation scheme. \textsf{luatextra}
-% loads \textsf{etex}, and overrides somes values to extend the allocation max
-% number to 65536.
-%
-% \subsection{attributes}
-%
-% Attributes are a new concept in Lua\TeX\ (see the Lua\TeX\ documentation for
-% details). As the macro \texttt{\string\attribute} is certainly very common
-% in the user's documents, they are renamed \texttt{luaattribute}s. This
-% package provides a simple way to allocate new attributes, with the macro
-% \texttt{\string\newluaattribute}. For more informations about attribute
-% handling in lua, please read section \ref{sub:attr}.
-%
-% \subsection{Module system}
-%
-% Lua has some embedded module management, with the functions \texttt{module}
-% and \texttt{require}. With this package we try get more control on the
-% module system, by implementing something close to the \LaTeX 's
-% \texttt{\string\usepackage} and \texttt{\string\RequirePackage} macros: the
-% \texttt{\string\luatexUseModule} and \texttt{\string\luatexRequireModule} that act
-% like them, but for lua files. The functions \texttt{module} and
-% \texttt{require} should not be used, in profit of the lua functions
-% \texttt{luatextra.provides\_module} and \texttt{luatextra.use\_module} or
-% \texttt{luatextra.require\_module}.
-%
-% \subsection{Multiple callbacks handling}
-%
-% Lua\TeX\ has no way to register multiple functions in a callback. This
-% package loads \textsf{luamcallbacks} that provides a safe way to do so. But
-% the \textsf{luamcallbacks} package can't register several functions in some
-% callbacks, like \texttt{open\_read\_file} and \texttt{define\_font}. This
-% package takes advantage of the callback creation possibilities of
-% \textsf{luamcallbacks} to split these callbacks into several ones that can
-% agregate several functions. Thus it allows several packages to safely use
-% the callbacks. See section \ref{sub:orf} for more details.
+% \textbf{Warning.} This package is undergoing major changes, so the
+% documentation may sometimes be inconsistent. Also, be aware that everything
+% may change.
+% \end{abstract}
+%
+% \tableofcontents
%
% \section{\texttt{luatextra.lua}}
%
@@ -248,37 +155,11 @@ and the derived files
%<*lua>
% \fi
%
-% \TeX\ always prints the names of the files that are input. Unfortunatly
-% it can't do so with lua files called with \texttt{dofile}. We will fix it
-% with the \texttt{luatextra.use\_module} function, but in the meantime we
-% print this information for the \texttt{luatextra.lua} file.
-%
-% A change compared to usual filename printings is the fact that Lua\TeX\
-% does not print the \texttt{./} for files in the current directory. We
-% keep this convention for lua filename printings.
-%
-% \begin{macrocode}
-do
- local luatextrapath = kpse.find_file("luatextra.lua")
- if luatextrapath then
- if luatextrapath:sub(1,2) == "./" then
- luatextrapath = luatextrapath:sub(3)
- end
- texio.write_nl('('..luatextrapath)
- end
-end
-
-% \end{macrocode}
-%
% We create the \texttt{luatextra} table that will contain all the
% functions and variables, and we register it as a normal lua module.
%
% \begin{macrocode}
-
-luatextra = {}
-
module("luatextra", package.seeall)
-
% \end{macrocode}
%
% We initiate the modules table that will contain informations about the
@@ -288,396 +169,22 @@ module("luatextra", package.seeall)
% \texttt{luatextra.provides\_module} for more details.
%
% \begin{macrocode}
-
-luatextra.modules = {}
-
-luatextra.modules['luatextra'] = {
- version = 0.95,
+luatexbase.provides_module {
+ version = 0.97,
name = "luatextra",
- date = "2009/12/16",
+ date = "2010/05/10",
description = "Additional low level functions for LuaTeX",
- author = "Elie Roux",
- copyright = "Elie Roux, 2009",
+ author = "Elie Roux and Manuel Pegourie-Gonnard",
+ copyright = "Elie Roux, 2009 and Manuel Pegourie-Gonnard, 2010",
license = "CC0",
}
-
local format = string.format
-
-% \end{macrocode}
-%
-% Here we define the warning and error functions specific to
-% \texttt{luatextra}.
-%
-% \begin{macrocode}
-
-luatextra.internal_warning_spaces = " "
-
-function luatextra.internal_warning(msg)
- if not msg then return end
- texio.write_nl(format("\nLuaTeXtra Warning: %s\n\n", msg))
-end
-
-luatextra.internal_error_spaces = " "
-
-function luatextra.internal_error(msg)
- if not msg then return end
- tex.sprint(format("\\immediate\\write16{}\\errmessage{LuaTeXtra error: %s^^J^^J}", msg))
-end
-
-% \end{macrocode}
-%
-% \subsection{Error, warning and info function for modules}
-%
-% Some module printing functions are provided, they have the same
-% philosophy as the \LaTeX 's \texttt{\string\PackageError} and
-% \texttt{\string\PackageWarning} macros: their first argument is the name
-% of the module, and the second is the message. These functions are meant
-% to be used by lua module writers.
-%
-% \begin{macrocode}
-
-function luatextra.module_error(package, msg, helpmsg)
- if not package or not msg then
- return
- end
- if helpmsg then
- tex.sprint(format("\\errhelp{%s}", helpmsg))
- end
- tex.sprint(format("\\luatexModuleError{%s}{%s}", package, msg))
-end
-
-function luatextra.module_warning(modulename, msg)
- if not modulename or not msg then
- return
- end
- texio.write_nl(format("\nModule %s Warning: %s\n\n", modulename, msg))
-end
-
-function luatextra.module_log(modulename, msg)
- if not modulename or not msg then
- return
- end
- texio.write_nl('log', format("%s: %s", modulename, msg))
-end
-
-function luatextra.module_term(modulename, msg)
- if not modulename or not msg then
- return
- end
- texio.write_nl('term', format("%s: %s", modulename, msg))
-end
-
-function luatextra.module_info(modulename, msg)
- if not modulename or not msg then
- return
- end
- texio.write_nl(format("%s: %s\n", modulename, msg))
-end
-
-% \end{macrocode}
-%
-% \subsection{module loading and providing functions}
-%
-% A small function to find a lua module file according to its name, with or
-% without the \texttt{.lua} at the end of the filename.
-%
-% \begin{macrocode}
-
-function luatextra.find_module_file(name)
- if string.sub(name, -4) ~= '.lua' then
- name = name..'.lua'
- end
- path = kpse.find_file(name, 'tex')
- if not path then
- path = kpse.find_file(name, 'texmfscripts')
- end
- return path, name
-end
-
-% \end{macrocode}
-%
-% A small patch, for the \texttt{module} function to work in this file. I
-% can't understand why it doens't otherwise.
-%
-% \begin{macrocode}
-
-luatextra.module = module
-
-% \end{macrocode}
-%
-% \begin{macro}{luatextra.use module}
-%
-% This macro is the one used to simply load a lua module file. It does not
-% reload it if it's already loaded, and prints the filename in the terminal
-% and the log. A lua module must call the macro
-% \texttt{luatextra.provides\_module}.
-%
-% \begin{macrocode}
-
-
-function luatextra.use_module(name)
- if not name or luatextra.modules[name] then
- return
- end
- local path, filename = luatextra.find_module_file(name)
- if not path then
- luatextra.internal_error(format("unable to find lua module %s", name))
- else
- if path:sub(1,2) == "./" then
- path = path:sub(3)
- end
- texio.write_nl('('..path)
- dofile(path)
- if not luatextra.modules[name] then
- luatextra.internal_warning(format("You have requested module `%s',\n%s but the file %s does not provide it.", name, luatextra.internal_warning_spaces, filename))
- end
- if not package.loaded[name] then
- luatextra.module(name, package.seeall)
- end
- texio.write(')')
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% Some internal functions to convert a date into a number, and to determine
-% if a string is a date. It is useful for
-% \texttt{luatextra.require\_package} to understand if a user asks a
-% version with a date or a version number.
-%
-% \begin{macrocode}
-
-function luatextra.datetonumber(date)
- numbers = string.gsub(date, "(%d+)/(%d+)/(%d+)", "%1%2%3")
- return tonumber(numbers)
-end
-
-function luatextra.isdate(date)
- for _, _ in string.gmatch(date, "%d+/%d+/%d+") do
- return true
- end
- return false
-end
-
-local date, number = 1, 2
-
-function luatextra.versiontonumber(version)
- if luatextra.isdate(version) then
- return {type = date, version = luatextra.datetonumber(version), orig = version}
- else
- return {type = number, version = tonumber(version), orig = version}
- end
-end
-
-luatextra.requiredversions = {}
-
-% \end{macrocode}
-%
-% \begin{macro}{luatextra.require module}
-%
-% This function is like the \texttt{luatextra.use\_module} function, but
-% can accept a second argument that checks for the version of the module.
-% The version can be a number or a date (format yyyy/mm/dd).
-%
-% \begin{macrocode}
-
-function luatextra.require_module(name, version)
- if not name then
- return
- end
- if not version then
- return luatextra.use_module(name)
- end
- luaversion = luatextra.versiontonumber(version)
- if luatextra.modules[name] then
- if luaversion.type == date then
- if luatextra.datetonumber(luatextra.modules[name].date) < luaversion.version then
- luatextra.internal_error(format("found module `%s' loaded in version %s, but version %s was required", name, luatextra.modules[name].date, version))
- end
- else
- if luatextra.modules[name].version < luaversion.version then
- luatextra.internal_error(format("found module `%s' loaded in version %.02f, but version %s was required", name, luatextra.modules[name].version, version))
- end
- end
- else
- luatextra.requiredversions[name] = luaversion
- luatextra.use_module(name)
- end
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{luatextra.provides module}
-%
-% This macro is the one that must be called in the module files. It takes a
-% table as argument. You can put any information you want in this table,
-% but the mandatory ones are \texttt{name} (a string), \texttt{version} (a
-% number), \texttt{date} (a string) and \texttt{description} (a string).
-% Other fields are usually \texttt{copyright}, \texttt{author} and
-% \texttt{license}.
-%
-% This function logs informations about the module the same way \LaTeX\
-% does for informations about packages.
-%
-% \begin{macrocode}
-
-function luatextra.provides_module(mod)
- if not mod then
- luatextra.internal_error('cannot provide nil module')
- return
- end
- if not mod.version or not mod.name or not mod.date or not mod.description then
- luatextra.internal_error('invalid module registered, fields name, version, date and description are mandatory')
- return
- end
- requiredversion = luatextra.requiredversions[mod.name]
- if requiredversion then
- if requiredversion.type == date and requiredversion.version > luatextra.datetonumber(mod.date) then
- luatextra.internal_error(format("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
- luatextra.internal_error(format("loading module %s in version %.02f, but version %s was required", mod.name, mod.version, requiredversion.orig))
- end
- end
- luatextra.modules[mod.name] = module
- texio.write_nl('log', format("Lua module: %s %s v%.02f %s\n", mod.name, mod.date, mod.version, mod.description))
-end
-
-% \end{macrocode}
-%
-% \end{macro}
-%
-% Here we load the \textsf{luaextra} module, that contains a bunch of very
-% useful functions. See the documentation of \textsf{luaextra} for more
-% details.
-%
-% \begin{macrocode}
-
-luatextra.use_module('luaextra')
-
-% \end{macrocode}
-%
-% \texttt{luatextra.kpse\_module\_loader} finds a module with the
-% \texttt{kpse} library. This function is then registered in the table of
-% the functions used by the lua function \texttt{require} to look for
-% modules.
-%
-% \begin{macrocode}
-
-function luatextra.kpse_module_loader(mod)
- local file = luatextra.find_module_file(mod)
- if file then
- local loader, error = loadfile(file)
- if loader then
- texio.write_nl("(" .. file .. ")")
- return loader
- end
- return "\n\t[luatextra.kpse_module_loader] Loading error:\n\t"
- .. error
- end
- return "\n\t[luatextra.kpse_module_loader] Search failed"
-end
-
-table.insert(package.loaders, luatextra.kpse_module_loader)
-
-% \end{macrocode}
-%
-% \subsection{Attributes handling\label{sub:attr}}
-%
-% Attribute allocation is done mainly in the \texttt{sty} file, but there
-% is also a lua addition for attribute handling: Lua\TeX\ is by default
-% unable to tell the attribute number corresponding to an attribute name.
-% This attribute number is necessary for functions such as
-% \texttt{node.has\_attribute}, which is used very often. The solution
-% until now was to give a chosen attribute number to each attribute, and
-% pray that someone else didn't use it before. With this method it was easy
-% to know the number of an attribute, as it was chosen. Now with the
-% \texttt{\string\newluaattribute} macro, it's impossible to know the
-% number of an attribute. To fix it, when \texttt{\string\newluaattribute}
-% is called, it calls \texttt{luatextra.attributedef\_from\_tex}. This
-% function registers the number in the table \texttt{tex.attributenumber}.
-% For example to get the number of the attribute \texttt{myattribute}
-% registered with \texttt{\string\newluaattribute\string\myattribute}, you
-% can simply call \texttt{tex.attributenumber[myattribute]}.
-%
-% \begin{macrocode}
-
-luatextra.attributes = {}
-
-tex.attributenumber = luatextra.attributes
-
-function luatextra.attributedef_from_tex(name, number)
- truename = name:gsub('[\\ ]', '')
- luatextra.attributes[truename] = tonumber(number)
-end
-
-% \end{macrocode}
-%
-% \subsection{Catcodetables handling}
-%
-% In the same way, the table \texttt{tex.catcodetablenumber} contains the
-% numbers of the catcodetables registered with
-% \texttt{\string\newluacatcodetable}.
-%
-% \begin{macrocode}
-
-luatextra.catcodetables = {}
-
-tex.catcodetablenumber = luatextra.catcodetables
-
-function luatextra.catcodetabledef_from_tex(name, number)
- truename = name:gsub('[\\ ]', '')
- luatextra.catcodetables[truename] = tonumber(number)
-end
-
-% \end{macrocode}
-%
-% With this function we create some shortcuts for a
-% better readability in lua code. This makes
-% |tex.catcodetablenumber.latex| equivalent to
-% |tex.catcodetablenumber['CatcodeTableLaTeX']|.
-%
-% \begin{macrocode}
-
-function luatextra.catcodetable_do_shortcuts()
- local cat = tex.catcodetablenumber
- local val = cat['CatcodeTableLaTeX']
- if val then
- cat['latex'] = val
- end
- val = cat['CatcodeTableLaTeXAtLetter']
- if val then
- cat['latex-package'] = val
- cat['latex-atletter'] = val
- end
- val = cat['CatcodeTableIniTeX']
- if val then
- cat['ini'] = val
- end
- val = cat['CatcodeTableExpl']
- if val then
- cat['expl3'] = val
- cat['expl'] = val
- end
- val = cat['CatcodeTableString']
- if val then
- cat['string'] = val
- end
- val = cat['CatcodeTableOther']
- if val then
- cat['other'] = val
- end
-end
-
% \end{macrocode}
%
% \subsection{Multiple callbacks on the \texttt{open\_read\_file}
% callback\label{sub:orf}}
%
-% The luamcallbacks (see documentation for details) cannot really provide a
+% |luatexbase| (see documentation for details) cannot really provide a
% simple and reliable way of registering multiple functions in some
% callbacks. To be able to do so, the solution we implemented is to
% register one function in these callbacks, and to create "sub-callbacks"
@@ -706,14 +213,13 @@ end
% \end{itemize}
%
% \begin{macrocode}
-
function luatextra.open_read_file(filename)
local path = kpse.find_file(filename)
local env = {
['filename'] = filename,
['path'] = path,
}
- luamcallbacks.call('pre_read_file', env)
+ luatexbase.call_callback('pre_read_file', env)
path = env.path
if not path then
return
@@ -730,7 +236,6 @@ function luatextra.open_read_file(filename)
env.close = luatextra.close
return env
end
-
% \end{macrocode}
%
% \end{macro}
@@ -739,39 +244,32 @@ end
% \texttt{open\_read\_file} callback.
%
% \begin{macrocode}
-
function luatextra.reader(env)
local line = (env.file):read()
- line = luamcallbacks.call('file_reader', env, line)
+ line = luatexbase.call_callback('file_reader', env, line)
return line
end
-
function luatextra.close(env)
(env.file):close()
- luamcallbacks.call('file_close', env)
+ luatexbase.call_callback('file_close', env)
end
-
% \end{macrocode}
%
% In the callback creation process we need to have default behaviours. Here
% they are. These are called only when no function is registered in the
-% created callback. See the documentation of \texttt{luamcallbacks} for
+% created callback. See the documentation of \texttt{luatexbase} for
% more details.
%
% \begin{macrocode}
-
function luatextra.default_reader(env, line)
return line
end
-
function luatextra.default_close(env)
return
end
-
function luatextra.default_pre_read(env)
return env
end
-
% \end{macrocode}
%
% \subsection{Multiple callbacks on the \texttt{define\_font}
@@ -811,13 +309,11 @@ end
% this mechanism anyway.
%
% \begin{macrocode}
-
do
if tex.luatexversion < 36 then
fontloader = fontforge
end
end
-
function luatextra.find_font(name)
local types = {'ofm', 'ovf', 'opentype fonts', 'truetype fonts'}
local path = kpse.find_file(name)
@@ -828,15 +324,12 @@ function luatextra.find_font(name)
end
return nil
end
-
function luatextra.font_load_error(error)
luatextra.module_warning('luatextra', string.format('%s\nloading lmr10 instead...', error))
end
-
function luatextra.load_default_font(size)
return font.read_tfm("lmr10", size)
end
-
function luatextra.define_font(name, size)
if (size < 0) then size = (- 655.36) * size end
local fontinfos = {
@@ -865,7 +358,7 @@ function luatextra.define_font(name, size)
elseif ext == 'vf' or ext == 'ovf' then
f = font.read_vf(name, size)
elseif ext == 'ttf' or ext == 'otf' or ext == 'ttc' then
- f = callback.call('open_otf_font', fontinfos)
+ f = luatexbase.call_callback('open_otf_font', fontinfos)
else
luatextra.font_load_error("unable to determine the type of font "..name)
f = luatextra.load_default_font(size)
@@ -874,41 +367,34 @@ function luatextra.define_font(name, size)
luatextra.font_load_error("unable to load font "..name)
f = luatextra.load_default_font(size)
end
- callback.call('post_font_opening', f, fontinfos)
+ luatexbase.call_callback('post_font_opening', f, fontinfos)
return f
end
-
function luatextra.default_font_syntax(fontinfos)
return
end
-
function luatextra.default_open_otf(fontinfos)
return nil
end
-
function luatextra.default_post_font(f, fontinfos)
return true
end
-
function luatextra.register_font_callback()
- callback.add('define_font', luatextra.define_font, 'luatextra.define_font')
-end
-
-do
- luatextra.use_module('luamcallbacks')
- callback.create('pre_read_file', 'simple', luatextra.default_pre_read)
- callback.create('file_reader', 'data', luatextra.default_reader)
- callback.create('file_close', 'simple', luatextra.default_close)
- callback.add('open_read_file', luatextra.open_read_file, 'luatextra.open_read_file')
- callback.create('font_syntax', 'simple', luatextra.default_font_syntax)
- callback.create('open_otf_font', 'first', luatextra.default_open_otf)
- callback.create('post_font_opening', 'simple', luatextra.default_post_font)
-
- if luatextrapath then
- texio.write(')')
- end
+ luatexbase.add_to_callback('define_font', luatextra.define_font, 'luatextra.define_font')
end
% \end{macrocode}
+%
+% Initialise a few callbacks.
+%
+% \begin{macrocode}
+ luatexbase.create_callback('pre_read_file', 'simple', luatextra.default_pre_read)
+ luatexbase.create_callback('file_reader', 'data', luatextra.default_reader)
+ luatexbase.create_callback('file_close', 'simple', luatextra.default_close)
+ luatexbase.add_to_callback('open_read_file', luatextra.open_read_file, 'luatextra.open_read_file')
+ luatexbase.create_callback('font_syntax', 'simple', luatextra.default_font_syntax)
+ luatexbase.create_callback('open_otf_font', 'first', luatextra.default_open_otf)
+ luatexbase.create_callback('post_font_opening', 'simple', luatextra.default_post_font)
+% \end{macrocode}
% \iffalse
%</lua>
% \fi
@@ -929,7 +415,7 @@ end
% \end{macrocode}
%
-% Then we load \textsf{ifluatex} and etex if under \LaTeX.
+% Then we load \textsf{ifluatex}.
%
% \begin{macrocode}
@@ -941,8 +427,7 @@ end
\RequirePackage{ifluatex}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luatextra}
- [2009/12/16 v0.95 LuaTeX extra low-level macros]
- \RequirePackage{etex}[1998/03/26]
+ [2010/05/10 v0.97 LuaTeX extra low-level macros]
\fi
% \end{macrocode}
@@ -961,57 +446,61 @@ end
% \end{macrocode}
%
-% Here we end the loading of the file if we are under a non-Lua\TeX{}
-% engine, and we issue a warning.
+% Make sure Lua\TeX\ is being used.
%
% \begin{macrocode}
-
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input ifluatex.sty
+\else
+ \RequirePackage{ifluatex}
+\fi
\ifluatex\else
- \expandafter\ifx\csname ProvidesPackage\endcsname\relax
- \immediate\write16{}
- \immediate\write16{Package luatextra Warning: this package should be used with LuaTeX.}
- \else
- \PackageWarning{luatextra}{this package should be used with LuaTeX.}
- \fi
+ \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.^^J
+ Aborting package loading.}
\expandafter\endinput
\fi
-
-\expandafter\ifx\csname ProvidesPackage\endcsname\relax
% \end{macrocode}
%
-% If the package is loaded with Plain, we define
-% \texttt{\string\luaRequireModule} with two mandatory arguments.
+% Load other usefull packages.
%
% \begin{macrocode}
- \def\luatexRequireModule#1#2{\luadirect{luatextra.require_module([[#1]], [[#2]])}}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatexbase-modutils.sty
+ \input luatexbase-attr.sty
+ \input luatexbase-cctb.sty
+ \input luatexbase-regs.sty
+ \input luatexbase-mcb.sty
\else
+ \RequirePackage{luatexbase-modutils}
+ \RequirePackage{luatexbase-attr}
+ \RequirePackage{luatexbase-cctb}
+ \RequirePackage{luatexbase-regs}
+ \RequirePackage{luatexbase-mcb}
+\fi
+\luatexUseModule{lualibs}
% \end{macrocode}
%
-% If the package is loaded with \LaTeX , we define
-% \texttt{\string\luaRequireModule} with one mandatory
-% argument (the name of the package) and one optional (the version or the
-% date). We also define the environment \texttt{luacode}.
+% If the package is loaded with \LaTeX , we
+% also define the environment \texttt{luacode}.
%
% \begin{macrocode}
+\expandafter\ifx\csname RequirePackage\endcsname\relax \else
\RequirePackage{environ}
- \NewEnviron{luacode}{\luadirect{\BODY}}
- \newcommand\luatexRequireModule[2][0]{\luadirect{luatextra.require_module([[#2]], [[#1]])}}
-% \end{macrocode}
-%
-% The \texttt{\string\input} is a hack that modifies some values in the
-% register attribution scheme of $\varepsilon$-\TeX\ and remaps
-% \texttt{\string\newcount} to \textsf{etex}'s \texttt{\string\globcount}.
-% We have to do such a remapping in a separate file that Plain doesn't see,
-% otherwise it outputs an error if we try to change
-% \texttt{\string\newcount} (because it is an \texttt{\string\outer}
-% macro). See section \ref{sub:latex} for the file content.
-%
-% \begin{macrocode}
- \input luatextra-latex.tex
+ \NewEnviron{luacode}{\directlua{\BODY}}
\fi
-
% \end{macrocode}
%
+%
% \subsection{Primitives renaming}
%
% Here we differenciate two very different cases: Lua\TeX\ version < 0.36
@@ -1021,7 +510,6 @@ end
% \texttt{\string\directlua} syntax prints a warning.
%
% \begin{macrocode}
-
\ifnum\luatexversion<36
% \end{macrocode}
%
@@ -1072,275 +560,27 @@ end
\let\saveluatexcatcodetable\luatexsavecatcodetable
\let\luaclose\luatexcloselua
\fi
-
-
% \end{macrocode}
%
% We load the \texttt{lua} file.
%
% \begin{macrocode}
-
-\luadirect{dofile(kpse.find_file("luatextra.lua"))}
-
+\directlua{dofile(kpse.find_file("luatextra.lua"))}
% \end{macrocode}
%
% A small macro to register the \texttt{define\_font} callback from
% \textsf{luatextra}. See section \ref{sub:df} for more details.
%
% \begin{macrocode}
-
\def\ltxtra@RegisterFontCallback{
- \luadirect{luatextra.register_font_callback()}
+ \directlua{luatextra.register_font_callback()}
}
-
% \end{macrocode}
%
-% \subsection{Module handling}
-%
-% The \texttt{\string\luaModuleError} macro is called by the lua function
-% \texttt{luatextra.module\_error}. It is necessary because we can't call
-% directly \texttt{\string\errmessage} in lua.
-%
-% \subsection{Module handling}
-%
-% The \texttt{\string\luatexModuleError} macro is called by the lua function
-% \texttt{luatextra.module\_error}. It is necessary because we can't call
-% directly \texttt{\string\errmessage} in lua. Then we define
-% \texttt{\string\luatexUseModule} that simply calls
-% \texttt{luatextra.use\_module}. Remember that
-% \texttt{\string\luatexRequireModule} is defined at the beginning of this
-% file.
+% We provide some functions for backward compatibility with old versions of
+% luatextra.
%
% \begin{macrocode}
-
-\def\luatexModuleError#1#2{%
- \errorcontextlines=0\relax
- \immediate\write16{}%
- \errmessage{Module #1 error: #2^^J^^J%
-See the module #1 documentation for explanation.^^J ...^^J}%
-}
-
-\def\luatexUseModule#1{\luadirect{luatextra.use_module([[#1]])}}
-
-% \end{macrocode}
-%
-% \subsection{Attributes handling}
-%
-% The most important macro here is \texttt{\string\newluatexattribute} that
-% allocates a new attribute, and adds it in the \texttt{tex.attributename}
-% table (see \texttt{luatextra.attributedef\_from\_tex} for more details.
-% It works just like the other \texttt{\string\new*} macros, we can
-% allocate up to 65536 different attributes.
-%
-% \begin{macrocode}
-
-
-\newcount\luatexattdefcounter
-\luatexattdefcounter = 1
-
-\def\newluatexattribute#1{%
- \ifnum\luatexattdefcounter<65535\relax %
- \global\advance\luatexattdefcounter by 1\relax %
- \allocationnumber\luatexattdefcounter %
- \ifluatex %
- \global\luatexattributedef#1=\allocationnumber %
- \fi %
- \wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
- \luadirect{%
- luatextra.attributedef_from_tex([[\noexpand#1]], '\number\allocationnumber')}%
- \else %
- \errmessage{No room for a new \string\attribute}%
- \fi %
-}
-
-% \end{macrocode}
-%
-% Two convenient macros, one to set an attribute (basically just a
-% wrapper), and another one to uset it. Unsetting attributes with this
-% function is important, as the \texttt{unset} value may change, as it
-% already has in the 0.37 version.
-%
-% \begin{macrocode}
-
-\def\setluatexattribute#1#2{%
- #1=\numexpr#2\relax %
-}
-
-\def\unsetluatexattribute#1{%
- \ifnum\luatexversion<37\relax %
- #1=-1\relax %
- \else %
- #1=-"7FFFFFFF\relax %
- \fi %
-}
-
-% \end{macrocode}
-%
-% \subsection{Catcodetables handling}
-%
-% Here we allocate catcodetables the same way we handle attributes.
-%
-% \begin{macrocode}
-
-\newcount\luatexcatcodetabledefcounter
-
-\luatexcatcodetabledefcounter = 1
-
-\def\newluatexcatcodetable#1{%
- \ifnum\luatexcatcodetabledefcounter<1114110\relax % 0x10FFFF is maximal \chardef
- \global\advance\luatexcatcodetabledefcounter by 1\relax %
- \allocationnumber=\luatexcatcodetabledefcounter %
- \global\chardef#1=\allocationnumber %
- \luadirect{%
- luatextra.catcodetabledef_from_tex([[\noexpand#1]], '\number\allocationnumber')}%
- \wlog{\string#1=\string\catcodetable\the\allocationnumber}%
- \else %
- \errmessage{No room for a new \string\catcodetable}%
- \fi %
-}
-
-% \end{macrocode}
-%
-% A small patch to manage the catcode of \@ in Plain, and to get two new
-% counters in Plain too.
-%
-% \begin{macrocode}
-
-\expandafter\edef\csname ltxtra@AtEnd\endcsname{%
- \catcode64 \the\catcode64\relax
-}
-
-\catcode 64=11\relax
-
-\expandafter\ifx\csname @tempcnta\endcsname\relax
- \csname newcount\endcsname\@tempcnta
-\fi
-\expandafter\ifx\csname @tempcntb\endcsname\relax
- \csname newcount\endcsname\@tempcntb
-\fi
-
-% \end{macrocode}
-%
-% A macro that sets the catcode of a range of characters. The first
-% parameter is the character number of the first character of the range,
-% the second parameter is one for the last character, and the third
-% parameter is the catcode we want them to have.
-%
-% \begin{macrocode}
-
-\def\luatexsetcatcoderange#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 by 1\relax
- \repeat
- \luaSCR@temp
-}
-
-% \end{macrocode}
-%
-% Finally we create several catcodetables that may be used by the user.
-% These are:
-%
-% \begin{itemize}
-% \item \texttt{\string\CatcodeTableIniTeX}: the base \TeX\ catcodes
-% \item \texttt{\string\CatcodeTableString}: almost all characters have
-% catcode 12
-% \item \texttt{\string\CatcodeTableOther}: all characters have catcode 12
-% (even space)
-% \item \texttt{\string\CatcodeTableLaTeX}: the \LaTeX\ classical catcodes
-% \item \texttt{\string\CatcodeTableLaTeXAtLetter}: the \LaTeX\ classical
-% catcodes and |@| letter
-% \item \texttt{\string\CatcodeTableExpl}: the expl3 catcodes
-% \end{itemize}
-%
-% \begin{macrocode}
-
-\newluatexcatcodetable\CatcodeTableIniTeX
-\newluatexcatcodetable\CatcodeTableString
-\newluatexcatcodetable\CatcodeTableOther
-\newluatexcatcodetable\CatcodeTableLaTeX
-\newluatexcatcodetable\CatcodeTableLaTeXAtLetter
-\newluatexcatcodetable\CatcodeTableExpl
-\initluatexcatcodetable\CatcodeTableIniTeX
-
-\expandafter\ifx\csname @firstofone\endcsname\relax
- \long\def\@firstofone#1{#1}%
-\fi
-
-\begingroup
- \def\@makeother#1{\catcode#1=12\relax}%
- \@firstofone{%
- \luatexcatcodetable\CatcodeTableIniTeX
- \begingroup
- \luatexsetcatcoderange{0}{8}{15}%
- \catcode9=10 % tab
- \catcode11=15 %
- \catcode12=13 % form feed
- \luatexsetcatcoderange{14}{31}{15}%
- \catcode35=6 % hash
- \catcode36=3 % dollar
- \catcode38=4 % ampersand
- \catcode94=7 % circumflex
- \catcode95=8 % underscore
- \catcode123=1 % brace left
- \catcode125=2 % brace right
- \catcode126=13 % tilde
- \catcode127=15 %
- \saveluatexcatcodetable\CatcodeTableLaTeX
- \catcode64=11 %
- \saveluatexcatcodetable\CatcodeTableLaTeXAtLetter
- \endgroup
- \begingroup
- \luatexsetcatcoderange{0}{8}{15}%
- \catcode9=9 % tab ignored
- \catcode11=15 %
- \catcode12=13 % form feed
- \luatexsetcatcoderange{14}{31}{15}%
- \catcode32=9 % space is ignored
- \catcode35=6 % hash mark is macro parameter character
- \catcode36=3 % dollar (not so sure about the catcode...)
- \catcode38=4 % ampersand
- \catcode58=11 % colon letter
- \catcode94=7 % circumflex is superscript character
- \catcode95=11 % underscore letter
- \catcode123=1 % left brace is begin-group character
- \catcode125=2 % right brace is end-group character
- \catcode126=10 % tilde is a space char.
- \catcode127=15 %
- \saveluatexcatcodetable\CatcodeTableExpl
- \endgroup
- \@makeother{0}% nul
- \@makeother{13}% carriage return
- \@makeother{37}% percent
- \@makeother{92}% backslash
- \@makeother{127}%
- \luatexsetcatcoderange{65}{90}{12}% A-Z
- \luatexsetcatcoderange{97}{122}{12}% a-z
- \saveluatexcatcodetable\CatcodeTableString
- \@makeother{32}% space
- \saveluatexcatcodetable\CatcodeTableOther
- \endgroup
-}
-
-\ltxtra@AtEnd
-
-\luadirect{luatextra.catcodetable_do_shortcuts()}
-
-% \end{macrocode}
-%
-% We provide some functions for backward compatibility with old versions of luatextra.
-%
-% \begin{macrocode}
-
\let\newluaattribute\newluatexattribute
\let\luaattribute\luatexattribute
\let\unsetluaattribute\unsetluatexattribute
@@ -1351,56 +591,21 @@ See the module #1 documentation for explanation.^^J ...^^J}%
\let\luaModuleError\luatexModuleError
\let\luaRequireModule\luatexRequireModule
\let\luaUseModule\luatexUseModule
-
% \end{macrocode}
%
% Finally, we load \textsf{luaotfload}.
%
% \begin{macrocode}
-
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\input luaotfload.sty
\else
\RequirePackage{luaotfload}
\fi
-
% \end{macrocode}
% \iffalse
%</package>
% \fi
%
-% \section{\texttt{luatextra-latex.tex}\label{sub:latex}}
-%
-% \iffalse
-%<*latex>
-% \fi
-%
-% This file is very small, it just changes the maximum values of allowed
-% registers from 32768 to 65536, and remaps \texttt{\string\newcount} (and
-% friends) to \textsf{etex}'s \texttt{\string\globcount}.
-%
-% \begin{macrocode}
-\def\ltxtra@temp#1{%
-\ifnum\count27#1=32768 %
- \count27#1=65536 %
-\fi
-}%
-\ltxtra@temp0%
-\ltxtra@temp1%
-\ltxtra@temp2%
-\ltxtra@temp3%
-\ltxtra@temp4%
-\ltxtra@temp5%
-\ltxtra@temp6%
-\let\newcount\globcount
-\let\newdimen\globdimen
-\let\newskip\globskip
-\let\newbox\globbox
-% \end{macrocode}
-% \iffalse
-%</latex>
-% \fi
-%
%
% \Finale
\endinput