[latex3-commits] [git/LaTeX3-latex3-latex3] master: Fix l3kernel.charcat (a11b6e59b)

Marcel Fabian Krüger tex at 2krueger.de
Fri Oct 11 00:32:41 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/a11b6e59b1988cd953df8667877730141294f089

>---------------------------------------------------------------

commit a11b6e59b1988cd953df8667877730141294f089
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Fri Oct 11 00:32:41 2019 +0200

    Fix l3kernel.charcat
    
    Use tex.cprint if available to allow multiple uses of l3kernel.charcat
    affecting each other and avoid the use of a special catcode table.


>---------------------------------------------------------------

a11b6e59b1988cd953df8667877730141294f089
 l3kernel/l3luatex.dtx | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/l3kernel/l3luatex.dtx b/l3kernel/l3luatex.dtx
index cbc3d7a4e..bf02115b8 100644
--- a/l3kernel/l3luatex.dtx
+++ b/l3kernel/l3luatex.dtx
@@ -328,6 +328,7 @@ local os_clock   = os.clock
 local os_date    = os.date
 local setcatcode = tex.setcatcode
 local sprint     = tex.sprint
+local cprint     = tex.cprint
 local write      = tex.write
 %    \end{macrocode}
 %
@@ -359,10 +360,17 @@ end
 %   one is used. The latter is intended for format mode and should be adjusted
 %   to match an eventual allocator.
 %    \begin{macrocode}
-local charcat_table = l3kernel.charcat_table or 1
-local function charcat(charcode, catcode)
-  setcatcode(charcat_table, charcode, catcode)
-  sprint(charcat_table, utf8_char(charcode))
+local charcat
+if cprint then
+  function charcat(charcode, catcode)
+    cprint(catcode, utf8_char(charcode))
+  end
+else
+  local charcat_table = l3kernel.charcat_table or 1
+  function charcat(charcode, catcode)
+    setcatcode(charcat_table, charcode, catcode)
+    sprint(charcat_table, utf8_char(charcode))
+  end
 end
 l3kernel.charcat = charcat
 %    \end{macrocode}





More information about the latex3-commits mailing list