summaryrefslogtreecommitdiff
path: root/luatexbase-mcb.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'luatexbase-mcb.dtx')
-rw-r--r--luatexbase-mcb.dtx41
1 files changed, 28 insertions, 13 deletions
diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index b0ae1c9..d9fb995 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -266,12 +266,12 @@ See the aforementioned source file(s) for copyright and licensing information.
% Some callbacks have a calling convention that varies depending on the
% version of \luatex used. This package \emph{does not} try to track the type
% of the callbacks in every possible version of \luatex. The types are based
-% on the last stable beta version (0.60.2 at the time this doc is written).
+% on the last stable beta version (0.76 at the time this doc is written).
%
% However, for callbacks that have the same calling convention for every
% version of \luatex, this package should work with the same range of \luatex
-% version as other packages in the \pk{luatexbase} bundle (currently, 0.25.4
-% to 0.60.2).
+% version as other packages in the \pk{luatexbase} bundle (currently, 0.70
+% to 0.76).
%
% \section{Implementation}
%
@@ -332,7 +332,7 @@ See the aforementioned source file(s) for copyright and licensing information.
\let\x\ProvidesPackage
\fi
\expandafter\endgroup
-\x{luatexbase-mcb}[2013/05/11 v0.6 Callback management for LuaTeX]
+\x{luatexbase-mcb}[2013/06/08 v0.7 Callback management for LuaTeX]
% \end{macrocode}
%
% Make sure \luatex is used.
@@ -396,8 +396,8 @@ luatexbase = luatexbase or { }
local luatexbase = luatexbase
local err, warning, info, log = luatexbase.provides_module({
name = "luatexbase-mcb",
- version = 0.6,
- date = "2013/05/11",
+ version = 0.7,
+ date = "2013/06/08",
description = "register several functions in a callback",
author = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang",
copyright = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang",
@@ -442,7 +442,7 @@ local types = {
% \end{macrocode}
%
% Now, list all predefined callbacks with their current type, based on the
-% LuaTeX manual version 0.60.2.
+% LuaTeX manual version 0.76.
%
% \begin{macrocode}
local callbacktypes = callbacktypes or {
@@ -473,9 +473,10 @@ local callbacktypes = callbacktypes or {
%
% \begin{macrocode}
open_read_file = first,
+ reader = list,
+ close = simple,
read_font_file = first,
read_vf_file = first,
- read_ocp_file = first,
read_map_file = first,
read_enc_file = first,
read_sfd_file = first,
@@ -491,6 +492,7 @@ local callbacktypes = callbacktypes or {
% \begin{macrocode}
process_input_buffer = data,
process_output_buffer = data,
+ process_jobname = list,
token_filter = first,
% \end{macrocode}
%
@@ -513,6 +515,7 @@ local callbacktypes = callbacktypes or {
% Section 4.1.5: information reporting callbacks.
%
% \begin{macrocode}
+ pre_dump = simple,
start_run = simple,
stop_run = simple,
start_page_number = simple,
@@ -520,7 +523,13 @@ local callbacktypes = callbacktypes or {
show_error_hook = simple,
% \end{macrocode}
%
-% Section 4.1.6: font-related callbacks.
+% Section 4.1.6: PDF-related callbacks.
+%
+% \begin{macrocode}
+ finish_pdffile = simple,
+% \end{macrocode}
+%
+% Section 4.1.7: font-related callbacks.
%
% \begin{macrocode}
define_font = first,
@@ -572,7 +581,7 @@ local function listhandler (name)
for _, f in ipairs(callbacklist[name]) do
ret = f.func(head, ...)
if ret == false then
- warning("function '%s' returned false\nin callback '%s'",
+ log("function '%s' returned false in callback '%s'",
f.description, name)
break
end
@@ -611,14 +620,20 @@ local function firsthandler (name)
end
% \end{macrocode}
%
-% Handler for |simple| callbacks.
+% Handler for |simple| callbacks. If a function returns false, we return
+% this value, without going through other functions.
%
% \begin{macrocode}
local function simplehandler (name)
return function(...)
+ local ret
for _, f in ipairs(callbacklist[name]) do
- f.func(...)
+ ret = f.func(...)
+ if ret == false then
+ return false
+ end
end
+ return ret
end
end
% \end{macrocode}
@@ -980,7 +995,7 @@ end
% \begin{macrocode}
function add_hyphenate()
luatexbase.add_to_callback('hyphenate', function(head, tail)
- texio.write_nl("I'm a dummy hyphenate")
+ texio.write_nl("I'm a dummy (false) hyphenate") return false
end,
'dummy hyphenate')
luatexbase.add_to_callback('hyphenate', function(head, tail)