From 0e5d89e6d41c9fd2de8576ca0c98b9e295ab023a Mon Sep 17 00:00:00 2001 From: Stephan Hennig Date: Tue, 6 Nov 2012 20:00:01 +0100 Subject: Fix typos in luatexbase-attr documentation. --- luatexbase-attr.dtx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx index 923ad97..54ff8b5 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 -- cgit v1.2.3 From 522ac06e50f8155af51423a13cb6d06020b02443 Mon Sep 17 00:00:00 2001 From: Stephan Hennig Date: Tue, 6 Nov 2012 20:00:02 +0100 Subject: Fix typos in luatexbase-mcb documentation. --- luatexbase-mcb.dtx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx index b26f56f..6f1b1a6 100644 --- a/luatexbase-mcb.dtx +++ b/luatexbase-mcb.dtx @@ -141,7 +141,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 +156,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 +166,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. -- cgit v1.2.3 From b4e1f1e6c19a0784f88fd2696f976e190e3614e3 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sat, 27 Apr 2013 17:09:42 +0200 Subject: Hack to make newattributes work in cooperation with the oberdiek bundle --- luatex.dtx | 8 ++++++++ luatexbase-attr.dtx | 28 +++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) 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..afbb102 100644 --- a/luatexbase-attr.dtx +++ b/luatexbase-attr.dtx @@ -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,23 @@ 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] and 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") +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 +385,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 -- cgit v1.2.3 From 167c1b6ba8310c4adc0275fab52e746711aadab5 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sun, 28 Apr 2013 20:27:55 +0200 Subject: I had forgotten something... --- luatexbase-attr.dtx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx index be0a91c..ded08b3 100644 --- a/luatexbase-attr.dtx +++ b/luatexbase-attr.dtx @@ -363,10 +363,14 @@ attributes = {} % % \begin{macrocode} local luatex_sty_counter = 'LuT@AllocAttribute' -if tex.count[luatex_sty_counter] and 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") +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} % -- cgit v1.2.3