[latex3-commits] [git/LaTeX3-latex3-latex3] master: Use 'native' code for l3benchmark/LuaTeX (72cc636)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Oct 24 23:06:48 CEST 2018


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

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

commit 72cc6369e5ed35f6b8ad0d541621f6f2ae52e3cd
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Oct 24 22:06:48 2018 +0100

    Use 'native' code for l3benchmark/LuaTeX
    
    This enables testing with LuaTeX.
    
    Some rearrangement so there is no question of 'partial' exposure of primitives.


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

72cc6369e5ed35f6b8ad0d541621f6f2ae52e3cd
 l3trial/l3benchmark/build.lua       |    3 ---
 l3trial/l3benchmark/l3benchmark.dtx |   28 ++++++++++++++++++----------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/l3trial/l3benchmark/build.lua b/l3trial/l3benchmark/build.lua
index 8fe86ee..6ec9b41 100644
--- a/l3trial/l3benchmark/build.lua
+++ b/l3trial/l3benchmark/build.lua
@@ -10,9 +10,6 @@ module = "l3benchmark"
 -- Location of main directory: use Unix-style path separators
 maindir = "../.."
 
--- Non-standard settings
-checkengines = {"pdftex", "xetex", "ptex", "uptex"}
-
 -- Load the common build code
 dofile(maindir .. "/build-config.lua")
 
diff --git a/l3trial/l3benchmark/l3benchmark.dtx b/l3trial/l3benchmark/l3benchmark.dtx
index caa9af3..421b335 100644
--- a/l3trial/l3benchmark/l3benchmark.dtx
+++ b/l3trial/l3benchmark/l3benchmark.dtx
@@ -181,19 +181,22 @@ end
 %
 % \begin{macro}{\@@_timer:}
 % \begin{macro}[pTF]{\sys_if_timer_exist:}
-%   In \LuaTeX{}, load Heiko's \pkg{pdftexcmds} to get
-%   \tn{pdf at elapsedtime}, otherwise try to locate the primitive.  The
+%   In \LuaTeX{}, use emulation (see \pkg{l3luatex}),
+%   otherwise try to locate the primitive.  The
 %   elapsed time will be available if this succeeds or if unrestricted
 %   shell escape is available.
 %    \begin{macrocode}
 \sys_if_engine_luatex:TF
   {
-    \RequirePackage{pdftexcmds} \scan_stop:
-    \cs_new_eq:NN \@@_timer: \pdf at elapsedtime
+    \cs_new_protected:Npn \@@_timer:
+      { \lua_now:n { l3kernel.elapsedtime() } }
+  }
+  {
+    \cs_if_exist:NT \tex_elapsedtime:D
+      { \cs_new_protected:Npn \@@_timer: { \tex_elapsedtime:D } }
   }
-  { \cs_new_eq:NN \@@_timer: \tex_elapsedtime:D }
 \@@_const:nn { sys_if_timer_exist }
-  { \cs_if_exist_p:N \@@_timer: || \sys_if_shell_unrestricted_p: }
+  { \cs_if_exist_p:N \@@_timer:|| \sys_if_shell_unrestricted_p: }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -205,11 +208,16 @@ end
 %   use the corresponding \enquote{resettimer} code for
 %   \cs{sys_timer_gzero:}.
 %    \begin{macrocode}
-\cs_if_exist:NTF \@@_timer:
+\bool_lazy_or:nnTF
+  { \cs_if_exist_p:N \tex_elapsedtime:D: }
+  { \cs_if_exist_p:N \lua_now:n }
   {
-    \cs_if_exist:NTF \pdf at resettimer
-      { \cs_new_eq:NN \sys_timer_gzero: \pdf at resettimer }
-      { \cs_new_eq:NN \sys_timer_gzero: \tex_resettimer:D }
+    \sys_if_engine_luatex:TF
+      {
+        \cs_new_protected:Npn \sys_timer_gzero:
+          { \lua_now:n { l3kernel.resettimer() } }
+      }
+      { \cs_new_protected:Npn \sys_timer_gzero: { \tex_resettimer:D } }
     \cs_new_protected:Npn \sys_timer_apply:N #1
       { \exp_args:No #1 { \int_value:w \@@_timer: } }
   }





More information about the latex3-commits mailing list