summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-30 03:08:47 -0700
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-30 03:08:47 -0700
commit12e95bc9acd7c2d172a0b47b5832cbc56eb4fa54 (patch)
treef2d1d57a0f5e0cac8c8f9fdea3ba12a6b6805f90
parent520f6b3ccb737a949ac73dcd1d8c152a044db0ba (diff)
parentec9027b5a79546bf9babb7d97b778551cd25b29e (diff)
downloadluatexbase-12e95bc9acd7c2d172a0b47b5832cbc56eb4fa54.tar.gz
Merge pull request #2 from phi-gamma/master
pull changes from eroux
-rw-r--r--Changes22
-rw-r--r--Makefile11
-rw-r--r--TODO4
-rw-r--r--lltxb-dtxstyle.tex6
-rw-r--r--luatex.dtx8
-rw-r--r--luatexbase-attr.dtx36
-rw-r--r--luatexbase-loader.dtx139
-rw-r--r--luatexbase-mcb.dtx35
-rw-r--r--luatexbase-modutils.dtx14
-rw-r--r--luatexbase.dtx30
10 files changed, 178 insertions, 127 deletions
diff --git a/Changes b/Changes
index 10a79e6..7b39c55 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,27 @@
Changes in the luatexbase package/bundle
+2013/04/22 v0.6
+ loader
+ - do not output included file paths when called by texlua
+ mcb
+ - passing most of the term output to the log
+
+2013/04/13 v0.5
+ all
+ - input luatex.sty before doing anything, as luatex.sty
+ breaks if loaded after luatexbase
+ mcb and loader
+ - compatibility with Lua 5.2 (LuaTeX >= 0.74)
+ loader
+ - fix an important bug making the kpse lua loader never used,
+ it should make package searching a bit faster.
+ - dropping support for LuaTeX < 0.45.
+ - small improvement to make x.y.lua look for x/y.lua, not
+ x/y/lua.
+ modutils
+ - fixing a bug printing "luatexbase-attr" in all documents
+ in plain TeX
+
2011/00/24 v0.4
cctb
- implement catcode table stacks à la luatex.sty
diff --git a/Makefile b/Makefile
index 0f65bf1..6fdc7fb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
# Makefile for luatexbase
NAME = luatexbase
-DTX = $(wildcard *.dtx)
+DTX = $(wildcard luatexbase*.dtx)
DOC = $(patsubst %.dtx, %.pdf, $(DTX))
DTXSTY = lltxb-dtxstyle.tex
@@ -28,6 +28,9 @@ UNPACKED_LUATEX = luatex.sty test-luatex1.tex test-luatex2.tex \
UNPACKED = $(UNPACKED_MCB) $(UNPACKED_REGS) $(UNPACKED_ATTR) $(UNPACKED_CCTB) \
$(UNPACKED_LOADER) $(UNPACKED_MODUTILS) $(UNPACKED_COMPAT) \
$(UNPACKED_BASE) $(UNPACKED_LUATEX)
+UNPACKEDTL = $(UNPACKED_MCB) $(UNPACKED_REGS) $(UNPACKED_ATTR) $(UNPACKED_CCTB) \
+ $(UNPACKED_LOADER) $(UNPACKED_MODUTILS) $(UNPACKED_COMPAT) \
+ $(UNPACKED_BASE)
COMPILED = $(DOC)
GENERATED = $(COMPILED) $(UNPACKED)
SOURCE = $(DTX) $(DTXSTY) README TODO Changes Makefile
@@ -38,8 +41,8 @@ TMP_LOADER = $(TEST_LOADER).tex
TEST_MCB = test-mcb-aux.tex
# Files grouped by installation location
-RUNFILES = $(filter-out test-%, $(UNPACKED))
-DOCFILES = $(DOC) $(filter test-%, $(UNPACKED)) README TODO Changes
+RUNFILES = $(filter-out test-%, $(UNPACKEDTL))
+DOCFILES = $(DOC) $(filter test-%, $(UNPACKEDTL)) README TODO Changes
SRCFILES = $(DTX) Makefile
# The following definitions should be equivalent
@@ -84,7 +87,7 @@ luatexbase.%.lua: %.lua
$(UNPACKED_MCB): luatexbase-mcb.dtx
$(DO_TEX)
- echo \\\\relax > $(TEST_MCB)
+ echo "\\\relax" > $(TEST_MCB)
$(UNPACKED_REGS): luatexbase-regs.dtx
$(DO_TEX)
diff --git a/TODO b/TODO
index b70a84a..6205464 100644
--- a/TODO
+++ b/TODO
@@ -13,9 +13,7 @@ all
or generalise use of qstest
- add debug messages to be used in the test suite?
- mark all occurences of version-dependent stuff in the code
-- drop compat for 0.25 when tl2010 is frozen
-- quit using module() in favor of locals, more generally ensure compat with
- Lua 5.2
+- quit using module() in favor of locals
- support the syntax foo = require"foo" in modutils? How?
compat
diff --git a/lltxb-dtxstyle.tex b/lltxb-dtxstyle.tex
index 804dbfb..115d4f2 100644
--- a/lltxb-dtxstyle.tex
+++ b/lltxb-dtxstyle.tex
@@ -57,8 +57,8 @@
\newif\ifluatexbase
\author{%
Heiko Oberdiek (primary author of \pk{luatex}) \\
- Élie Roux (primary author of \pk{luatextra}) \\
- Manuel Pégourié-Gonnard (current developper)\thanks{%
+ \'Elie Roux (primary author of \pk{luatextra}) \\
+ Manuel P\'egouri\'e-Gonnard (current developper)\thanks{%
See ``History''
\ifluatexbase\else in \href{luatexbase.pdf}{\file{luatexbase.pdf}} \fi
for details.}%
@@ -68,7 +68,7 @@
}
\hypersetup{%
pdfsubject = {Basic resource management for LuaTeX},
- pdfauthor = {Manuel Pégourié-Gonnard, Élie Roux, Heiko Oberdiek},
+ pdfauthor = {Manuel P\'egouri\'e-Gonnard, \'Elie Roux, Heiko Oberdiek},
}
% other metadata
diff --git a/luatex.dtx b/luatex.dtx
index 2830f0d..699aee5 100644
--- a/luatex.dtx
+++ b/luatex.dtx
@@ -227,6 +227,14 @@ See the aforementioned source file(s) for copyright and licensing information.
\fi
% \end{macrocode}
%
+% We set |LuT@AllocAttribute| in order for the hacks in luatexbase-attr to
+% work.
+%
+% \begin{macrocode}
+\newcount\LuT@AllocAttribute
+\LuT@AllocAttribute=\m@ne
+% \end{macrocode}
+%
% \subsection{Packages loading}
%
% \begin{macrocode}
diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx
index 923ad97..ded08b3 100644
--- a/luatexbase-attr.dtx
+++ b/luatexbase-attr.dtx
@@ -145,7 +145,7 @@ See the aforementioned source file(s) for copyright and licensing information.
% number of the attribute associated to |\fooattr| assuming it was defined
% using |\newluatexattribute\fooattr|, something that \luatex currently
% doesn't support (you can get the current value of the associated attribute
-% as |tex.atrribute.fooattr|, but not the attribute number).
+% as |tex.attribute.fooattr|, but not the attribute number).
%
% There are several ways to work around this. For example, it is possible to
% extract the number at any time from the |\meaning| of |\fooattr|.
@@ -158,7 +158,7 @@ See the aforementioned source file(s) for copyright and licensing information.
%
% Also, two Lua functions are provided that are analogous to the above \tex
% macros (actually, the macros are wrappers around the functions):
-% |luatexbase.new_attributes|\parg{name} allocates a new attribute, without
+% |luatexbase.new_attribute|\parg{name} allocates a new attribute, without
% defining a corresponding \tex control sequence (only an entry in
% |luatexbase.attributes| is created. It usually returns the number of the
% allocated attribute. If room is missing, it raises an error, unless the
@@ -283,14 +283,16 @@ See the aforementioned source file(s) for copyright and licensing information.
% \subsubsection{Load supporting Lua module}
%
% First load \pk{luatexbase-loader} (hence \pk{luatexbase-compat}), then
-% the supporting Lua module.
+% the supporting Lua module. We make sure luatex.sty is loaded.
%
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input luatexbase-loader.sty
+ \input luatex.sty
\else
\RequirePackage{luatexbase-loader}
+ \RequirePackage{luatex}
\fi
\luatexbase@directlua{require('luatexbase.attr')}
% \end{macrocode}
@@ -351,6 +353,27 @@ module('luatexbase', package.seeall)
attributes = {}
% \end{macrocode}
%
+% There are currently two functions that create a new attribute.One is in
+% |oberdiek| bundle, the other is this one. We will hack a little in order
+% to make them compatible. The other function uses |LuT@AllocAttribute| as
+% attribute counter, we will keep it in sync with ours. A possible problem
+% might also appear: the other function starts attribute allocation at 0,
+% which might break luaotfload. We output an error if a new attribute has
+% already been allocated with number 0.
+%
+% \begin{macrocode}
+local luatex_sty_counter = 'LuT@AllocAttribute'
+if tex.count[luatex_sty_counter] then
+ if tex.count[luatex_sty_counter] > -1 then
+ error("luatexbase error: attribute 0 has already been set by \newattribute"
+ .."macro from luatex.sty, not belonging to this package, this makes"
+ .."luaotfload unuseable. Please report to the maintainer of luatex.sty")
+ else
+ tex.count[luatex_sty_counter] = 0
+ end
+end
+% \end{macrocode}
+%
% The allocaton function. Unlike other registers, allocate starting from 1.
% Some code (eg, font handling coming from Con\tex{}t) behaves strangely
% with \verb+\attribute0+ and since there is plenty of room here, it
@@ -366,7 +389,14 @@ function new_attribute(name, silent)
error("No room for a new \\attribute", 1)
end
end
+ local lsc = tex.count[luatex_sty_counter]
+ if lsc and lsc > last_alloc then
+ last_alloc = lsc
+ end
last_alloc = last_alloc + 1
+ if lsc then
+ tex.setcount('global', luatex_sty_counter, last_alloc)
+ end
attributes[name] = last_alloc
unset_attribute(name)
if not silent then
diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx
index 3bf1b47..b8e5098 100644
--- a/luatexbase-loader.dtx
+++ b/luatexbase-loader.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu>
+% Copyright 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu>
% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr>
%
% This work is under the CC0 license.
@@ -112,9 +112,9 @@ See the aforementioned source file(s) for copyright and licensing information.
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \pkdate{luatexbase-loader}{v0.4 2011-05-24}
+% \pkdate{luatexbase-loader}{v0.5 2013-04-13}
%
-% \maketitle
+% \maketitle
%
% \begin{abstract}
% Lua modules are loaded using the |require()| function which, similarly to
@@ -133,27 +133,18 @@ See the aforementioned source file(s) for copyright and licensing information.
% when the library is initialised (which is always the case in \tex mode,
% unless explicitly disabled by the user). However, it did not respect the
% Lua convention that |require("foo.bar")| should look for |foo/bar.lua| until
-% version 0.60. This package adds such behaviour to older versions of \luatex.
-%
-% More precisely, it implements a new kpse searcher that looks for file
-% |foo/bar| using Kpathsea with the format |lua| (that is, search along
-% |LUAINPUTS| and try the following extensions: |.luc|, |.luctex|, |.texluc|,
-% |.lua|, |.luatex|, |.texlua|). If this search fails, it falls back to
-% |foo.bar| (along the same path with the same extensions).
-%
-% Also, older versions of \luatex, such as 0.25.4 (\texlive 2008), don't know
-% about the |lua| format for kpse searching. So, an emulator for this function
-% is provided. The emulator is not perfect, in particular it may find more
-% results than the normal |lua| format search.\footnote{And may also fail to
-% find the file in particular cases, see comments in the implementation for
-% details.} In order to ensure more homogeneous results across versions, this
-% emulator is used as a fall-back when the real |lua| format search doesn't
-% find any result.
-%
-% Finally, a combined version of this new kpse searcher and the original
-% function at |package.loaders[2]| (using first the new loader, then the old
-% one if the new doesn't return any result) is installed as
-% |package.loaders[2]|.
+% version 0.60. \luatex 0.74 ships with Lua 5.2 that has a different loading
+% system.
+%
+% The aim of this package is to have a coherent behaviour between versions of
+% LuaTeX, and to get the loaded file's name printed in the output (\LaTeX
+% style). The first versions did ensure backward compatibilty to \luatex 0.25
+% but as \luatex development is quite fast, this version supports only \luatex
+% 0.45 and higher.
+%
+% More precisely, when asked for |foo.bar| (or |foo.bar.lua|), it first looks
+% for file |foo/bar| using Kpathsea with the format |lua|, and then for
+% |foo.bar|, removing the possible extension.
%
% \section{Implementation}
%
@@ -217,7 +208,7 @@ See the aforementioned source file(s) for copyright and licensing information.
\let\x\ProvidesPackage
\fi
\expandafter\endgroup
-\x{luatexbase-loader}[2011/05/24 v0.4 Lua module loader for LuaTeX]
+\x{luatexbase-loader}[2013/04/13 v0.5 Lua module loader for LuaTeX]
% \end{macrocode}
%
% Make sure \luatex is used.
@@ -266,7 +257,7 @@ See the aforementioned source file(s) for copyright and licensing information.
% \begin{macrocode}
\luatexbase@directlua{%
local file = "luatexbase.loader.lua"
- local path = assert(kpse.find_file(file, 'tex'),
+ local path = assert(kpse.find_file(file, 'lua'),
"File '"..file.."' not found")
texio.write_nl("("..path..")")
dofile(path)}
@@ -286,13 +277,29 @@ See the aforementioned source file(s) for copyright and licensing information.
module('luatexbase', package.seeall)
% \end{macrocode}
%
+% Just in case it's called from a \TeX Lua script...
+%
+% \begin{macrocode}
+kpse.set_program_name("luatex")
+% \end{macrocode}
+%
+% In \LaTeX, it's traditional to print the included file paths. We don't want
+% to do this for scripts using texlua... Currently there is no perfect check
+% of texlua vs. luatex, so we check for the token table.
+%
+% \begin{macrocode}
+local print_included_path = false
+if token then
+ print_included_path = true
+end
+% \end{macrocode}
+%
% Emulate (approximatively) kpse's lua format search. More precisely,
% combine the search path of |texmfscripts| and |tex| in order to
% approximate |LUAINPUTS|. But we need to handle suffixes ourselves.
%
% |lua_suffixes| is taken verbatim from Kpathsea's source
-% (\file{tex-file.c}, constant |LUA_SUFFIXES|).\footnote{Unchanged since
-% 2007-07-06, last checked 2010-05-10.}
+% (\file{tex-file.c}, constant |LUA_SUFFIXES|).\footnote{Last checked 2013-04-12.}
%
% \begin{macrocode}
local lua_suffixes = {
@@ -308,76 +315,42 @@ local function ends_with(suffix, name)
end
% \end{macrocode}
%
-% The search function first builds the list of filenames to be search. For
-% the lua format, kpse always adds a suffix if no (known) suffix is
-% present, so we do the same.
+% Auxiliary function for suffixes: returns the basename of a file if it end
+% by one of the suffixes.
%
% \begin{macrocode}
-local function find_file_lua_emul(name)
- local search_list = {}
+local function basename(name)
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
-% \end{macrocode}
-%
-% Now look for each file in this list.
-%
-% \begin{macrocode}
- for _, search_name in ipairs(search_list) do
- local f = kpse.find_file(search_name, 'texmfscripts')
- or kpse.find_file(search_name, 'tex')
-% \end{macrocode}
-%
-% There is a problem with using the |tex| search format: kpse will try to
-% add suffixes from the |TEX_SUFFIXES| list, which may lead to problems
-% if a file like \meta{name}|.lua.tex| exists. We prevent that by checking if
-% the file found ends with the required name. So \meta{name}|.lua| will
-% still be hidden by \meta{name}.|lua.tex| but it seems less bad not to
-% find it than to return an incorrect result.
-%
-% \begin{macrocode}
- if f and ends_with(search_name, f) then
- return f
+ return name:sub(1, -(suffix:len()+1))
end
end
+ return name
end
% \end{macrocode}
%
-% If lua search format is available, use it with emulation as a fall-back,
-% or just use emulation.
-%
-% \begin{macrocode}
-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
-% \end{macrocode}
-%
-% Find the full path corresponding to a module name.
+% The main function, emulating the behaviour of |packages.searchers[2]|,
+% with a small improvement that eliminates the possible extension.
%
% \begin{macrocode}
local function find_module_file(mod)
- return find_file_lua(mod:gsub('%.', '/'), 'lua')
- or find_file_lua(mod, 'lua')
+ local compat = basename(mod):gsub('%.', '/')
+ return kpse.find_file(compat, 'lua') or kpse.find_file(mod, 'lua')
end
% \end{macrocode}
%
% Combined searcher, using primarily the new kpse searcher, and the
-% original as a fall-back.
+% original as a fall-back. Starting from \luatex 0.75, Lua 5.2 is used. Among
+% the changes, |package.loaders| is renamed as |package.searchers|.
+%
+% The main improvement is thus the printing of the filename in the output.
%
% \begin{macrocode}
-local package_loader_two = package.loaders[2]
+local package_loader_two
+if not package.searchers then
+ package.searchers = package.loaders
+end
+package_loader_two = package.searchers[2]
local function load_module(mod)
local file = find_module_file(mod)
if not file then
@@ -395,7 +368,9 @@ local function load_module(mod)
if not loader then
return "\n\t[luatexbase.loader] Loading error:\n\t"..error
end
- texio.write_nl("("..file..")")
+ if print_included_path then
+ texio.write_nl("("..file..")")
+ end
return loader
end
% \end{macrocode}
@@ -403,7 +378,7 @@ end
% Finally install this combined loader as loader 2.
%
% \begin{macrocode}
-package.loaders[2] = load_module
+package.searchers[2] = load_module
%</luamodule>
% \end{macrocode}
%
diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index b26f56f..f4d6448 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -2,6 +2,7 @@
%
% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu>
% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr>
+% Copyright 2013 by Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de>
%
% This work is under the CC0 license.
%
@@ -114,7 +115,7 @@ See the aforementioned source file(s) for copyright and licensing information.
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \pkdate{luatexbase-mcb}{2011/05/24 v0.4}
+% \pkdate{luatexbase-mcb}{2013/04/13 v0.5}
%
% \maketitle
%
@@ -141,7 +142,7 @@ See the aforementioned source file(s) for copyright and licensing information.
%
% \luatex provides an extremely interesting feature, named callbacks. It
% allows to call some Lua functions at some points of the \TeX\ algorithm (a
-% \emph{callback}), like when \TeX\ breaks likes, puts vertical spaces, etc.
+% \emph{callback}), like when \TeX\ breaks lines, puts vertical spaces, etc.
% The \luatex core offers a function called \texttt{callback.register} that
% enables to register a function in a callback.
%
@@ -156,7 +157,7 @@ See the aforementioned source file(s) for copyright and licensing information.
% \begin{description}
% \item[simple] is for functions that don't return anything: they are called
% in order, all with the same argument;
-% \item[data] is for functions receiving a piece of data of nay type
+% \item[data] is for functions receiving a piece of data of any type
% except node list head (and possibly other arguments) and returning it
% (possibly modified): the functions are called in order, and each is
% passed the return value of the previous (and the other arguments
@@ -166,8 +167,8 @@ See the aforementioned source file(s) for copyright and licensing information.
% modified node list, or the boolean values |true| or |false|. The
% functions are chained the same way as for \emph{data} except that for
% the following. If
-% one function returns |false|, then |false| is immediately return and the
-% following functions are \emph{not} called. If one function returns
+% one function returns |false|, then |false| is immediately returned and
+% the following functions are \emph{not} called. If one function returns
% |true|, then the same head is passed to the next function. If all
% functions return |true|, then |true| is returned, otherwise the return
% value of the last function not returning |true| is used.
@@ -331,7 +332,7 @@ See the aforementioned source file(s) for copyright and licensing information.
\let\x\ProvidesPackage
\fi
\expandafter\endgroup
-\x{luatexbase-mcb}[2011/05/24 v0.4 Callback management for LuaTeX]
+\x{luatexbase-mcb}[2013/04/13 v0.5 Callback management for LuaTeX]
% \end{macrocode}
%
% Make sure \luatex is used.
@@ -392,13 +393,13 @@ See the aforementioned source file(s) for copyright and licensing information.
%
% \begin{macrocode}
module('luatexbase', package.seeall)
-local err, warning, info = luatexbase.provides_module({
+local err, warning, info, log = luatexbase.provides_module({
name = "luatexbase-mcb",
- version = 0.4,
- date = "2011/05/24",
+ version = 0.5,
+ date = "2013/04/13",
description = "register several functions in a callback",
- author = "Hans Hagen, Elie Roux and Manuel Pegourie-Gonnard",
- copyright = "Hans Hagen, Elie Roux and Manuel Pegourie-Gonnard",
+ author = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang",
+ copyright = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang",
license = "CC0",
})
% \end{macrocode}
@@ -686,7 +687,7 @@ function add_to_callback (name,func,description,priority)
warning("several functions in '%s',\n"
.."only one will be active.", name)
end
- info("inserting '%s'\nat position %s in '%s'",
+ log("inserting '%s'\nat position %s in '%s'",
description, priority, name)
end
% \end{macrocode}
@@ -732,8 +733,8 @@ function remove_from_callback (name, description)
return
end
table.remove(l, index)
- info("removing '%s'\nfrom '%s'", description, name)
- if table.maxn(l) == 0 then
+ log("removing '%s'\nfrom '%s'", description, name)
+ if #l == 0 then
callbacklist[name] = nil
if not lua_callbacks_defaults[name] then
register_callback(name, nil)
@@ -755,11 +756,11 @@ function reset_callback (name, make_false)
err("unable to reset '%s':\nis not a valid callback", name)
return
end
- info("resetting callback '%s'", name)
+ log("resetting callback '%s'", name)
callbacklist[name] = nil
if not lua_callbacks_defaults[name] then
if make_false == true then
- info("setting '%s' to false", name)
+ log("setting '%s' to false", name)
register_callback(name, false)
else
register_callback(name, nil)
@@ -822,7 +823,7 @@ function create_callback(name, ctype, default)
err("unable to create callback '%s':\ntype '%s' undefined", name, ctype)
return nil
end
- info("creating '%s' type %s", name, ctype)
+ log("creating '%s' type %s", name, ctype)
lua_callbacks_defaults[name] = default
callbacktypes[name] = ctype
end
diff --git a/luatexbase-modutils.dtx b/luatexbase-modutils.dtx
index 2dce051..6f500da 100644
--- a/luatexbase-modutils.dtx
+++ b/luatexbase-modutils.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu>
+% Copyright 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu>
% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr>
%
% This work is under the CC0 license.
@@ -111,7 +111,7 @@ See the aforementioned source file(s) for copyright and licensing information.
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \pkdate{luatexbase-modutils}{v0.4 2011-05-24}
+% \pkdate{luatexbase-modutils}{v0.5 2013-04-13}
%
% \maketitle
%
@@ -345,7 +345,7 @@ See the aforementioned source file(s) for copyright and licensing information.
\let\x\ProvidesPackage
\fi
\expandafter\endgroup
-\x{luatexbase-modutils}[2011/05/24 v0.4 Module utilities for LuaTeX]
+\x{luatexbase-modutils}[2013/04/13 v0.5 Module utilities for LuaTeX]
% \end{macrocode}
%
% Make sure \luatex is used.
@@ -378,10 +378,10 @@ See the aforementioned source file(s) for copyright and licensing information.
% supporting Lua module and make sure |luaescapestring| is available.
%
% \begin{macrocode}
-\ifdefined\RequirePackage
- \RequirePackage{luatexbase-loader}
-\else
+\expandafter\ifx\csname RequirePackage\endcsname\relax
\input luatexbase-loader.sty
+\else
+ \RequirePackage{luatexbase-loader}
\fi
\luatexbase@directlua{require('luatexbase.modutils')}
\luatexbase@ensure@primitive{luaescapestring}
@@ -552,7 +552,7 @@ function require_module(name, req_date)
local info = modules[name]
if not info then
warn("module '%s' was not properly identified", name)
- elseif info.version then
+ elseif req_date and info.version then
if not (info.date and date_to_int(info.date) > date_to_int(req_date))
then
warn("module '%s' required in version '%s'\n"
diff --git a/luatexbase.dtx b/luatexbase.dtx
index b962f30..49b0c07 100644
--- a/luatexbase.dtx
+++ b/luatexbase.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 2009, 2010 by Élie Roux <elie.roux@telecom-bretagne.eu>
+% Copyright 2009-2013 by Élie Roux <elie.roux@telecom-bretagne.eu>
% Copyright 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr>
%
% This work is under the CC0 license.
@@ -93,7 +93,7 @@ See the aforementioned source file(s) for copyright and licensing information.
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \pkdate{luatexbase}{v0.4 2011-05-24}
+% \pkdate{luatexbase}{v0.5 2013-04-13}
%
% \maketitle
%
@@ -126,18 +126,17 @@ See the aforementioned source file(s) for copyright and licensing information.
% change should happen in the future, except the removal of the deprecated
% commands (currently only \cs{setcatcoderange}). It works with the Plain and
% \latex formats adapted for \luatex as provided by \texlive and MiK\tex.
-% Currently the oldest version supported is 0.25.4 with formats from \texlive
-% 2008; the next release of this package will only support 0.40.6 and greater
-% with formats from \texlive 2009 and greater.
+% Currently the oldest version supported is 0.40.6 with formats from
+% \texlive 2009 and greater.
%
% \subsection{History}
%
% The first package for managing \luatex's new resources was the \pk{luatex}
-% package by Heiko Oberdiek. Later, Élie Roux wrote \pk{luatextra} which
+% package by Heiko Oberdiek. Later, \'Elie Roux wrote \pk{luatextra} which
% reprised many features of \pk{luatex} with little extensions to some of them
% and added independant low-level features (currently found in the
% \pk{modutils} and \pk{mcb} subpackages), as well as user-level things.
-% Later, \pk{luatexbase} was created by Manuel Pégourié-Gonnard by isolating
+% Later, \pk{luatexbase} was created by Manuel P\'egouri\'e-Gonnard by isolating
% the general low-level features of \pk{luatextra}, and later expanding on
% them.
%
@@ -215,7 +214,7 @@ See the aforementioned source file(s) for copyright and licensing information.
\let\x\ProvidesPackage
\fi
\expandafter\endgroup
-\x{luatexbase}[2011/05/24 v0.4 Module utilities for LuaTeX]
+\x{luatexbase}[2013/04/13 v0.5 Module utilities for LuaTeX]
% \end{macrocode}
%
% Make sure \luatex is used.
@@ -244,6 +243,21 @@ See the aforementioned source file(s) for copyright and licensing information.
\fi
% \end{macrocode}
%
+% %\subsection{luatex.sty compatibility}
+%
+% Currently, |luatex.sty| has to be loaded before luatexbase, otherwise it
+% raises an error, as the same names are used between luatexbase and luatex.
+%
+% This is a quite strange situation, but we hope to clarify it.
+%
+% \begin{macrocode}
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input luatex.sty
+\else
+ \RequirePackage{luatex}
+\fi
+% \end{macrocode}
+%
% \subsection{Packages loading}
%
% \begin{macrocode}