[latex3-commits] [git/LaTeX3-latex3-latex3] luaintarray: Address some comments (cd7d853e0)
Marcel Fabian Krüger
tex at 2krueger.de
Sat Nov 13 11:29:06 CET 2021
Repository : https://github.com/latex3/latex3
On branch : luaintarray
Link : https://github.com/latex3/latex3/commit/cd7d853e0c0a87fda80604f0c431375498c0a0ee
>---------------------------------------------------------------
commit cd7d853e0c0a87fda80604f0c431375498c0a0ee
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sat Nov 13 10:38:14 2021 +0100
Address some comments
>---------------------------------------------------------------
cd7d853e0c0a87fda80604f0c431375498c0a0ee
l3kernel/l3intarray.dtx | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/l3kernel/l3intarray.dtx b/l3kernel/l3intarray.dtx
index b3847bf18..7e59b577b 100644
--- a/l3kernel/l3intarray.dtx
+++ b/l3kernel/l3intarray.dtx
@@ -176,6 +176,13 @@
% There are two implementations for this module: One \cs{fontdimen} based one
% for more traditional \TeX\ engines and a Lua based one for engines with Lua support.
%
+% Both versions do not allow negative array sizes.
+% \begin{macrocode}
+%<*tex>
+\msg_new:nnn { kernel } { negative-array-size }
+ { Size~of~array~may~not~be~negative:~#1 }
+% \end{macrocode}
+%
% \subsection{Lua implementation}
% First, let's look at the Lua variant:
%
@@ -183,7 +190,6 @@
% the presence of \cs{@@_gset_count:Nw}.
%
% \begin{macrocode}
-%<*tex>
\cs_if_exist:NTF \@@_gset_count:Nw
{
%</tex>
@@ -207,11 +213,6 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macrocode}
-\msg_new:nnn { kernel } { negative-array-size }
- { Size~of~array~may~not~be~negative:~#1 }
-% \end{macrocode}
-%
% \begin{macro}{\s_@@}
% Used as marker for intarrays in Lua. Followed by an unbraced number
% identifying the array and a single space. This format is used to make it
@@ -221,7 +222,7 @@
%<*lua>
luacmd('s_@@', function()
scan_int()
- tex.error'Isolated intarray ignored'
+ tex.error'LaTeX Error: Isolated intarray ignored'
end, 'protected', 'global')
%</lua>
%<*tex>
@@ -284,8 +285,8 @@ local @@_table do
function @@_table()
local t = scan_token()
if t ~= s_@@ then
- token.put_next(t)
- tex.error'intarray expected'
+ put_next(t)
+ tex.error'LaTeX Error: intarray expected'
return tables[0]
end
local i = scan_int()
@@ -377,8 +378,7 @@ end, 'protected', 'global')
% \end{macro}
%
% \begin{macro}{\intarray_gset:Nnn, \intarray_gset:cnn, \__kernel_intarray_gset:Nnn}
-% Set the appropriate \tn{fontdimen}. The
-% \cs{__kernel_intarray_gset:Nnn} function does not use
+% The \cs{__kernel_intarray_gset:Nnn} function does not use
% \cs{int_eval:n}, namely its arguments must be suitable for
% \cs{int_value:w}. The user version checks the position and value
% are within bounds.
@@ -400,7 +400,7 @@ end, 'protected', 'global')
% \end{macro}
%
% \begin{macro}{\intarray_gzero:N, \intarray_gzero:c}
-% Set the appropriate \tn{fontdimen} to zero. No bound checking
+% Set the appropriate array entry to zero. No bound checking
% needed.
% \begin{macrocode}
%<*lua>
@@ -418,14 +418,14 @@ end, 'global', 'protected')
% \end{macro}
%
% \begin{macro}[EXP]{\intarray_item:Nn, \intarray_item:cn, \__kernel_intarray_item:Nn}
-% \begin{macro}{\@@_item:wNF,\@@_item:wN}
+% \begin{macro}{\@@_item:wF,\@@_item:w}
% Get the appropriate entry and perform bound checks. The
% \cs{__kernel_intarray_item:Nn} function omits bound checks and omits
% \cs{int_eval:n}, namely its argument must be a \TeX{} integer
% suitable for \cs{int_value:w}.
% \begin{macrocode}
%<*lua>
-luacmd('@@_item:wNF', function()
+luacmd('@@_item:wF', function()
local i = scan_int()
local t = @@_table()
local item = t[i]
@@ -438,7 +438,7 @@ luacmd('@@_item:wNF', function()
sprint(-2, item or 0)
end, 'global')
-luacmd('@@_item:wN', function()
+luacmd('@@_item:w', function()
local i = scan_int()
local t = @@_table()
sprint(-2, t[i])
@@ -449,10 +449,10 @@ end, 'global')
% \begin{macrocode}
%<*tex>
\cs_new:Npn \__kernel_intarray_item:Nn #1#2
- { \@@_item:wN #2 #1 }
+ { \@@_item:w #2 #1 }
\cs_new:Npn \intarray_item:Nn #1#2
{
- \@@_item:wNF \int_eval:n {#2} #1
+ \@@_item:wF \int_eval:n {#2} #1
{
\msg_expandable_error:nnfff { kernel } { out-of-bounds }
{ \token_to_str:N #1 } { \int_use:N \l_@@_bad_index_int } { \intarray_count:N #1 }
@@ -646,11 +646,6 @@ luacmd('@@_gset_range:w', function()
% \end{macrocode}
% \end{variable}
%
-% \begin{macrocode}
-\msg_new:nnn { kernel } { negative-array-size }
- { Size~of~array~may~not~be~negative:~#1 }
-% \end{macrocode}
-%
% \begin{macro}{\intarray_new:Nn, \intarray_new:cn}
% \begin{macro}{\@@_new:N}
% Declare |#1| to be a font (arbitrarily |cmr10| at a never-used
More information about the latex3-commits
mailing list.