[latex3-commits] [git/LaTeX3-latex3-latex3] master: Make l3sys less repetitive (while avoiding l3clist use) (783b01e)

Bruno Le Floch bruno at le-floch.fr
Fri Apr 27 20:18:54 CEST 2018


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

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

commit 783b01e1b3deabd83b7ded72ab62e49a53a08b4e
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Fri Apr 27 14:18:54 2018 -0400

    Make l3sys less repetitive (while avoiding l3clist use)


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

783b01e1b3deabd83b7ded72ab62e49a53a08b4e
 l3kernel/l3sys.dtx |   65 +++++++++++++++++++---------------------------------
 1 file changed, 24 insertions(+), 41 deletions(-)

diff --git a/l3kernel/l3sys.dtx b/l3kernel/l3sys.dtx
index ad42851..c215656 100644
--- a/l3kernel/l3sys.dtx
+++ b/l3kernel/l3sys.dtx
@@ -187,64 +187,47 @@
 %     \sys_if_engine_xetex:
 %   }
 % \begin{variable}{\c_sys_engine_str}
+% \begin{macro}{\@@_tmp:n}
 %   Set up the engine tests on the basis exactly one test should be true.
 %   Mainly a case of looking for the appropriate marker primitive. For
 %   \upTeX{}, there is a complexity in that setting |-kanji-internal=sjis|
 %   or |-kanji-internal=euc| effective makes it more like \pTeX{}. In those
 %   cases we therefore report \pTeX{} rather than \upTeX{}.
 %    \begin{macrocode}
-\clist_map_inline:nn { lua , pdf , p , up , xe }
+\cs_set_protected:Npn \@@_tmp:n #1
   {
-    \cs_new_eq:cN { sys_if_engine_ #1 tex:T }  \use_none:n
-    \cs_new_eq:cN { sys_if_engine_ #1 tex:F }  \use:n
-    \cs_new_eq:cN { sys_if_engine_ #1 tex:TF } \use_ii:nn
-    \cs_new_eq:cN { sys_if_engine_ #1 tex_p: } \c_false_bool
+    \cs_new_eq:cN { sys_if_engine_ #1 :T }  \use_none:n
+    \cs_new_eq:cN { sys_if_engine_ #1 :F }  \use:n
+    \cs_new_eq:cN { sys_if_engine_ #1 :TF } \use_ii:nn
+    \cs_new_eq:cN { sys_if_engine_ #1 _p: } \c_false_bool
   }
-\cs_if_exist:NT \luatex_luatexversion:D
+\@@_tmp:n { luatex }
+\@@_tmp:n { pdftex }
+\@@_tmp:n { ptex }
+\@@_tmp:n { uptex }
+\@@_tmp:n { xetex }
+\cs_set_protected:Npn \@@_tmp:n #1
   {
-    \cs_gset_eq:NN \sys_if_engine_luatex:T  \use:n
-    \cs_gset_eq:NN \sys_if_engine_luatex:F  \use_none:n
-    \cs_gset_eq:NN \sys_if_engine_luatex:TF \use_i:nn
-    \cs_gset_eq:NN \sys_if_engine_luatex_p: \c_true_bool
-    \str_const:Nn \c_sys_engine_str { luatex }
-  }
-\cs_if_exist:NT \pdftex_pdftexversion:D
-  {
-    \cs_gset_eq:NN \sys_if_engine_pdftex:T  \use:n
-    \cs_gset_eq:NN \sys_if_engine_pdftex:F  \use_none:n
-    \cs_gset_eq:NN \sys_if_engine_pdftex:TF \use_i:nn
-    \cs_gset_eq:NN \sys_if_engine_pdftex_p: \c_true_bool
-    \str_const:Nn \c_sys_engine_str { pdftex }
+    \cs_gset_eq:cN { sys_if_engine_ #1 :T }  \use:n
+    \cs_gset_eq:cN { sys_if_engine_ #1 :F }  \use_none:n
+    \cs_gset_eq:cN { sys_if_engine_ #1 :TF } \use_i:nn
+    \cs_gset_eq:cN { sys_if_engine_ #1 _p: } \c_true_bool
+    \str_const:Nn \c_sys_engine_str {#1}
   }
+\cs_if_exist:NT \luatex_luatexversion:D { \@@_tmp:n { luatex } }
+\cs_if_exist:NT \pdftex_pdftexversion:D { \@@_tmp:n { pdftex } }
 \cs_if_exist:NT \ptex_kanjiskip:D
   {
     \bool_lazy_and:nnTF
       { \cs_if_exist_p:N \uptex_disablecjktoken:D }
       { \int_compare_p:nNn { \ptex_jis:D "2121 } = { "3000 } }
-      {
-        \cs_gset_eq:NN \sys_if_engine_uptex:T  \use:n
-        \cs_gset_eq:NN \sys_if_engine_uptex:F  \use_none:n
-        \cs_gset_eq:NN \sys_if_engine_uptex:TF \use_i:nn
-        \cs_gset_eq:NN \sys_if_engine_uptex_p: \c_true_bool
-        \str_const:Nn \c_sys_engine_str { uptex }
-      }
-      {
-        \cs_gset_eq:NN \sys_if_engine_ptex:T  \use:n
-        \cs_gset_eq:NN \sys_if_engine_ptex:F  \use_none:n
-        \cs_gset_eq:NN \sys_if_engine_ptex:TF \use_i:nn
-        \cs_gset_eq:NN \sys_if_engine_ptex_p: \c_true_bool
-        \str_const:Nn \c_sys_engine_str { ptex }
-      }
-  }
-\cs_if_exist:NT \xetex_XeTeXversion:D
-  {
-    \cs_gset_eq:NN \sys_if_engine_xetex:T  \use:n
-    \cs_gset_eq:NN \sys_if_engine_xetex:F  \use_none:n
-    \cs_gset_eq:NN \sys_if_engine_xetex:TF \use_i:nn
-    \cs_gset_eq:NN \sys_if_engine_xetex_p: \c_true_bool
-    \str_const:Nn \c_sys_engine_str { xetex }
+      { \@@_tmp:n { uptex } }
+      { \@@_tmp:n { ptex } }
   }
+\cs_if_exist:NT \xetex_XeTeXversion:D { \@@_tmp:n { xetex } }
+\cs_undefine:N \@@_tmp:n
 %    \end{macrocode}
+% \end{macro}
 % \end{variable}
 % \end{macro}
 %





More information about the latex3-commits mailing list