diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-30 03:00:43 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-30 03:00:43 +0000 |
commit | bbbe8128e7ae9d816a221377dbf5ff3969bb203b (patch) | |
tree | 0283a521760b879b30e61872f14f235645745675 /macros/latex/contrib | |
parent | 14ce8b68fe7df49e8a8891bb94c63b9a846da232 (diff) |
CTAN sync 201909300300
Diffstat (limited to 'macros/latex/contrib')
172 files changed, 4327 insertions, 3011 deletions
diff --git a/macros/latex/contrib/algobox/LICENSE b/macros/latex/contrib/algobox/LICENSE index 5abcef6643..139c404f65 100644 --- a/macros/latex/contrib/algobox/LICENSE +++ b/macros/latex/contrib/algobox/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. algobox - Copyright (C) 2016-2017 Julien RIVAUD + Copyright (C) 2016-2019 Julien RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - algobox Copyright (C) 2016-2017 Julien RIVAUD + algobox Copyright (C) 2016-2019 Julien RIVAUD This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/macros/latex/contrib/algobox/algobox.dtx b/macros/latex/contrib/algobox/algobox.dtx index 2e26eb79f4..068bc3a506 100644 --- a/macros/latex/contrib/algobox/algobox.dtx +++ b/macros/latex/contrib/algobox/algobox.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % vim: tw=80 % -%% File: algobox.dtx (C) Copyright 2016-2017 RIVAUD Julien +%% File: algobox.dtx (C) Copyright 2016-2019 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this @@ -11,11 +11,11 @@ % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\RequirePackage{expl3}[2016/01/19] +\RequirePackage{expl3}[2018/06/19] \def\ExplFileName{algobox} \def\ExplFileDescription{Typeset Algobox programs} -\def\ExplFileDate{2017/09/04} -\def\ExplFileVersion{1.2a} +\def\ExplFileDate{2019/09/29} +\def\ExplFileVersion{1.3} %</driver|package> %<*driver> \documentclass[full,a4paper]{l3doc} @@ -424,7 +424,7 @@ } \NewDocumentCommand \@@_FINALGORITHME:w {} { - \int_while_do:nNnn \l_@@_level_int > \c_zero { + \int_while_do:nNnn \l_@@_level_int > \c_zero_int { \@@_unindent: } \@@_block:nn {structure} {FIN_ALGORITHME} @@ -490,7 +490,7 @@ } \NewDocumentCommand \@@_FONCTION:w { +u{\;} } { - \int_while_do:nNnn \l_@@_level_int > \c_one { + \int_while_do:nNnn \l_@@_level_int > \c_one_int { \@@_unindent: } \@@_indent:nn {fonctions} {FONCTION} @@ -532,7 +532,7 @@ } \cs_new_protected_nopar:Nn \@@_topstructure:nn { - \int_while_do:nNnn \l_@@_level_int > \c_zero { + \int_while_do:nNnn \l_@@_level_int > \c_zero_int { \@@_unindent: } \@@_indent:nn {#1} {#2} @@ -545,7 +545,7 @@ } \cs_new_protected_nopar:Nn \@@_funcstructure:nn { - \int_while_do:nNnn \l_@@_level_int > \c_two { + \int_while_do:nNnn \l_@@_level_int > { 2 } { \@@_unindent: } \bool_if:nTF {#2}{\@@_indent:nn}{\@@_block:nn} {fonctions} {#1} diff --git a/macros/latex/contrib/algobox/algobox.ins b/macros/latex/contrib/algobox/algobox.ins index 5cd013ccbe..1f3abb0edc 100644 --- a/macros/latex/contrib/algobox/algobox.ins +++ b/macros/latex/contrib/algobox/algobox.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File algobox.ins (C) Copyright 2016-2017 RIVAUD Julien +File algobox.ins (C) Copyright 2016-2019 RIVAUD Julien It may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this diff --git a/macros/latex/contrib/algobox/algobox.pdf b/macros/latex/contrib/algobox/algobox.pdf Binary files differindex f8ee23f553..c2a8a7dc81 100644 --- a/macros/latex/contrib/algobox/algobox.pdf +++ b/macros/latex/contrib/algobox/algobox.pdf diff --git a/macros/latex/contrib/cellprops/LICENSE b/macros/latex/contrib/cellprops/LICENSE index c47740c712..82ae7cd1eb 100644 --- a/macros/latex/contrib/cellprops/LICENSE +++ b/macros/latex/contrib/cellprops/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. cellprops - Copyright (C) 2018 Julien "_FrnchFrgg_" RIVAUD + Copyright (C) 2016-2019 Julien "_FrnchFrgg_" RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - cellprops Copyright (C) 2018 Julien "_FrnchFrgg_" RIVAUD + cellprops Copyright (C) 2016-2019 Julien "_FrnchFrgg_" RIVAUD This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/macros/latex/contrib/cellprops/README.md b/macros/latex/contrib/cellprops/README.md index b09b4a5d35..740e9561b3 100644 --- a/macros/latex/contrib/cellprops/README.md +++ b/macros/latex/contrib/cellprops/README.md @@ -13,7 +13,7 @@ Look at the PDF documentation to see examples and detailed usage. -Copyright (C) 2018 Julien "_FrnchFrgg_" RIVAUD +Copyright (C) 2016-2019 Julien "_FrnchFrgg_" RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/macros/latex/contrib/cellprops/cellprops.dtx b/macros/latex/contrib/cellprops/cellprops.dtx index 1ee1a858b5..67b4dc8cd2 100644 --- a/macros/latex/contrib/cellprops/cellprops.dtx +++ b/macros/latex/contrib/cellprops/cellprops.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % vim: tw=80 spl=en % -%% File: cellprops.dtx (C) Copyright 2018 RIVAUD Julien +%% File: cellprops.dtx (C) Copyright 2016-2019 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this @@ -11,11 +11,11 @@ % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\RequirePackage{expl3}[2016/01/19] +\RequirePackage{expl3}[2018/06/19] \def\ExplFileName{cellprops} \def\ExplFileDescription{CSS-like cell and table properties} -\def\ExplFileDate{2018/07/16} -\def\ExplFileVersion{1.4} +\def\ExplFileDate{2019/09/29} +\def\ExplFileVersion{1.6} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -103,12 +103,12 @@ % text-align: left; % } % } -% \begin{array}{nnnn} +% \begin{array}{nnnp{5em}} % This is text & A_2 & A_3 & A_4 \\ % B1 & This is maths & B_3 & \\ % C1 & C_2 & X & Y \\ % D1 & D_2 & DX & v \\ -% E & F & \int_a^b f(t) dt & v \\ +% & F & \int_a^b f(t) dt & v \\ % \end{array} % \] % you can use: @@ -274,17 +274,17 @@ % \end{description} % % Most of these properties are straight-forward. You should check a -% CSS documentation to get more information. A very good source is the Mozilla +% CSS documentation to get more information. A very good source is the Mozilla % Developer Network. % % Here are the supported column types: % \begin{itemize} % \item "n": The most basic cell type, hbox, honoring all properties. -% \item "l", "c", and "r": Same as "n" but with forced "text-align". -% \item "M"\<coltype>: Same as \<coltype> but enforces "math-mode: math". The -% net effect is that "Mc" will create a centered column whose contents are -% in non-display math mode. -% \item "T"\<coltype>: Same as \<coltype> but enforces "math-mode: text". +% \item "l", "c" and "r": Same as "n" but with forced "text-align". +% \item "Ml", "Mc" and "Mr": Same as column "l", "c" and "r" but enforces +% "math-mode: math". The net effect is that "Mc" will create a centered +% column whose contents are in non-display math mode. +% \item "T"\<align>: Same as "M"\<align> but enforces "math-mode: text". % \item "p{"\<width>"}", "m"\<width> and "b"\<width>: parbox cell with the % corresponding vertical alignment (\cs{vtop}, \cs{vcenter} or \cs{vbox}). % \item "*{"\<count>"}{"\<coltypes>"}": same as in \pkg{array} or @@ -361,6 +361,7 @@ \RequirePackage{xparse} \RequirePackage{xcolor} +\RequirePackage{etoolbox} % \end{macrocode} % % \subsection{Loading and fixing \pkg{mdwtab}} @@ -458,7 +459,7 @@ \seq_map_inline:Nn \l_tmpa_seq { \tl_if_empty:nF {##1} { \exp_args:NNV \seq_set_split:Nnn \l_tmpb_seq \c_colon_str {##1} - \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} = \c_two { + \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} = { 2 } { \seq_get_left:NN \l_tmpb_seq \l_tmpa_tl \exp_args:NNV \str_set:Nn \l_tmpa_str \l_tmpa_tl \seq_get_right:NN \l_tmpb_seq \l_tmpa_tl @@ -516,7 +517,7 @@ \str_if_eq:nnTF {#2} {inherit} { \@@_generic_setter:nnn \exp_not:n {#1} {\c_@@_inherit_color_tl} }{ - \str_case_x:nnF { \str_range:nnn {#2} {1} {4} } { + \str_case_e:nnF { \str_range:nnn {#2} {1} {4} } { {rgb(} { \@@_generic_setter:nnn \use:n {#1} { \exp_not:n {\color[RGB]} {\str_range:nnn {#2} {5} {-2}} @@ -904,8 +905,36 @@ \exp_args:Nx \tab@preamble { \exp_not:N\@@_startrow: \the\tab@preamble \exp_not:N\@@_endrow: } } +% \end{macrocode} +% +% The color inheritance is handled with \cs{l_@@_inherit_color_tl}, +% \cs{l_@@_color_tl} and \cs{l_@@_bgcolor_tl}. The role of +% \cs{@@_update_color:Nn} is to set the inherit fallback to the already +% existing value of \verb|#1| then set \verb|#1| to the CSS value, which can be +% the inherit variable. +% +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_update_color:Nn { + \@@_get_property:nN {#2} \l_tmpa_tl + \exp_args:NV \tl_if_eq:NNF \l_tmpa_tl \c_@@_inherit_color_tl { + \tl_set_eq:NN #1 \l_tmpa_tl + } +} - +\cs_new_protected_nopar:Nn \@@_update_colors: { + \@@_update_color:Nn \l_@@_color_tl {color} + \@@_update_color:Nn \l_@@_bgcolor_tl {background-color} +} +% \end{macrocode} +% +% Patch the \cs{@array}, \cs{LT@array}, \cs{@mkpream}, \cs{endarray} and +% \cs{endlongtable} commands, so that we can properly setup our line and column +% counting system. This is the most brittle part of \pkg{cellprops}, and subject +% to compatibility problems with other packages that patch those (\pkg{hyperref} +% in particular). +% +% \begin{macrocode} +\AtEndPreamble{% \cs_set_eq:NN \@@_orig_array:w \@array \cs_set_protected_nopar:Npn \@array[#1]#2 { \@@_array_init: @@ -926,26 +955,6 @@ \@@_orig_LTarray:w [#1]{#2} \@@_array_startcontent: } -% \end{macrocode} -% -% The color inheritance is handled with \cs{l_@@_inherit_color_tl}, -% \cs{l_@@_color_tl} and \cs{l_@@_bgcolor_tl}. The role of -% \cs{@@_update_color:Nn} is to set the inherit fallback to the already -% existing value of \verb|#1| then set \verb|#1| to the CSS value, which can be -% the inherit variable. -% -% \begin{macrocode} -\cs_new_protected_nopar:Nn \@@_update_color:Nn { - \@@_get_property:nN {#2} \l_tmpa_tl - \exp_args:NV \tl_if_eq:NNF \l_tmpa_tl \c_@@_inherit_color_tl { - \tl_set_eq:NN #1 \l_tmpa_tl - } -} - -\cs_new_protected_nopar:Nn \@@_update_colors: { - \@@_update_color:Nn \l_@@_color_tl {color} - \@@_update_color:Nn \l_@@_bgcolor_tl {background-color} -} \cs_new_nopar:Nn \@@_end_array:n { \tl_if_empty:NF \g_@@_borders_tl { \\ } @@ -971,7 +980,7 @@ \bool_if:NF \g_@@_inrow_bool { \bool_gset_true:N \g_@@_inrow_bool \int_gincr:N \g_@@_row_int - \int_gset_eq:NN \g_@@_col_int \c_one + \int_gset_eq:NN \g_@@_col_int \c_one_int \dim_gzero:N \g_@@_ht_dim \dim_gzero:N \g_@@_dp_dim } @@ -1013,6 +1022,8 @@ } } +} + \cs_new_nopar:Nn \@@_fix_valign_end:n { \noalign{ \dim_set:Nn \l_tmpa_dim {#1} @@ -1020,7 +1031,7 @@ \exp_args:NV \tl_if_eq:nnTF \tab@hlstate {b} { \dim_gadd:Nn \tab@endheight { \g_@@_dp_dim + \l_tmpa_dim } }{ - \int_compare:nNnT \g_@@_row_int = \c_one { + \int_compare:nNnT \g_@@_row_int = \c_one_int { \dim_gadd:Nn \tab@endheight { \g_@@_ht_dim } } } @@ -1118,7 +1129,7 @@ \@@_begin_raw_cell:n { #1 \hbox_set:Nw \l_@@_cell_box - \str_case_x:nnF {\@@_get_property:n {math-mode}} { + \str_case_e:nnF {\@@_get_property:n {math-mode}} { { text } { \tab@btext } { math } { \tab@bmaths } }{% any other treated as |auto| @@ -1128,7 +1139,7 @@ } \cs_new_protected_nopar:Nn \@@_endcell: { - \str_case_x:nnF {\@@_get_property:n {math-mode}} { + \str_case_e:nnF {\@@_get_property:n {math-mode}} { { text } { \tab@etext } { math } { \tab@emaths } }{% any other treated as |auto| @@ -1179,7 +1190,7 @@ #1 \hbox_set_end: \@@_end_raw_cell: - \spewnotes\hfil + \spewnotes } \cs_new_protected_nopar:Nn \@@_begin_raw_cell:n { @@ -1341,17 +1352,7 @@ {\g_@@_dp_dim} {\box_dp:N \l_@@_cell_box} } - % Handle hpadding and halign - \skip_set:Nn \l_tmpa_skip { - \dim_max:nn - {0pt} - { (\@@_get_property:n {min-width}) - - \box_wd:N \l_@@_cell_box } - } - \skip_add:Nn \l_tmpa_skip { - 0pt plus 1fil - } - % padding-left and border-left + % Handle padding-left and border-left \@@_get_border_info:n {left} \skip_set:Nn \l_@@_left_skip {\@@_get_property:n {padding-left} + \l_@@_border_width_dim} @@ -1387,7 +1388,17 @@ \exp_not:n { \kern \c_zero_dim } } } - \str_case_x:nnF {\@@_get_property:n {text-align}} { + % Handle hpadding and halign + \skip_set:Nn \l_tmpa_skip { + \dim_max:nn + {0pt} + { (\@@_get_property:n {min-width}) + - \box_wd:N \l_@@_cell_box } + } + \skip_add:Nn \l_tmpa_skip { + 1sp plus 1fil + } + \str_case_e:nnF {\@@_get_property:n {text-align}} { { right } { \skip_add:Nn \l_@@_left_skip { \l_tmpa_skip } } @@ -1415,7 +1426,7 @@ \group_end: } \skip_horizontal:N \l_@@_left_skip - \box_use_clear:N \l_@@_cell_box + \box_use_drop:N \l_@@_cell_box \skip_horizontal:N \l_@@_right_skip \kern\c_zero_dim \group_end: diff --git a/macros/latex/contrib/cellprops/cellprops.ins b/macros/latex/contrib/cellprops/cellprops.ins index 6ca5339738..195394a7e7 100644 --- a/macros/latex/contrib/cellprops/cellprops.ins +++ b/macros/latex/contrib/cellprops/cellprops.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File cellprops.ins (C) Copyright 2016-2018 RIVAUD Julien +File cellprops.ins (C) Copyright 2016-2019 RIVAUD Julien It may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this diff --git a/macros/latex/contrib/cellprops/cellprops.pdf b/macros/latex/contrib/cellprops/cellprops.pdf Binary files differindex 20ebc28a52..18aba7b5e7 100644 --- a/macros/latex/contrib/cellprops/cellprops.pdf +++ b/macros/latex/contrib/cellprops/cellprops.pdf diff --git a/macros/latex/contrib/filecontentsdef/INSTALL b/macros/latex/contrib/filecontentsdef/INSTALL index 2657632382..b8685ab7ff 100644 --- a/macros/latex/contrib/filecontentsdef/INSTALL +++ b/macros/latex/contrib/filecontentsdef/INSTALL @@ -1,4 +1,4 @@ - Source: filecontentsdef.dtx (v1.4 2019/04/20) + Source: filecontentsdef.dtx (v1.5 2019/09/29) Author: Jean-Francois Burnol Info: filecontents + macro + verbatim License: LPPL 1.3c @@ -15,7 +15,7 @@ Use your installation manager. Else, for manual installation: - To extract the package and at the same time produce the - documentation, execute latex twice on filecontentsdef.dtx then + documentation, execute latex thrice on filecontentsdef.dtx then dvipdfmx on the dvi file. To customize the PDF documentation (paper size, etc...): execute diff --git a/macros/latex/contrib/filecontentsdef/README.md b/macros/latex/contrib/filecontentsdef/README.md index 305ecfc66d..77ed11d7b7 100644 --- a/macros/latex/contrib/filecontentsdef/README.md +++ b/macros/latex/contrib/filecontentsdef/README.md @@ -1,6 +1,6 @@ <!-- --> - Source: filecontentsdef.dtx (v1.4 2019/04/20) + Source: filecontentsdef.dtx (v1.5 2019/09/29) Author: Jean-Francois Burnol Info: filecontents + macro + verbatim License: LPPL 1.3c @@ -27,6 +27,40 @@ macro, but skips the save-to-a-file part. CHANGE LOG ========== +v1.5 \[2019/09/29\] +------------------- + +- `\filecontentsexec` does not forcefully reset `\newlinechar` + to its LaTeX default after execution. + +- `\FCD@` as prefix for internal non public macros. + +- drop usage of the legacy LaTeX mechanism which issued a warning + in case of a form feed or horizontal tabulation character in the + parsed contents. + +- make handling of the tabulation and form feed characters + customizable. + +- treat especially the case when the `\end{filecontents...}` + is not on a line of its own. + +- add `filecontentsdefstarred` (et al.) as alias for + `filecontentsdef*` (et al.) for easying up encapsulation in + wrapping environments. + +- breaking change: `filecontentsdef` and `filecontentsdefmacro` + define a macro obeying the local scope. Use `filecontentsgdef`, + resp. `filecontentsgdefmacro` for definitions with global scope. + +- make the name of the environment used by `\filecontentsprint` + customizable (it defaults to `verbatim`) and allow to pass options + to it; has been tested with `fancyvrb` and `minted`. + +- add `\filecontentsprintviascan` which allows to use verbatim-like + environment such as `listings` which are incompatible with + `\filecontentsprint`. + v1.4 \[2019/04/20\] ------------------- diff --git a/macros/latex/contrib/filecontentsdef/filecontentsdef.dtx b/macros/latex/contrib/filecontentsdef/filecontentsdef.dtx index b6b722383c..7f78abe135 100644 --- a/macros/latex/contrib/filecontentsdef/filecontentsdef.dtx +++ b/macros/latex/contrib/filecontentsdef/filecontentsdef.dtx @@ -2,28 +2,28 @@ % N.B.: this dtx file is NOT for use with \DocInput but only docstrip. % The latex source of the user manual isn't commented out. %<*none> -\def\dtxtimestamp{21-04-2019 at 15:24:14 CEST}% +\def\dtxtimestamp{29-09-2019 at 10:46:12 CEST}% %</none> %<*!readme&!install> %% %% Package: filecontentsdef -%% Version: 1.4 (2019/04/20) +%% Version: 1.5 (2019/09/29) %% License: LPPL 1.3c %% Copyright (C) 2016-2019 Jean-Francois Burnol <jfbu at free dot fr> %% %</!readme&!install> %<*none> \def\pkgname {filecontentsdef} -\def\pkgdate {2019/04/20} -\def\pkgdocdate {2019/04/21} -\def\pkgversion {v1.4} +\def\pkgdate {2019/09/29} +\def\pkgdocdate {2019/09/29} +\def\pkgversion {v1.5} \def\pkgdescription {filecontents + macro + verbatim (JFB)} \catcode`\^ 12 \iffalse %</none> %<*readme|install> <!-- --> - Source: filecontentsdef.dtx (v1.4 2019/04/20) + Source: filecontentsdef.dtx (v1.5 2019/09/29) Author: Jean-Francois Burnol Info: filecontents + macro + verbatim License: LPPL 1.3c @@ -52,6 +52,40 @@ macro, but skips the save-to-a-file part. CHANGE LOG ========== +v1.5 \[2019/09/29\] +------------------- + +- `\filecontentsexec` does not forcefully reset `\newlinechar` + to its LaTeX default after execution. + +- `\FCD@` as prefix for internal non public macros. + +- drop usage of the legacy LaTeX mechanism which issued a warning + in case of a form feed or horizontal tabulation character in the + parsed contents. + +- make handling of the tabulation and form feed characters + customizable. + +- treat especially the case when the `\end{filecontents...}` + is not on a line of its own. + +- add `filecontentsdefstarred` (et al.) as alias for + `filecontentsdef*` (et al.) for easying up encapsulation in + wrapping environments. + +- breaking change: `filecontentsdef` and `filecontentsdefmacro` + define a macro obeying the local scope. Use `filecontentsgdef`, + resp. `filecontentsgdefmacro` for definitions with global scope. + +- make the name of the environment used by `\filecontentsprint` + customizable (it defaults to `verbatim`) and allow to pass options + to it; has been tested with `fancyvrb` and `minted`. + +- add `\filecontentsprintviascan` which allows to use verbatim-like + environment such as `listings` which are incompatible with + `\filecontentsprint`. + v1.4 \[2019/04/20\] ------------------- @@ -104,7 +138,7 @@ Use your installation manager. Else, for manual installation: - To extract the package and at the same time produce the documentation, - execute latex twice on `filecontentsdef.dtx` then `dvipdfmx` on the + execute latex thrice on `filecontentsdef.dtx` then `dvipdfmx` on the `dvi` file. To customize the PDF documentation (paper size, etc...): execute `etex` @@ -172,7 +206,7 @@ of the project using it. \Msg{*\space\space\space\space \pkgname.sty^^J}% \Msg{*^^J}% \Msg{* To produce the documentation with source code included run latex^^J}% -\Msg{* twice on file \pkgname.tex and then dvipdfmx on \pkgname.dvi^^J}% +\Msg{* thrice on file \pkgname.tex and then dvipdfmx on \pkgname.dvi^^J}% \Msg{*^^J}% \Msg{* Happy TeXing!^^J}% \Msg{*^^J}% @@ -257,7 +291,7 @@ of the project using it. \newcommand\fcdname{% \texorpdfstring{{\color{joli}\ttfamily\bfseries \pkgname}}{\pkgname}\xspace} -\DeclareRobustCommand\csa [1] {{\ttfamily\hyphenchar\font45 \char`\\ #1}} +\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\ #1}} \newcommand\csh[1]{\texorpdfstring{\csa{#1}}{\textbackslash\detokenize{#1}}} @@ -292,25 +326,20 @@ pdfpagemode=UseOutlines} \usepackage{filecontentsdef} \makeatletter -% Revert change to \smash and other macros at LaTeX 2018/12/01 -% https://github.com/latex3/latex2e/issues/108 -\let\leavevmode@ifvmode\empty % for \smash in \NewWith etc... -\newcommand\inmarg [1]{\@bsphack +% \hbox needed since change to \smash and other macros at LaTeX 2018/12/01 +\def\NewWith #1{\@bsphack \vadjust{\vskip-\dp\strutbox - \smash{\hbox to 0pt - {\color[named]{PineGreen}\normalfont\small\bfseries + \hbox{\smash{\hbox to 0pt {\hss\color[named]{Thistle}% + \normalfont\small\bfseries \hsize 2.5cm\rightskip.5cm minus.5cm - \hyphenpenalty\z@\exhyphenpenalty\z@ - \doublehyphendemerits\z@\baselineskip9pt - \hss\vtop{\noindent#1}\kern.25cm }}% + \vtop{\noindent New with #1}\kern.25cm }}}% \vskip\dp\strutbox }\strut\@esphack} -%! 24 février 2014. J'ai besoin de me débarrasser du \to -\def\NewWith #1{\@bsphack +\def\ChangedAt #1{\@bsphack \vadjust{\vskip-\dp\strutbox - \smash{\hbox to 0pt {\hss\color[named]{Thistle}% + \hbox{\smash{\hbox to 0pt {\hss\color[named]{Thistle}% \normalfont\small\bfseries \hsize 2.5cm\rightskip.5cm minus.5cm - \vtop{\noindent New with #1}\kern.25cm }}% + \vtop{\noindent Changed at #1}\kern.25cm }}}% \vskip\dp\strutbox }\strut\@esphack} \makeatother @@ -361,21 +390,20 @@ pdfpagemode=UseOutlines} \href{https://ctan.org/pkg/attachfile}{attachfile}.) \end{abstract} -\section{Description} +\tableofcontents + +\section{Environments and macros} -This package provides the |filecontentsdef|\inmarg{|file\-contents\-def|} -environment. It is like |filecontents| but requires a second argument. This -argument will either be: +\subsection{\textcolor[named]{PineGreen}{\texttt{filecontentsdef}}, + \textcolor[named]{PineGreen}{\texttt{filecontentsgdef}}} + +The |filecontentsdef| environment is like |filecontents| but +requires a second argument. This argument will either be: \begin{itemize} -\item a single control sequence token such as |\macro|, -\item \mbox{}\NewWith{v1.4$\to$}or anything else which then must after expansion be +\item a single control sequence token such as |\foo|, +\item or anything else which then must after expansion be usable as a macro \emph{name} (it will be handled via |\csname...\endcsname| encapsulation). -% Bordel, que d'emmerdements avec le LaTeX \footnote et \verb ! On ne peut même -% pas faire \string\fi (ou \else, ou \if pas vérifié lequel des trois: -% incomplete \ifmmode -%\footnote{ -% Bon ben finalement pas de footnote de toute façon. Déjà fait le mark-up je laisse. For example \texttt{\string\myitemnumber\{3\}} can be used as argument and it will then be expanded inside \texttt{\string\csname...\string\endcsname} to construct a control sequence, whose name will possibly contain digits or @@ -383,13 +411,11 @@ argument will either be: allowed as long as its expansion is \texttt{\string\csname...\string\endcsname} compatible; the character itself will \emph{not} be assigned a new meaning. -%} -% \end{itemize} Thus the syntax is either: \begin{verbatim} - \begin{filecontentsdef}{<filename>}{\macro} + \begin{filecontentsdef}{<filename>}{\foo} ... arbitrary contents ... \end{filecontentsdef} \end{verbatim} @@ -401,22 +427,32 @@ or: \end{verbatim} The environment creates the file and stores its (verbatim) contents into its -second argument |\macro| (or into the macro |\<macro name>| with given name). +second argument |\foo| (or into the macro |\<macro name>| with given name). + +\begin{framed} + Hint: if some |\foo| contains the \emph{name} of the macro to be defined, use + |\empty\foo| as argument, thus avoiding |\foo| itself to get overwritten by + the environment. +\end{framed} \begin{enumerate} -\item The starred variant acts like |filecontents*| environment regarding the - file contents. +\item The starred variant |filecontentsdef*| acts like + |filecontents*| environment regarding the file contents, i.e. + it drops addition of a (\TeX) commented out header. +\item |filecontentsdefstarred| is an alias for + |filecontentsdef*|.\NewWith{v1.5} \item The contents put into the macro are the same for the starred and - non-starred environments: they do not contain the commented-out header. -\item The scope of the macro definition is global. + non-starred environments: neither contains a commented-out header. +\item The scope of the macro definition is + \textbf{local}.\ChangedAt{v1.5} +\item + Use |filecontentsgdef| for a definition with global scope.\NewWith{v1.5} \item No check is done on whether the defined macro pre-existed. -% \item |filecontentshere| is a wrapper of the |filecontentsdef| -% environment using \csa{filecontentsheremacro} as the macro where the -% contents are stored.\inmarg{\csa{file\-contents\-here\-macro}} This macro -% can then be reused elsewhere if wanted. -\item The macro holds a verbatim rendering of the contents, which handles the - Form Feed and Tabulation characters analogously to the |filecontents| - treatment. +\item The macro holds a verbatim rendering of the contents, with active spaces + and active |^^M| tokens. +\item The handling of the\NewWith{v1.5} + Form Feed and Tabulation characters can be, contrarily to the |filecontents| + treatment, customized. See \autoref{sec:tab}. \item Babel shorthands will be neutralized the same way they are when encountered in a verbatim environment or in a |filecontents| environment. Their action is reactivated if the macro (assuming the @@ -425,13 +461,10 @@ second argument |\macro| (or into the macro |\<macro name>| with given name). \item The environment can be used either in the preamble or the body of the document. \item The contents must not contain themselves a - \texttt{\string\end}|{filecontentsdef}| (or |end{filecontentsdef*}| in the + \texttt{\string\end}|{filecontentsdef}| (or \texttt{\string\end}|{filecontentsdef*}| in the starred case). -\item If some |\macro| contains the \emph{name} of the macro to be defined, - use then |\empty\macro| as argument, this trick will avoid the environment - thinking it is supposed to redefine |\macro| itself. % problème avec Emacs/AUCTeX et |\end{...}| qui fait boguer le fontlock -% biarrement le deuxième ne pose pas de problème. 19 avril 2019. +% bizarrement le deuxième ne pose pas de problème. 19 avril 2019. \end{enumerate} \begin{footnotesize} @@ -442,8 +475,8 @@ starred case). \item the space becomes the active character of ascii code |32|, \item the end of line is converted into the active character |^^M| (i.e. ascii code |13|), -\item the tabulation character |CTRL-I| becomes the active space character, -\item the form feed character |CTRL-L| is converted into a pair of active |^^M|, +\item see \autoref{sec:tab} for the handling of the horizontal tabulation + and form feed characters, \item the active bytes of ascii code between |128| and |255| (this is now systematically the case with |inputenc+utf8| being default) are stored into the produced macro ``as is'', @@ -455,22 +488,44 @@ display as expected in a verbatim rendering, see \csa{filecontentsprint} next. \par \end{footnotesize} -\medskip +\subsection{\textcolor[named]{PineGreen}{\texttt{filecontentsdefmacro}}, + \textcolor[named]{PineGreen}{\texttt{filecontentsgdefmacro}}} -The \csa{filecontentsprint}\inmarg{\csa{file\-contents\-print}} macro has a +This environment +\begin{verbatim} + \begin{filecontentsdefmacro}{\foo or macro name} + ... arbitrary contents ... + \end{filecontentsdefmacro} +\end{verbatim} +was added at |v1.4|. It is like |filecontentsdef| without the +``save to file'' part... and has thus a sole mandatory argument which may be +either a control sequence or a name (or material expanding to name), as +previously described. The macro can then be either printed verbatim via +\csa{filecontentsprint} or, if it consists of \LaTeX\ code, be executed in +re-tokenized form via \csa{filecontentsexec}. + +Its name is thus a bit paradoxical but was chosen to share an existing prefix +with the other package macros and environments. + +\subsection{\textcolor[named]{PineGreen}{\csh{filecontentsprint}}, +\textcolor[named]{PineGreen}{\csh{FCDprintenvname}}, +\textcolor[named]{PineGreen}{\csh{FCDprintenvoptions}}} + + +\csa{filecontentsprint} has a unique mandatory argument which will be either: \begin{itemize} -\item a single control sequence token (for example |\macro|), -\item \mbox{}\NewWith{v1.4$\to$}or anything else which then must after expansion be +\item a single control sequence token (for example |\foo|), +\item or anything else which then must after expansion be usable as a macro \emph{name} (for example |macro|). It will be handled via |\csname...\endcsname| encapsulation (see earlier explanations).% \end{itemize} -The |\macro| must be of the type constructed by the environment -|filecontentsdef|. It will be then be printed exactly as +The |\foo| must be of the type constructed by the environments +|filecontentsdef| or |filecontentsdefmacro|. It will be then be printed exactly as \begingroup\makeatletter\def\x{\let\@xverbatim\relax \verbatim \string\begin\string{verbatim\string}\par -<contents of \string\macro>\par +<contents of \string\foo>\par \string\end\string{verbatim\string}\par \endverbatim% \endgroup}\x @@ -483,11 +538,6 @@ This uses underneath the |verbatim| environment and has been \href{http://www.ctan.org/pkg/verbatim}{verbatim} (whose mechanism is quite different from the one of the default |verbatim| environment.) -%xxx -% MARRE DE EMACS/AUCTEX QUI SE CROIT PLUS INTELLIGENT QUE L'UTILISATEUR POUR -% L'INDENTATION PAR FILL-PARAGRAPH (M-q) -%xxx - \begin{framed} Due to limitation of the |verbatim| environment, the \texttt{\string\end}|{verbatim}| must not appear inside the contents... else @@ -498,30 +548,182 @@ This uses underneath the |verbatim| environment and has been affects \csa{filecontentsprint}, not \csa{filecontentsexec}. \end{framed} +The name of the used environment is held in macro +\textcolor[named]{PineGreen}{\csa{FCDprintenvname}}.\NewWith{v1.5} +Redefine it to modify the environment name from its default |verbatim|. + +Furthermore\NewWith{v1.5} the macro +\textcolor[named]{PineGreen}{\csa{FCDprintenvoptions}} can be used to pass +options to that environment. + +Here is a set-up using |fancyvrb| which I tested with success: +\begin{verbatim} +\documentclass{article} +\usepackage{filecontentsdef} +\usepackage{xcolor} +\usepackage{fancyvrb} +\usepackage{fvextra} + +% store tabs as active characters so they can be handled by fancyvrb +{\catcode`\^^I=\active\gdef\FCDtabtomacro{\noexpand^^I}} + +% Use fancyvrb Verbatim environment +\renewcommand*\FCDprintenvname{Verbatim} + +% with these options. This will be submitted to an \edef, so we +% simply wrap in \unexpanded to avoid problems +\renewcommand*\FCDprintenvoptions{% + \unexpanded{[fontsize=\scriptsize, highlightlines={1, 3-4}, + numbers=both, showspaces, spacecolor=red, + showtabs, %tab=\rightarrowfill% incompatible with linebreaks? + breaklines,breakbefore=\\\space]}% +} +\begin{filecontentsdefmacro}{\testfancyvrb} +some contents with long lines and tabs to test the options +\end{filecontentsdefmacro} +\end{verbatim} + +Here is now a set-up with |minted| which worked also (although the syntax +highlighting was not handling correctly control sequences using the @ letter, +but I am not knowledgeable enough in the Pygmentize library): + +\begin{verbatim} +\documentclass{article}% needs shell-escape +\usepackage{filecontentsdef} +\usepackage{minted} +\newminted{tex}{linenos} + +\renewcommand*\FCDprintenvname{texcode} + +\begin{filecontentsdefmacro}{\testminted} +some TeX macros +\end{filecontentsdefmacro} + +\begin{document} +\filecontentsprint\testminted +\end{document} +\end{verbatim} + +\subsection{\textcolor[named]{PineGreen}{\csh{filecontentsprintviascan}}} + +It is not possible to use a |listings| environment via \csa{filecontentsprint} +and \csa{FCDprintenv}, because |listings| has a special way to identify where +it ends and this is incompatible with the \csa{filecontentsprint} approach. + +At |v1.5| +\csa{filecontentsprintviascan} is added\NewWith{v1.5} which is more powerful +than \csa{filecontentsprint} as it should work not only with verbatim +environments known to be compatible with \csa{filecontentsprint} but +also with environments of the |listings| type. But this requires \eTeX{} +\csa{scantokens} (it uses \csa{filecontentsexec}, see next).% +% +\footnote{I know that the \LaTeX{} kernel itself requires \eTeX{} for a few + years now, but \fcdname could have been installed on an old machine...} + +Here is an example of usage which worked for me (although the syntax +highlighting, like the one from |minted|, was not fully satisfying): + +\begin{verbatim} +\documentclass{article} +\usepackage{filecontentsdef} +\usepackage{xcolor} +\usepackage{listings} +\lstnewenvironment{latexverbatim} + {\lstset{ + basicstyle=\small\ttfamily, + breaklines=true, + columns=fullflexible, + language=[LaTeX]TeX, + numbers=left, + numbersep=1em, + numberstyle=\tiny\color{gray}, + keywordstyle=\color{red}}}{} + +\renewcommand*\FCDprintenvname{latexverbatim} + +\begin{document} + +\begin{filecontentsdefmacro}{\testlistings} +\gdef\filecontentsprintviascan{\FCD@get\FCD@printviascan}% +\gdef\FCD@printviascan#1{% + \toks@\expandafter{#1}% + \edef\FCD@envwithcontents{% + \noexpand\begin{\FCDprintenvname}\FCDprintenvoptions\noexpand^^M% + \the\toks@\@backslashchar end{\FCDprintenvname}\noexpand^^M}% + \FCD@exec\FCD@envwithcontents}% +\end{filecontentsdefmacro} + +\filecontentsprintviascan\testlistings +\end{document} +\end{verbatim} + +\subsection{\textcolor[named]{PineGreen}{\csh{filecontentsexec}}} + Although \fcdname itself generally does not require \eTeX, it provides as a -convenience \csa{filecontentsexec}\inmarg{\csa{file\-contents\-exec}} which +convenience \csa{filecontentsexec} which does require it as it uses |\scantokens| to re-assign the current catcode regime to the verbatimized tokens stored into its mandatory argument. Again -the mandatory argument may have one of the two forms described previously.% -\NewWith{v1.4$\to$} +the mandatory argument may have one of the two forms described previously. And of course this assumes that the tokens provide legitimate \LaTeX\ code. \begin{footnotesize} - \textbf{TeX-hacker note:} As an aftereffect, the |\newlinechar| will be set - to |10| (its \LaTeX\ default) after execution; we skipped the saving and - restoring of its value (it is temporarily set to |13| for |\scantokens| - execution). No group is used in order to not create an extra scoping of the - executed macro contents. + \textbf{TeX-hacker note:} No group is used in order to not create an extra + scoping of the executed macro contents. + + \textbf{TeX-hacker note:} In the case of storage in a macro of some \LaTeX{} + contents, and re-parsing via |\filecontentsexec| which uses + |\scantokens|, the last line before the + \texttt{\string\end}|{filecontentsdef}| + or |\end{filecontentsdefmacro}| potentially generates an end of line + character, typically a space token (but this depends on the + \csa{endlinechar} valid at this location + setting). Such a space coming from the last end of line has no impact if + the \LaTeX{} contents get executed in vertical mode. In horizontal mode it + will be avoided if these contents end with a |%| + or also with some control sequence such as a |\relax| or + |\empty| (only if \csa{endlinechar} is standard). + + At |v1.5|\NewWith{v1.5} a special convention is added that if the + \texttt{\string\end}|{filecontentsdef}| (or variants) stands on + the same line as the last line of the contents, rather than being on + a line of its own, then the stored contents will get postfixed with + an added \csa{empty} token. Thus execution via + \csa{filecontentsexec} in horizontal mode will not induce any ending + space token (assuming the \csa{endlinechar} is then at its standard + setting). This feature is to be used only with contents representing + \TeX{} macros, as the \csa{empty} makes sense only in that context. + This token will remain invisible in the PDF output from + \csa{filecontentsprint}. + + No \csa{empty} + gets added to the last line of the exported file (if there is one). + The original |filecontents| environment issues a warning when there is + contents before the end of the environment on the same line, this warning is + now skipped.\ChangedAt{v1.5} + + This extra \csa{empty} + added only under such special usage of the environment is not currently + customizable, but I can add such a feature if there is a user request. + + \textbf{TeX-hacker note:} one should not think that using + \csa{filecontentsexec} with some stored material will behave like copying + pasting that material directly at that very location of the source code: for + example if the last line ends with a |%| + this does not mean that this will comment out what is next in the source + code on the same line after the \csa{filecontentsexec}! It is more analogous + to making first a macro definition with the contents and then execute that + macro. But it is not possible for some macro from inside these contents to + itself grab tokens coming next after the \csa{filecontentsexec}\csa{foo} + (moreover, \fcdname adds tokens of its own in order restore the + \csa{newlinechar}). - \textbf{TeX-hacker note:} A space token will be present at the end of the - expansion, due to |\scantokens|'s way of working, but may be hidden by the - nature of the contents themselves, if for example they end with a |\relax| - or a |%|, or from arising in vertical mode. \end{footnotesize} -The environment\inmarg{|file\-contents\-here|} +\subsection{\textcolor[named]{PineGreen}{\texttt{filecontentshere}}} + +This environment \begin{verbatim} \begin{filecontentshere}{<filename>} ... arbitrary contents ... @@ -538,84 +740,79 @@ and then immediately \begin{verbatim} \filecontentsprint\filecontentsheremacro \end{verbatim} -The |\filecontentsheremacro| remains available for reuse with |\filecontentsexec|. +The |\filecontentsheremacro| is then available for usage as argument +of |\filecontentsexec|. Since |v1.5| its definition has only +local scope. +\ChangedAt{v1.5} + +The environment has a starred variant +|filecontentshere*| (also |filecontentsherestarred|) which does the +expected thing. For example \begin{verbatim} -\begin{filecontentshere}{\jobname.test} +\begin{filecontentshere*}{\jobname.test} \begin{framed} \noindent We have coded this in \LaTeX: both $E=mc^2$ (input as \verb|$E=mc^2$|) and $E=h\nu$ owe much to \textsc{Albert Einstein}. \end{framed} -\end{filecontentshere} +\end{filecontentshere*} \filecontentsexec\filecontentsheremacro \end{verbatim} -will produce the external file with extension -|.test| and have this effect in the document (verbatim framed then real framed): -\begin{filecontentshere}{\jobname.test} +will produce an external file with the above contents and have this +effect in the document (verbatim framed then real framed): +\begin{filecontentshere*}{\jobname.test} \begin{framed} \noindent We have coded this in \LaTeX: both $E=mc^2$ (input as \verb|$E=mc^2$|) and $E=h\nu$ owe much to \textsc{Albert Einstein}. \end{framed} -\end{filecontentshere} +\end{filecontentshere*} \filecontentsexec\filecontentsheremacro -The environment\inmarg{|file\-contents\-def\-macro|} -\begin{verbatim} - \begin{filecontentsdefmacro}{\macro or macro name} - ... arbitrary contents ... - \end{filecontentsdefmacro} -\end{verbatim} -was added at |v1.4|.\NewWith{v1.4} It is like |filecontentsdef| without the -``save to file'' part... and has thus a sole mandatory argument which may be -either a control sequence or a name (or material expanding to name), as -previously described. The macro can then be either printed verbatim via -\csa{filecontentsprint} or, if it consists of \LaTeX\ code, be executed in -re-tokenized form via \csa{filecontentsexec}. - -Its name is thus a bit paradoxical but was chosen to share an existing prefix -with the other package macros and environments. - \section{How to wrap usage of \texttt{filecontentsdef} in another environment} -It is simple: don't use |\begin/\end| syntax -% \verb|\end{filecontentsdef}|, % uniquement à cause de bug de Emacs/AUCTeX -% % fontlocking -but |\begingroup\filecontentsdef{..}{..}| and |\endfilecontentsdef\endgroup|. +Don't use the |\begin/\end| syntax but directly +|\begingroup\filecontentsdef{..}{..}| and |\endfilecontentsdef\endgroup|. And these should come last, respectively first, in the definition of the begin, respectively end, part of the new environment. -The extra |\begingroup...\endgroup| is needed only to the extent that -definitions and catcode assignments could affect the execution of the -rest of the |end| part of the new environment. As this |end| part will -be tokenized at time of definition, it will in general be indifferent to -the catcode modifications done by \csa{filecontentsdef} and generally -speaking the |\begingroup...\endgroup| can be dropped. - -Of course, for wrapping the starred variant one should use -% PUTAIN DE BORDEL DE Text for \verb command ended by end of line, QU'EST-CE -% QUE LATEX EST CHIANT. Plus le fill-paragraph de Emacs et le doctex-mode défectueux. -|\csname filecontentsdef*\endcsname|, or make the definition with |*| having catcode -letter. But the \verb|\endfilecontentsdef| can drop the |*|, as the starred -environments defined by the \fcdname package use the same ending macros as -their non-starred variants. +The extra |\begingroup...\endgroup| are mandatory with the +\fcdname environments making a local scope definition.\ChangedAt{v1.5} + +For those creating global scope macros, |\begingroup...\endgroup| +is recommended, as the \LaTeX{} state is not completely clean +after |\endfilecontentsgdef| (et al.) execution. Thus it is +better to have the extra |\begingroup...\endgroup| pair always +(which are a part of the things added by the |\begin/\end| syntax). + +For wrapping the starred variant one needs to use +|\csname filecontentsdef*\endcsname|, or make the definition with |*| +having catcode letter. A simpler way is to use the alias ending +in |...starred|.\NewWith{v1.5} Regarding the ending macro its +name can drop the |*|, as the starred environments defined by the +\fcdname package use the same ending macros as their non-starred +variants. As exercise, let's imagine we want an environment which will be associated to some counter, will automatically increment it at each usage, and will -use this counter to index the files and macros created on each invocation. +use this counter to index the files and macros created on each +invocation. +Except if you know how to smuggle how a macro from an environment +you probably want to use |filecontentsgdef| in order for the +macro to have global scope. \begin{filecontentsdefmacro}{\pablo} \newcounter{pablo} \newenvironment{defexercise} {\stepcounter{pablo}% \begingroup - \csname filecontentsdef*\endcsname + \filecontentsgdefstarred {\jobname-ex\the\value{pablo}}{exercise-\the\value{pablo}}}% - {\endfilecontentsdef\endgroup} + {\endfilecontentsgdefstarred\endgroup} \newcommand{\printexercise}[1]{\filecontentsexec{exercise-\the\numexpr#1\relax}} \end{filecontentsdefmacro} \filecontentsprint\pablo @@ -649,11 +846,155 @@ This produces in the document: Additionally, three small files were created containing the \LaTeX\ mark-up for each exercise. + +\section{How to customize handling of tabulation and form feed characters} +\label{sec:tab} + +\LaTeX{} assigns catcode 10 by default to |^^I| meaning that it is handled by +default as a space character: +\begin{filecontentsdefmacro}{\coucou} +\def\test{^^I} +\ifx\test\space \textcolor{blue}{OK}\else \ERROR\fi +\end{filecontentsdefmacro} +\filecontentsprint\coucou +\filecontentsexec\coucou + +But \fcdname like the original |filecontents| environment assigns active +catcode to the tabulation character before parsing the contents. This allows +special treatment. + +\begin{framed} + Attention that if input as |^^I| (in opposition to the real ascii character + of ascii code 9), it will end up simply as |^^I| in external file or macro, + because the caret loses its special meaning in the environment. + + The discussion in this section about customizing \fcdname behaviour applies + only to a source with a real tabulation character, not one in \TeX{} notation + |^^I|. +\end{framed} + +With +|v1.5|, \fcdname diverges from original |filecontents| by adding the means to +customize the handling of such tabulation character, rather than simply raising +a warning and exporting it as a space like original |filecontents|. And also +the handling of the form feed character can be customized. + +This is controlled via four control sequences whose default definitions are +the following:\NewWith{v1.5} +\begin{verbatim} +\def\FCDtabtofile{ }% + +{\catcode32\active\gdef\FCDtabtomacro{\noexpand }}% + +\def\FCDformfeedtofile{^^J^^J}% + +{\catcode`\^^M\active\gdef\FCDformfeedtomacro{\noexpand^^M\noexpand^^M}}% +\end{verbatim} + +Each of \csa{FCDtabtofile}, \csa{FCDtabtomacro}, +\csa{FCDformfeedtofile}, \csa{FCDformfeedtomacro} gets used via an +expansion inside an \csa{edef}, hence the need for \csa{noexpand} in front +of active characters. The |^^J| in \csa{FCDformfeedtofile} matches +the default newline character (ascii code 10) of \LaTeX{} for +exporting files. The active |^^M| is used for macro storage +because this is the most suitable for verbatim printing via +\csa{filecontentsprint} as typically in a verbatim environment end +of lines get converted into such active |^^M| (which will create +a |\par| token). + +If you want for example tabulation characters to get converted into four +spaces, use: +\begin{verbatim} +\def\FCDtabtofile{\space\space\space\space}% +{\catcode32\active\gdef\FCDtabtomacro{\noexpand \noexpand \noexpand \noexpand }}% +\end{verbatim} +I have here used for macro storage active spaces. The \csa{noexpand} are +mandatory in such case, but they will disappear from stored contents in a +macro. We could also have defined \csa{FCDtabtofile} as an alias to +\csa{FCDtabtomacro} here because a non-expanding active space will simply give a +space in the external file. Due to \TeX{} tokenization rules +|\def\FCDtabtofile{ }| would be the same as with only one single space and +thus we used |\space\space\space\space|. + +If you want an actual tabulation character stored to a file, use: +\begin{verbatim} +{\catcode`\^^I=12 \gdef\FCDtabtofile{^^I}} +\def\FCDtabtomacro{TAB} +\end{verbatim} +The second line is for demonstration only as an example of how to store the +tabulation character in a macro, use anything adequate to replace \texttt{TAB} +as used here. For example you can store in it the actual tabulation (ascii code +9) with catcode 12, via using rather |\let\FCDtabtomacro\FCDtabtofile| in the +above. Or use some Unicode symbol and appropriate font configuration. + +Here is an example. This is rendered via |verbatim| which will treat the +tabulation characters as spaces, but they are there in the original: +\begin{verbatim} +{\catcode`\^^I=12 \gdef\FCDtabtofile{^^I}} +\let\FCDtabtomacro\FCDtabtofile +\begin{filecontentshere}{\jobname-tab.test} +Here is a tab and then three in a row . +\end{filecontentshere} +(we will see them in the PDF output via the glyph at slot 9 of the T1 encoding). +\end{verbatim} +Here is what the original produces indeed when executed: +{\catcode`\^^I=12 \gdef\FCDtabtofile{^^I}} +\let\FCDtabtomacro\FCDtabtofile +\begin{filecontentshere}{\jobname-tab.test} +Here is a tab and then three in a row . +\end{filecontentshere} +The way it looks in the PDF is due to our definition of \csa{FCDtabtomacro} +which gives a catcode12 character of ascii code 9, and we use T1 +font-encoding. The exported file does contain on the other hand as promised a +real tabulation character. + \begin{footnotesize} + \begin{framed} + \LaTeX{} since 2018 uses by default |\usepackage[utf8]{inputenc}| and + almost all control characters are given active catcode. Exceptions: |^^@| + (illegal), |^^I| (treated as space), |^^J| (for some reason it gets catcode + 12 and thus will if printed to PDF give the glyph at slot 10 of the font + encoding), and |^^M| (end of line). + + Notice that such a control character which in the source gets input using + \TeX{} notation, for example |^^P|, causes no issue to \fcdname as the + caret |^| has lost its special catcode. Thus a |^^P| will be printed to + external file. + + If one tries to use directly in the source the CTRL-P, an error will be + raised by \LaTeX{} triggered by the active character (\fcdname does not + sanitize catcodes in this ascii range, as original |filecontents| + environment does not either). + + One can always reassign catcodes, thus you can set the catcode of |^^P| to + 12 for example. However, when exporting such a control character with + catcode 11 or 12 to a file, pdflatex uses |^^| notation in the output. + There are three exceptions (with |pdflatex|): the horizontal tabulation (ascii code 9, + |^^I|), the line feed (ascii code 10, |^^J|), and vertical tabulation + (ascii code 11, |^^K|) are exported to the file as the corresponding ascii + characters (at least this is the case with \TeX Live). \emph{These + exceptions do not apply with} |xelatex|. + + Thus we again end up with \TeX{} notation |^^P| in the exported file. To + get a literal CTRL-P, you need to set the catcode of |^^P| to 11 or 12, and + to run |pdflatex| with the |-8bit| option. With Xe\LaTeX, this would be + needed even for the horizontal tabulation CTRL-I. + \end{framed} +\end{footnotesize} -\section{Custom verbatim print-outs} +\begin{footnotesize} -We now comment on alternatives to using \csa{filecontentsprint}. Here is +\section{How to obtain customized verbatim in the output} + +Please refer first to the discussion of \csa{filecontentsprint} and +\csa{filecontentsprintviascan} as it provides examples using |fancyvrb|, +|minted|, or |listings| environments which may be what you are looking for. + +Here we make quick comments on alternatives to using \csa{filecontentsprint}, +and handling directly the contents via the configuration of active spaces and +active end of lines. + +Here is some (non-\LaTeX) text snippet. \begin{verbatim} \begin{filecontentsdef}{\jobname.test2}{\testactive} @@ -726,6 +1067,20 @@ not contain \verb|\end{verbatim}|. \end{footnotesize} +\section{Related packages} + +\begin{itemize} +\item Scott~\textsc{Pakin}'s + \href{http://www.ctan.org/pkg/filecontents}{filecontents}. Notice that the + package functionality has been integrated into \LaTeX{} release dated + |2019/10/01|. +\item Pablo~\textsc{González}'s + \href{http://www.ctan.org/pkg/scontents}{scontents}. Make sure your version + is at least |v1.3| as earlier ones had a dependency on \fcdname + and are broken by the changes coming with |filecontentsdef v1.5|. +\end{itemize} + + \StopEventually{\end{document}} \clearpage @@ -777,19 +1132,62 @@ See the \texttt{README.md} file for the \texttt{CHANGE LOG}. % %</none> %<*package> -% Most of -% the code is still identical to the one in \textsc{Scott Pakin}'s -% \href{http://www.ctan.org/pkg/filecontents}{filecontents} hence to -% the original one in \LaTeX's sources. -% -% But |v1.4| adds \cs{filecontentsdefmacro} which does not write to a file... % \begin{macrocode} +\let\FCD@global\global \begingroup \catcode`\^^M\active% +% \end{macrocode} +% Attention that all end of lines must now get protected due to +% the end of line character being active. +% +% The \LaTeX{} default for active |^^L| was \csa{outer} up to the |2017-01-01| +% release (got modified in |{v2.3b}{2016/11/06}| version of |ltplain.dtx|). +% But we must still handle that possibility for usage with older formats. +% \begin{macrocode} \catcode`\^^L\active\let^^L\relax% \catcode`\^^I\active% -\gdef\filec@ntentsdef#1#2{% - \let#2\@empty% +% \end{macrocode} +% \csa{FCD@main} is the core construct. +% +% Bulk of the code is still identical to the one in \textsc{Scott Pakin}'s +% \href{http://www.ctan.org/pkg/filecontents}{filecontents} hence to the +% original one in \LaTeX's sources regarding \csa{filec@ntents}, as +% |filecontentsdef| was conceived as an extension of the original +% |filecontents| environment, with the added feature of storing the +% verbatimized contents in a \TeX{} macro, which can then be printed (verbatim) +% or re-tokenized later via \csa{scantokens} and executed (if it represents +% \LaTeX{} material). Starting with |v1.5| some renaming of internal macros +% appears and the original coding is not only extended but starts being +% modified at some places as well. +% +% |v1.4| adds \csa{filecontentsdefmacro} which does not write to a file. +% +% |v1.5| renames all internal macros to use |\FCD@| namespace prefix. This +% applies here to \csa{FCD@main} whose name was still \csa{filec@ntentsdef} at +% |v1.4|. The change also applies to the \csa{reserved@b} and \csa{reservec@c}. +% +% |v1.5| adds customizability of how tabulation and form feed characters are +% handled either in file output or in macro storage. +% +% |v1.5| modifies |filecontentsdef| to only make a definition with local +% scope. For this we must smuggle out of the environment both the name and the +% meaning of the control sequence to define. We prepare for this a +% \csa{FCD@defmacro} which gets executed via |\endfilecontentsdef| (and +% variants). As \csa{FCD@defmacro} issues \csa{endgroup}, direct usage of +% \csa{filecontentsdef} (not as environment) must be inside an explicit +% \csa{begingroup}/\csa{endgroup} pair, mimicking the one which an environment +% would insert. +% +% The |filecontentsgdef/filecontentsgdefmacro| environments do define +% \csa{FCD@defmacro} but do not execute it. +% \begin{macrocode} +\gdef\FCD@main#1#2{% + \def\FCD@defmacro% + {\toks@\expandafter{#2}% + \edef\x{\endgroup\def\noexpand#2{\the\toks@}% + \begingroup\def\noexpand\@currenvir{\@currenvir}}% + \x}% + \FCD@global\let#2\@empty% \if@filesw% \openin\@inputcheck#1 % \ifeof\@inputcheck% @@ -800,11 +1198,11 @@ See the \texttt{README.md} file for the \texttt{CHANGE LOG}. {Overwriting file `\@currdir#1'}% \fi% \closein\@inputcheck% - \chardef\reserved@c15 % - \ch@ck7\reserved@c\write% - \immediate\openout\reserved@c#1\relax% + \chardef\FCD@reserved@c15 % + \ch@ck7\FCD@reserved@c\write% + \immediate\openout\FCD@reserved@c#1\relax% \if@tempswa% - \immediate\write\reserved@c{% + \immediate\write\FCD@reserved@c{% \@percentchar\@percentchar\space% \expandafter\@gobble\string\LaTeX2e file `#1'^^J% \@percentchar\@percentchar\space generated by the % @@ -837,18 +1235,21 @@ See the \texttt{README.md} file for the \texttt{CHANGE LOG}. \ifnum\count@<\@cclvi% \repeat% % \end{macrocode} -% The default active |^^L| is |\outer|. But |\reserved@b| will be |def'd| -% with an active |^^L| in its replacement text. +% The default active |^^L| was |\outer| up to |2017/01/01|. % \begin{macrocode} \let^^L\relax% - \edef\E{\@backslashchar end\string{\@currenvir\string}}% - \edef\reserved@b{\def\noexpand\reserved@b####1\E####2\E####3\relax}% + \edef\FCD@E{\@backslashchar end\string{\@currenvir\string}}% + \edef\FCD@reserved@b{\def\noexpand\FCD@reserved@b####1\FCD@E####2\FCD@E####3\relax}% % \end{macrocode} -% \cs{filecontentsdefmacro} sets \cs{if@filesw} to false. +% \csa{filecontentsdefmacro} sets \csa{if@filesw} to false. % \begin{macrocode} - \reserved@b{% + \FCD@reserved@b{% \ifx\relax##3\relax% - \if@filesw\immediate\write\reserved@c{##1}\fi% + \if@filesw% + \let^^L\FCDformfeedtofile% + \let^^I\FCDtabtofile% + \immediate\write\FCD@reserved@c{##1}% + \fi% % \end{macrocode} % This is where the original |filecontents| is extended to store the % parsed material in a macro (in my very first hack I simply @@ -862,29 +1263,34 @@ See the \texttt{README.md} file for the \texttt{CHANGE LOG}. % the characters it contains are protected from further expansion in % the |\xdef|'s. And the single |\noexpand| is enough also for the % |\write| done above. -% -% The |lccode| of the tilde is |32| when this gets executed. Multiple -% form feeds produce the same effect in the macro (insertion of two -% |^^M| per form feed) as in the written out file (via two |^^J|). % \begin{macrocode} \toks@\expandafter{#2}% - {\def^^L{\noexpand^^M\noexpand^^M}\lowercase{\let^^I~}% - \xdef#2{\the\toks@##1\noexpand^^M}}% + \let^^L\FCDformfeedtomacro% + \let^^I\FCDtabtomacro% + \FCD@global\edef#2{\the\toks@##1\noexpand^^M}% \else% \edef^^M{\noexpand\end{\@currenvir}}% \ifx\relax##1\relax% \else% - \if@filesw% - \@latex@warning{Writing text `##1' before % - \string\end{\@currenvir}\MessageBreak as last line of #1}% - \immediate\write\reserved@c{##1}% - \fi% + \if@filesw% +% \end{macrocode} +% |v1.5| suppresses the warning issued by |filecontents| environment +% in such case. +% \begin{macrocode} + \let^^L\FCDformfeedtofile% + \let^^I\FCDtabtofile% + \immediate\write\FCD@reserved@c{##1}% + \fi% % \end{macrocode} -% Same added code as above. +% In such case with the end of environment not being on a line of its own, +% |v1.5| injects an extra |\empty| token at end of last line. Thus +% usage in this form is restricted to contents representing \TeX{} macros. +% We still need the final |^^M| for \csa{filecontentsprint} matters. % \begin{macrocode} \toks@\expandafter{#2}% - {\def^^L{\noexpand^^M\noexpand^^M}\lowercase{\let^^I~}% - \xdef#2{\the\toks@##1\noexpand^^M}}% + \let^^L\FCDformfeedtomacro% + \let^^I\FCDtabtomacro% + \FCD@global\edef#2{\the\toks@##1\noexpand\empty\noexpand^^M}% \fi% \ifx\relax##2\relax% \else% @@ -893,62 +1299,98 @@ See the \texttt{README.md} file for the \texttt{CHANGE LOG}. \fi% \fi% ^^M}% - \catcode`\^^L\active% % \end{macrocode} -% |v1.4|: sync |^^L| and |^^I| with 2018/04/01 LaTeX release. +% |v1.4|: sync |^^L| and |^^I| with |2018/04/01| \LaTeX{} release. +% +% |v1.5|: drop the |^^L| and |^^I| \LaTeX{} definitions in favour of +% \csa{FCDformfeedtomacro} etc... % \begin{macrocode} - \let\L\@undefined% - \def^^L{\expandafter\ifx\csname L\endcsname\relax\fi^^J^^J}% + \catcode`\^^L\active% \catcode`\^^I\active% - \let\I\@undefined% - \def^^I{\expandafter\ifx\csname I\endcsname\relax\fi\space}% \catcode`\^^M\active% - \edef^^M##1^^M{\noexpand\reserved@b##1\E\E\relax}% + \edef^^M##1^^M{\noexpand\FCD@reserved@b##1\FCD@E\FCD@E\relax}% % \end{macrocode} -% We want space characters to be active in the produced macro. -% We only need to protect them once from expansion. +% We need active space characters to be active in the produced macro. +% We only need to protect them once from expansion. The definition +% will work both for writing to a file and for storage into the macro. % \begin{macrocode} \catcode32\active\lccode`~32 \lowercase{\def~{\noexpand~}}% }% -\endgroup +\gdef\FCDformfeedtofile{^^J^^J}% +\gdef\FCDformfeedtomacro{\noexpand^^M\noexpand^^M}% +\gdef\FCDtabtofile{ }% +\catcode32\active\gdef\FCDtabtomacro{\noexpand }% +\endgroup% % \end{macrocode} % The |v1.4| macros accept a name as alternative to a macro. Empty or % ill-formed |#2| will break code. But |#2| can be using |\if|, |\else|, % |\fi| tokens, the whole thing will end up |\csname|-expanded. An active % character also will end up |\csname|-expanded. There is no check on % whether |#2| or |\csname#2\endcsname| is an existing macro. +% +% |v1.5| replaces \csa{@tempa,b} by \csa{FCD@tempa,b}. And its +% \csa{FCD@get@aux} directly grabs |#2| rather than issuing \csa{@firstofone}. % \begin{macrocode} -\long\def\filecontentsdef@aux#1\filecontentsdef@aux{\@firstofone}% -\def\filecontentsdef@get#1#2% +\long\def\FCD@get@aux#1\FCD@get@aux#2{#2}% +\def\FCD@get#1#2% {% - \def\@tempa{#1}\def\@tempb{{#2}}% - \expandafter\filecontentsdef@aux\@gobbletwo#2\filecontentsdef@aux + \def\FCD@tempa{#1}\def\FCD@tempb{{#2}}% + \expandafter\FCD@get@aux\@gobbletwo#2\FCD@get@aux \@thirdofthree - \filecontentsdef@aux + \FCD@get@aux {\ifcat\relax\noexpand#2\expandafter\@gobble\else\expandafter\@firstofone\fi}% - {\edef\@tempb{{\expandafter\noexpand\csname#2\endcsname}}}% - \expandafter\@tempa\@tempb + {\edef\FCD@tempb{{\expandafter\noexpand\csname#2\endcsname}}}% + \expandafter\FCD@tempa\FCD@tempb }% % \end{macrocode} -% |v1.4| adds \cs{filecontentsdefmacro}. I abuse the \cs{if@filesw} toggle as there -% is no \cs{if@tempswb} available. No need for a starred version as anyhow -% the commented-out header was not put into the macro by the existing -% \cs{filec@ntentsdef} code. No need to reset the toggle as only usage as -% an environment is supported. And by lazyness and to spare extra coding, -% \cs{endfilecontentsdefmacro} emits no warning about Form Feed and Tabulation. +% |v1.4| adds \csa{filecontentsdefmacro}. I abuse the \csa{if@filesw} toggle as +% there is no \csa{if@tempswb} available. No need for a starred version as +% anyhow the commented-out header was not put into the macro by the existing +% \csa{FCD@main} code. No need to reset the toggle as documentation explains +% direct usage of the environment begin and end macros must be inside a +% |\begingroup\endgroup| pair. +% +% |v1.5| adds the ``starred''-named variants as aliases. % \begin{macrocode} \begingroup \catcode`\*=11 -\gdef\filecontentsdef #1{\@tempswatrue\filecontentsdef@get{\filec@ntentsdef{#1}}}% -\gdef\filecontentsdef*#1{\@tempswafalse\filecontentsdef@get{\filec@ntentsdef{#1}}}% -\global\let\endfilecontentsdef \endfilecontents -\global\let\endfilecontentsdef*\endfilecontents -\gdef\filecontentsdefmacro{\@fileswfalse\filecontentsdef@get{\filec@ntentsdef{}}}% -\global\let\endfilecontentsdefmacro\relax -\gdef\filecontentshere #1{\@tempswatrue\filec@ntentsdef{#1}\filecontentsheremacro}% -\gdef\filecontentshere*#1{\@tempswafalse\filec@ntentsdef{#1}\filecontentsheremacro}% -\gdef\endfilecontentshere{\endfilecontentsdef\aftergroup\filecontents@here}% +\gdef\filecontentsdef #1{\let\FCD@global\@empty + \@tempswatrue\FCD@get{\FCD@main{#1}}}% +\gdef\filecontentsdef*#1{\let\FCD@global\@empty + \@tempswafalse\FCD@get{\FCD@main{#1}}}% +\global\let\filecontentsdefstarred\filecontentsdef* +\gdef\filecontentsgdef #1{\@tempswatrue\FCD@get{\FCD@main{#1}}}% +\gdef\filecontentsgdef*#1{\@tempswafalse\FCD@get{\FCD@main{#1}}}% +\global\let\filecontentsgdefstarred\filecontentsgdef* +% \end{macrocode} +% |v1.5| can not use original \csa{endfilecontents} which makes reference to +% \csa{reserved@c} whereas \fcdname now uses in its place \csa{FCD@reserved@c}. +% Finally I drop altogether the bulk of this macro which issued a warning in +% case of an encountered form feed or tabulation character. +% +% |v1.5| adds support for definitions with local scope so we must smuggle the +% defined macro out of the environment. This is done via \csa{FCD@defmacro} +% which is set-up via \csa{FCD@main}. +% \begin{macrocode} +\gdef\endfilecontentsdef{\immediate\closeout\FCD@reserved@c\FCD@defmacro}% +\global\let\endfilecontentsdef*\endfilecontentsdef +\global\let\endfilecontentsdefstarred\endfilecontentsdef +\gdef\endfilecontentsgdef{\immediate\closeout\FCD@reserved@c}% +\global\let\endfilecontentsgdef*\endfilecontentsgdef +\global\let\endfilecontentsgdefstarred\endfilecontentsgdef +\gdef\filecontentsdefmacro{\let\FCD@global\@empty + \@fileswfalse\FCD@get{\FCD@main{}}}% +\gdef\endfilecontentsdefmacro{\FCD@defmacro}% +\gdef\filecontentsgdefmacro{\@fileswfalse\FCD@get{\FCD@main{}}}% +\global\let\endfilecontentsgdefmacro\relax +\gdef\filecontentshere #1{\let\FCD@global\@empty + \@tempswatrue\FCD@main{#1}\filecontentsheremacro}% +\gdef\filecontentshere*#1{\let\FCD@global\@empty + \@tempswafalse\FCD@main{#1}\filecontentsheremacro}% +\global\let\filecontentsherestarred\filecontentshere* +\gdef\endfilecontentshere{\endfilecontentsdef\aftergroup\FCD@here}% \global\let\endfilecontentshere*\endfilecontentshere +\global\let\endfilecontentsherestarred\endfilecontentshere % \end{macrocode} % Package |verbatim.sty| modifies the standard |verbatim| environment. For % both the original and the modified version we need to insert an active |^^M| @@ -961,20 +1403,48 @@ See the \texttt{README.md} file for the \texttt{CHANGE LOG}. % the code compatible with further packages (I have not looked for them) % modifying the |verbatim| environment. For better code readibility I use % |^^M%|'s rather than exploiting the active ends of lines here. +% +% |v1.5| adds \csa{FCDprintenvname} which holds the name of the environment to +% be used. Initially configured to hold of course |verbatim|. And it also adds +% \csa{FCDprintenvoptions}. % \begin{macrocode} -\gdef\filecontentsprint{\filecontentsdef@get\filecontents@print}% +\gdef\filecontentsprint{\FCD@get\FCD@print}% \catcode`\^^M\active% -\gdef\filecontents@print #1{\let\filecontents@print@EOL^^M\let^^M\relax% - \begingroup\toks@\expandafter{#1}\edef\x{\endgroup% - \noexpand\begin{verbatim}^^M% - \the\toks@\@backslashchar end\string{verbatim\string}}\x^^M% - \filecontents@print@resetEOL}% -\gdef\filecontents@print@resetEOL{\let^^M\filecontents@print@EOL}% +\gdef\FCD@print #1{\let\FCD@print@EOL^^M\let^^M\relax% + \begingroup\toks@\expandafter{#1}% + \edef\x{\endgroup% + \noexpand\begin{\FCDprintenvname}\FCDprintenvoptions^^M% + \the\toks@\@backslashchar end\string{\FCDprintenvname\string}}% + \x^^M% + \FCD@print@resetEOL}% +\gdef\FCD@print@resetEOL{\let^^M\FCD@print@EOL}% +\gdef\filecontentsprintviascan{\FCD@get\FCD@printviascan}% +% \end{macrocode} +% |v1.5| adds \csa{filecontentsprintviascan} which uses \csa{scantokens} to wrap +% stored contents in a verbatim-like environment. This is needed for things +% such as |listings| (it uses an active backslash at start of lines). +% Attention to the \csa{scantokens} subtlety with \csa{end} which would become +% |\end<space>| and then again |listings| would not recognize the ending +% pattern. +% \begin{macrocode} +\gdef\FCD@printviascan#1{% + \toks@\expandafter{#1}% + \edef\FCD@envwithcontents{% + \noexpand\begin{\FCDprintenvname}\FCDprintenvoptions\noexpand^^M% + \the\toks@\@backslashchar end{\FCDprintenvname}\noexpand^^M}% + \FCD@exec\FCD@envwithcontents}% \endgroup -\def\filecontents@here{\filecontents@print\filecontentsheremacro}% -\def\filecontentsexec{\filecontentsdef@get\filecontents@exec}% -\def\filecontents@exec #1{\newlinechar13 - \scantokens\expandafter{#1}\newlinechar10\relax}% +\def\FCDprintenvname{verbatim}% +\let\FCDprintenvoptions\@empty +\def\FCD@here{\FCD@print\filecontentsheremacro}% +\def\filecontentsexec{\FCD@get\FCD@exec}% +% \end{macrocode} +% |v1.5| restores \csa{newlinechar} to its prior value, rather than setting it +% to the \LaTeX{} default (10). +% \begin{macrocode} +\def\FCD@exec #1{\edef\FCD@newlinechar{\the\newlinechar}% + \newlinechar13 + \scantokens\expandafter{#1}\newlinechar\FCD@newlinechar\relax}% \endinput % \end{macrocode} % \MakePercentComment diff --git a/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf b/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf Binary files differindex ddf56cc7ac..c0af8cdb55 100644 --- a/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf +++ b/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf diff --git a/macros/latex/contrib/gatherenum/LICENSE b/macros/latex/contrib/gatherenum/LICENSE index add821a62d..561f558bee 100644 --- a/macros/latex/contrib/gatherenum/LICENSE +++ b/macros/latex/contrib/gatherenum/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. gatherenum - Copyright (C) 2018 RIVAUD Julien + Copyright (C) 2018-2019 RIVAUD Julien This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - gatherenum Copyright (C) 2018 RIVAUD Julien + gatherenum Copyright (C) 2018-2019 RIVAUD Julien This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/macros/latex/contrib/gatherenum/gatherenum.dtx b/macros/latex/contrib/gatherenum/gatherenum.dtx index dec13ca1ab..8024754151 100644 --- a/macros/latex/contrib/gatherenum/gatherenum.dtx +++ b/macros/latex/contrib/gatherenum/gatherenum.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % vim: tw=80 spl=en % -%% File: gatherenum.dtx (C) Copyright 2016-2018 RIVAUD Julien +%% File: gatherenum.dtx (C) Copyright 2016-2019 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this @@ -11,11 +11,11 @@ % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\RequirePackage{expl3}[2016/01/19] +\RequirePackage{expl3}[2018/06/19] \def\ExplFileName{gatherenum} \def\ExplFileDescription{Crossover between align* and enumerate} -\def\ExplFileDate{2018/06/19} -\def\ExplFileVersion{1.7} +\def\ExplFileDate{2019/09/29} +\def\ExplFileVersion{1.8} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -261,7 +261,7 @@ % boxed. % \begin{macrocode} \penalty \predisplaypenalty - \begin{gatherenum}[ + \gatherenum[ itemjoin=\skip_horizontal:n{1em plus 1fil}, #1, mode=boxed, @@ -279,11 +279,11 @@ % less strict on widows and clubs than normal. % \begin{macrocode} \clist_if_in:nnTF { #1 } { gathered } { - \end{gatherenum} + \endgatherenum \unskip \int_set_eq:NN \clubpenalty \interlinepenalty \int_set_eq:NN \widowpenalty \interlinepenalty - \par + \use:c{@ @ par}% avoid l3docstrip replacement of @ }{ \@@_save_endenumerate:w } diff --git a/macros/latex/contrib/gatherenum/gatherenum.pdf b/macros/latex/contrib/gatherenum/gatherenum.pdf Binary files differindex 17e0975646..f7de42134f 100644 --- a/macros/latex/contrib/gatherenum/gatherenum.pdf +++ b/macros/latex/contrib/gatherenum/gatherenum.pdf diff --git a/macros/latex/contrib/l3build/CHANGELOG.md b/macros/latex/contrib/l3build/CHANGELOG.md index 09a8b1a94b..e2102c8b4f 100644 --- a/macros/latex/contrib/l3build/CHANGELOG.md +++ b/macros/latex/contrib/l3build/CHANGELOG.md @@ -7,6 +7,18 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2019-09-29] + +### Fixed + +- Path searching if `texmfdir` is set but does not exist + +## [2019-09-28] + +### Fixed + +- Typesetting when using an isolated system (use of texmfdir) + ## [2019-09-25] ### Added @@ -337,7 +349,9 @@ this project uses date-based 'snapshot' version identifiers. - Rationalise short option names: removed `-d`, `-E`, `-r` - Target `cmdcheck`: specific to LaTeX3 kernel work -[Unreleased]: https://github.com/latex3/l3build/compare/2019-09-25...HEAD +[Unreleased]: https://github.com/latex3/l3build/compare/2019-09-29...HEAD +[2019-09-29]: https://github.com/latex3/l3build/compare/2019-09-28...2019-09-29 +[2019-09-28]: https://github.com/latex3/l3build/compare/2019-09-25...2019-09-28 [2019-09-25]: https://github.com/latex3/l3build/compare/2019-09-18...2019-09-25 [2019-09-18]: https://github.com/latex3/l3build/compare/2019-09-14...2019-09-18 [2019-09-14]: https://github.com/latex3/l3build/compare/2019-08-24...2019-09-14 diff --git a/macros/latex/contrib/l3build/README.md b/macros/latex/contrib/l3build/README.md index 432fd5583c..44e890e8d6 100644 --- a/macros/latex/contrib/l3build/README.md +++ b/macros/latex/contrib/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX3 ================================================= -Release 2019-09-25 +Release 2019-09-29 Overview -------- diff --git a/macros/latex/contrib/l3build/l3build-check.lua b/macros/latex/contrib/l3build/l3build-check.lua index 731d4282ea..aad0328103 100644 --- a/macros/latex/contrib/l3build/l3build-check.lua +++ b/macros/latex/contrib/l3build/l3build-check.lua @@ -722,10 +722,9 @@ function runtest(name, engine, hide, ext, pdfmode, breakout) rm(testdir,name .. logext) local errlevels = {} local localtexmf = "" - if texmfdir and texmfdir ~= "" then + if texmfdir and texmfdir ~= "" and direxists(texmfdir) then localtexmf = os_pathsep .. abspath(texmfdir) .. "//" end - local texmfdir = abspath(texmfdir) .. "//" for i = 1, checkruns do errlevels[i] = run( testdir, diff --git a/macros/latex/contrib/l3build/l3build-typesetting.lua b/macros/latex/contrib/l3build/l3build-typesetting.lua index 8e5b17bfc4..7f588a7c23 100644 --- a/macros/latex/contrib/l3build/l3build-typesetting.lua +++ b/macros/latex/contrib/l3build/l3build-typesetting.lua @@ -64,11 +64,10 @@ function runcmd(cmd,dir,vars) -- Allow for local texmf files local env = os_setenv .. " TEXMFCNF=." .. os_pathsep local localtexmf = "" - if texmfdir and texmfdir ~= "" then + if texmfdir and texmfdir ~= "" and direxists(texmfdir) then localtexmf = os_pathsep .. abspath(texmfdir) .. "//" end - local envpaths = "." .. os_pathsep - .. localtexmf + local envpaths = "." .. localtexmf .. os_pathsep .. abspath(localdir) .. os_pathsep .. dir .. (typesetsearch and os_pathsep or "") -- Deal with spaces in paths diff --git a/macros/latex/contrib/l3build/l3build.1 b/macros/latex/contrib/l3build/l3build.1 index 4959f4b0e9..8812fdb603 100644 --- a/macros/latex/contrib/l3build/l3build.1 +++ b/macros/latex/contrib/l3build/l3build.1 @@ -1,4 +1,4 @@ -.TH l3build 1 "2019-09-25" +.TH l3build 1 "2019-09-29" .SH NAME l3build \- Checking and building packages .SH SYNOPSIS diff --git a/macros/latex/contrib/l3build/l3build.dtx b/macros/latex/contrib/l3build/l3build.dtx index 0597933557..dfaca41187 100644 --- a/macros/latex/contrib/l3build/l3build.dtx +++ b/macros/latex/contrib/l3build/l3build.dtx @@ -230,7 +230,7 @@ % }^^A % } % -% \date{Released 2019-09-25} +% \date{Released 2019-09-29} % % \maketitle % \tableofcontents diff --git a/macros/latex/contrib/l3build/l3build.lua b/macros/latex/contrib/l3build/l3build.lua index e9b47f8357..1696ef1872 100644 --- a/macros/latex/contrib/l3build/l3build.lua +++ b/macros/latex/contrib/l3build/l3build.lua @@ -25,7 +25,7 @@ for those people who are interested. --]] -- Version information -release_date = "2019-09-25" +release_date = "2019-09-29" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") diff --git a/macros/latex/contrib/l3build/l3build.pdf b/macros/latex/contrib/l3build/l3build.pdf Binary files differindex c579041252..7e9ddb0aed 100644 --- a/macros/latex/contrib/l3build/l3build.pdf +++ b/macros/latex/contrib/l3build/l3build.pdf diff --git a/macros/latex/contrib/l3experimental/CHANGELOG.md b/macros/latex/contrib/l3experimental/CHANGELOG.md index a0af5b8ab3..bf5f13f9ca 100644 --- a/macros/latex/contrib/l3experimental/CHANGELOG.md +++ b/macros/latex/contrib/l3experimental/CHANGELOG.md @@ -7,6 +7,12 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2019-09-28] + +### Changed + +- `\sys_shell_get_pwd:N` renamed as `\sys_get_shell_pwd:N` + ## [2019-09-19] ### Changed @@ -118,7 +124,8 @@ this project uses date-based 'snapshot' version identifiers. - New `l3color` module using `xcolor`-like expression syntax - New `l3draw` module, based on `pgf` layer of the TikZ system -[Unreleased]: https://github.com/latex3/latex3/compare/2019-09-19...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2019-09-28...HEAD +[2019-09-28]: https://github.com/latex3/latex3/compare/2019-09-19...2019-09-28 [2019-09-19]: https://github.com/latex3/latex3/compare/2019-08-25...2019-09-19 [2019-08-25]: https://github.com/latex3/latex3/compare/2019-07-01...2019-08-25 [2019-07-01]: https://github.com/latex3/latex3/compare/2019-05-28...2019-07-01 diff --git a/macros/latex/contrib/l3experimental/README.md b/macros/latex/contrib/l3experimental/README.md index ad609e6174..6b353b9504 100644 --- a/macros/latex/contrib/l3experimental/README.md +++ b/macros/latex/contrib/l3experimental/README.md @@ -1,7 +1,7 @@ Experimental LaTeX3 Concepts ============================ -Release 2019-09-19 +Release 2019-09-28 Overview -------- diff --git a/macros/latex/contrib/l3experimental/l3benchmark.dtx b/macros/latex/contrib/l3experimental/l3benchmark.dtx index 0df034cae8..f90bd2f1c4 100644 --- a/macros/latex/contrib/l3experimental/l3benchmark.dtx +++ b/macros/latex/contrib/l3experimental/l3benchmark.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -130,7 +130,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3benchmark}{2019-09-19}{} +\ProvidesExplPackage{l3benchmark}{2019-09-28}{} {L3 Experimental benchmarking} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3benchmark.pdf b/macros/latex/contrib/l3experimental/l3benchmark.pdf Binary files differindex c1247e2887..e5af65076d 100644 --- a/macros/latex/contrib/l3experimental/l3benchmark.pdf +++ b/macros/latex/contrib/l3experimental/l3benchmark.pdf diff --git a/macros/latex/contrib/l3experimental/l3cctab.dtx b/macros/latex/contrib/l3experimental/l3cctab.dtx index a56585c1ff..64266fe781 100644 --- a/macros/latex/contrib/l3experimental/l3cctab.dtx +++ b/macros/latex/contrib/l3experimental/l3cctab.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -171,7 +171,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3cctab}{2019-09-19}{} +\ProvidesExplPackage{l3cctab}{2019-09-28}{} {L3 Experimental category code tables} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3cctab.pdf b/macros/latex/contrib/l3experimental/l3cctab.pdf Binary files differindex 1535d5bf53..b5e4c9174f 100644 --- a/macros/latex/contrib/l3experimental/l3cctab.pdf +++ b/macros/latex/contrib/l3experimental/l3cctab.pdf diff --git a/macros/latex/contrib/l3experimental/l3color.dtx b/macros/latex/contrib/l3experimental/l3color.dtx index 0abd832212..d6dd271ee2 100644 --- a/macros/latex/contrib/l3experimental/l3color.dtx +++ b/macros/latex/contrib/l3experimental/l3color.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -265,7 +265,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3color}{2019-09-19}{} +\ProvidesExplPackage{l3color}{2019-09-28}{} {L3 Experimental color support} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3color.pdf b/macros/latex/contrib/l3experimental/l3color.pdf Binary files differindex bd2424c7e0..cf156af05b 100644 --- a/macros/latex/contrib/l3experimental/l3color.pdf +++ b/macros/latex/contrib/l3experimental/l3color.pdf diff --git a/macros/latex/contrib/l3experimental/l3draw-boxes.dtx b/macros/latex/contrib/l3experimental/l3draw-boxes.dtx index 9799c3238f..30b4952657 100644 --- a/macros/latex/contrib/l3experimental/l3draw-boxes.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-boxes.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-code.pdf b/macros/latex/contrib/l3experimental/l3draw-code.pdf Binary files differindex ca93058ce3..fcd4063c17 100644 --- a/macros/latex/contrib/l3experimental/l3draw-code.pdf +++ b/macros/latex/contrib/l3experimental/l3draw-code.pdf diff --git a/macros/latex/contrib/l3experimental/l3draw-layers.dtx b/macros/latex/contrib/l3experimental/l3draw-layers.dtx index f0b7afb1b4..c46f2489e3 100644 --- a/macros/latex/contrib/l3experimental/l3draw-layers.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-layers.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-paths.dtx b/macros/latex/contrib/l3experimental/l3draw-paths.dtx index f4bb5eb022..b6291a3280 100644 --- a/macros/latex/contrib/l3experimental/l3draw-paths.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-paths.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-points.dtx b/macros/latex/contrib/l3experimental/l3draw-points.dtx index 87fda4bf68..b05e29afe9 100644 --- a/macros/latex/contrib/l3experimental/l3draw-points.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-points.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-scopes.dtx b/macros/latex/contrib/l3experimental/l3draw-scopes.dtx index f98947f09a..bbd5c83c66 100644 --- a/macros/latex/contrib/l3experimental/l3draw-scopes.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-scopes.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-softpath.dtx b/macros/latex/contrib/l3experimental/l3draw-softpath.dtx index 12072fa678..ee228be271 100644 --- a/macros/latex/contrib/l3experimental/l3draw-softpath.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-softpath.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-state.dtx b/macros/latex/contrib/l3experimental/l3draw-state.dtx index 91c0d48644..1137c9d179 100644 --- a/macros/latex/contrib/l3experimental/l3draw-state.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-state.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw-transforms.dtx b/macros/latex/contrib/l3experimental/l3draw-transforms.dtx index 2a34520ff3..17a225f597 100644 --- a/macros/latex/contrib/l3experimental/l3draw-transforms.dtx +++ b/macros/latex/contrib/l3experimental/l3draw-transforms.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3experimental/l3draw.dtx b/macros/latex/contrib/l3experimental/l3draw.dtx index 0a93ec16ed..5813b7edf7 100644 --- a/macros/latex/contrib/l3experimental/l3draw.dtx +++ b/macros/latex/contrib/l3experimental/l3draw.dtx @@ -110,7 +110,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -1146,7 +1146,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3draw}{2019-09-19}{} +\ProvidesExplPackage{l3draw}{2019-09-28}{} {L3 Experimental core drawing support} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3draw.pdf b/macros/latex/contrib/l3experimental/l3draw.pdf Binary files differindex a3b6c4e84a..69c481bbee 100644 --- a/macros/latex/contrib/l3experimental/l3draw.pdf +++ b/macros/latex/contrib/l3experimental/l3draw.pdf diff --git a/macros/latex/contrib/l3experimental/l3galley.dtx b/macros/latex/contrib/l3experimental/l3galley.dtx index bdbbe9d476..06ffe81ab0 100644 --- a/macros/latex/contrib/l3experimental/l3galley.dtx +++ b/macros/latex/contrib/l3experimental/l3galley.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -687,7 +687,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3galley}{2019-09-19}{} +\ProvidesExplPackage{l3galley}{2019-09-28}{} {L3 Experimental galley code} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3galley.pdf b/macros/latex/contrib/l3experimental/l3galley.pdf Binary files differindex 9912434768..c14696e3cf 100644 --- a/macros/latex/contrib/l3experimental/l3galley.pdf +++ b/macros/latex/contrib/l3experimental/l3galley.pdf diff --git a/macros/latex/contrib/l3experimental/l3graphics.dtx b/macros/latex/contrib/l3experimental/l3graphics.dtx index c9e3020084..08d5ae4f63 100644 --- a/macros/latex/contrib/l3experimental/l3graphics.dtx +++ b/macros/latex/contrib/l3experimental/l3graphics.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -241,7 +241,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3graphics}{2019-09-19}{} +\ProvidesExplPackage{l3graphics}{2019-09-28}{} {L3 Experimental graphics inclusion support} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3graphics.pdf b/macros/latex/contrib/l3experimental/l3graphics.pdf Binary files differindex 0e0ba73a63..b821690316 100644 --- a/macros/latex/contrib/l3experimental/l3graphics.pdf +++ b/macros/latex/contrib/l3experimental/l3graphics.pdf diff --git a/macros/latex/contrib/l3experimental/l3pdf-code.pdf b/macros/latex/contrib/l3experimental/l3pdf-code.pdf Binary files differindex 1f0c62ed8d..8ab758a318 100644 --- a/macros/latex/contrib/l3experimental/l3pdf-code.pdf +++ b/macros/latex/contrib/l3experimental/l3pdf-code.pdf diff --git a/macros/latex/contrib/l3experimental/l3pdf.dtx b/macros/latex/contrib/l3experimental/l3pdf.dtx index a8801c7e46..d3784bb4e2 100644 --- a/macros/latex/contrib/l3experimental/l3pdf.dtx +++ b/macros/latex/contrib/l3experimental/l3pdf.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -185,7 +185,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3pdf}{2019-09-19}{} +\ProvidesExplPackage{l3pdf}{2019-09-28}{} {L3 Experimental core PDF support} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3pdf.pdf b/macros/latex/contrib/l3experimental/l3pdf.pdf Binary files differindex 9fa57b85df..e482f9058b 100644 --- a/macros/latex/contrib/l3experimental/l3pdf.pdf +++ b/macros/latex/contrib/l3experimental/l3pdf.pdf diff --git a/macros/latex/contrib/l3experimental/l3str-format.dtx b/macros/latex/contrib/l3experimental/l3str-format.dtx index ab96267593..eb06238f1c 100644 --- a/macros/latex/contrib/l3experimental/l3str-format.dtx +++ b/macros/latex/contrib/l3experimental/l3str-format.dtx @@ -48,7 +48,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -167,7 +167,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3str-format}{2019-09-19}{} +\ProvidesExplPackage{l3str-format}{2019-09-28}{} {L3 Experimental string formatting} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/l3str-format.pdf b/macros/latex/contrib/l3experimental/l3str-format.pdf Binary files differindex be043eef3e..7a7858d005 100644 --- a/macros/latex/contrib/l3experimental/l3str-format.pdf +++ b/macros/latex/contrib/l3experimental/l3str-format.pdf diff --git a/macros/latex/contrib/l3experimental/l3sys-shell.dtx b/macros/latex/contrib/l3experimental/l3sys-shell.dtx index 2663bce59d..18310b6584 100644 --- a/macros/latex/contrib/l3experimental/l3sys-shell.dtx +++ b/macros/latex/contrib/l3experimental/l3sys-shell.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -100,9 +100,9 @@ % attempted. % \end{function} % -% \begin{function}[added = 2018-07-28]{\sys_shell_get_pwd:N} +% \begin{function}[added = 2018-07-28]{\sys_get_shell_pwd:N} % \begin{syntax} -% \cs{sys_shell_get_pwd:N} \meta{str var} +% \cs{sys_get_shell_pwd:N} \meta{str var} % \end{syntax} % Sets the \meta{str var} to the present working directory (the output of % |pwd| on Unix or |cd| on Windows). Note that on Windows this will contain @@ -136,7 +136,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3sys-shell}{2019-09-19}{} +\ProvidesExplPackage{l3sys-shell}{2019-09-28}{} {L3 Experimental system shell functions} %</package> % \end{macrocode} @@ -300,17 +300,17 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\sys_shell_get_pwd:N} +% \begin{macro}{\sys_get_shell_pwd:N} % Getting the path is easy: the main work is avoiding loosing any % information. (This information can be obtained using the recorder file: % that does not require shell escape. However, it's hard to see how it might % be useful without the other file functions.) % \begin{macrocode} -\cs_new_protected:Npx \sys_shell_get_pwd:N #1 +\cs_new_protected:Npx \sys_get_shell_pwd:N #1 { \sys_if_shell_unrestricted:T { - \exp_not:N \sys_shell_get:nnN + \exp_not:N \sys_get_shell:nnN { \sys_if_platform_unix:T { pwd } \sys_if_platform_windows:T { cd } @@ -340,7 +340,7 @@ { \sys_if_shell_unrestricted:T { - \exp_not:N \sys_shell_get:nnN + \exp_not:N \sys_get_shell:nnN { \sys_if_platform_unix:T { ls~-1~ #1 } \sys_if_platform_windows:T { dir~/b~ #1 } diff --git a/macros/latex/contrib/l3experimental/l3sys-shell.pdf b/macros/latex/contrib/l3experimental/l3sys-shell.pdf Binary files differindex e00d1e4b56..e306a267cb 100644 --- a/macros/latex/contrib/l3experimental/l3sys-shell.pdf +++ b/macros/latex/contrib/l3experimental/l3sys-shell.pdf diff --git a/macros/latex/contrib/l3experimental/xcoffins.dtx b/macros/latex/contrib/l3experimental/xcoffins.dtx index c3d5739f82..b4d0ce465a 100644 --- a/macros/latex/contrib/l3experimental/xcoffins.dtx +++ b/macros/latex/contrib/l3experimental/xcoffins.dtx @@ -56,7 +56,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -675,7 +675,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xcoffins}{2019-09-19}{} +\ProvidesExplPackage{xcoffins}{2019-09-28}{} {L3 Experimental design level coffins} % \end{macrocode} % diff --git a/macros/latex/contrib/l3experimental/xcoffins.pdf b/macros/latex/contrib/l3experimental/xcoffins.pdf Binary files differindex 8721e4d8c3..2f93f907db 100644 --- a/macros/latex/contrib/l3experimental/xcoffins.pdf +++ b/macros/latex/contrib/l3experimental/xcoffins.pdf diff --git a/macros/latex/contrib/l3experimental/xgalley.dtx b/macros/latex/contrib/l3experimental/xgalley.dtx index 25c393a76c..cc6da75e0f 100644 --- a/macros/latex/contrib/l3experimental/xgalley.dtx +++ b/macros/latex/contrib/l3experimental/xgalley.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -734,7 +734,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xgalley}{2019-09-19}{} +\ProvidesExplPackage{xgalley}{2019-09-28}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} % \end{macrocode} diff --git a/macros/latex/contrib/l3experimental/xgalley.pdf b/macros/latex/contrib/l3experimental/xgalley.pdf Binary files differindex 482a8a94ad..0e5f3fa86c 100644 --- a/macros/latex/contrib/l3experimental/xgalley.pdf +++ b/macros/latex/contrib/l3experimental/xgalley.pdf diff --git a/macros/latex/contrib/l3kernel/CHANGELOG.md b/macros/latex/contrib/l3kernel/CHANGELOG.md index f483c78306..4e8c9fc093 100644 --- a/macros/latex/contrib/l3kernel/CHANGELOG.md +++ b/macros/latex/contrib/l3kernel/CHANGELOG.md @@ -7,6 +7,40 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2019-09-28] + +### Changed + +- Speed up variants and reduce their \tracingall output +- Debug and deprecation code are now loaded independently of expl3 core +- `\file_compare_timestamp:nNn(TF)` now usable in expansion contexts +- Moved to stable: + - `\bool_const:Nn` + - `\dim_sign:n` + - `\file_compare_timestamp:nNn(TF)` + - FP `logb` operator + - `\fp_sign:n` + - `fparray` module + - `\int_sign:n` + - `\intarray_const_from_clist:Nn` + - `\intarray_show:N` + - `\ior_map_variable:NNn` + - `\ior_str_map_variable:NNn` + - `\mode_leave_vertical:` + - `\prop_(g)set_from_clist:Nn` + - `\prop_const_from_clist:Nn` + - `\seq_const_from_clist:Nn` + - `\seq_(g)shuffle:N` + - `\sys_if_platform_unix:(TF)` + - `\sys_if_platform_windows:(TF)` + - `\sys_gset_rand_seed:` + - `\sys_rand_seed:` + - Shell access functions + +### Fixed + +- Key `.initial:n` property when combined with inherited keys (see #631) + ## [2019-09-19] ### Fixed @@ -23,7 +57,7 @@ this project uses date-based 'snapshot' version identifiers. ### Added -- `\file_full_name:n`, \file_mdfive_hash:n`, `\file_size:n`, +- `\file_full_name:n`, `\file_mdfive_hash:n`, `\file_size:n`, `\file_timestamp:n` - `\seq_map_tokens:Nn`, `\tl_map_tokens:nn`, `\tl_map_tokens:Nn` @@ -493,7 +527,8 @@ this project uses date-based 'snapshot' version identifiers. - Step funcÂtions have been added for dim variÂables, e.g. `\dim_step_inÂline:nnnn` -[Unreleased]: https://github.com/latex3/latex3/compare/2019-09-19...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2019-09-28...HEAD +[2019-09-28]: https://github.com/latex3/latex3/compare/2019-09-19...2019-09-28 [2019-09-19]: https://github.com/latex3/latex3/compare/2019-09-08...2019-09-19 [2019-09-08]: https://github.com/latex3/latex3/compare/2019-09-05...2019-09-08 [2019-09-05]: https://github.com/latex3/latex3/compare/2019-08-25...2019-09-05 diff --git a/macros/latex/contrib/l3kernel/README.md b/macros/latex/contrib/l3kernel/README.md index ea663ab1e1..1937491098 100644 --- a/macros/latex/contrib/l3kernel/README.md +++ b/macros/latex/contrib/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2019-09-19 +Release 2019-09-28 Overview -------- diff --git a/macros/latex/contrib/l3kernel/expl3.dtx b/macros/latex/contrib/l3kernel/expl3.dtx index 9aa2421de3..64cb393585 100644 --- a/macros/latex/contrib/l3kernel/expl3.dtx +++ b/macros/latex/contrib/l3kernel/expl3.dtx @@ -23,7 +23,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2019-09-19}% +\def\ExplFileDate{2019-09-28}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -622,6 +622,16 @@ % text of an~\tn{edef}, and the expansion is passed to the function as % a braced token list. Expansion takes place until only unexpandable % tokens are left. |x|-type arguments cannot be nested. +% \item[e] Fully-expanded token or braced token list which does +% not require doubled |#| tokens. This expansions is very similar +% to |x|-type but may be nested and does not require that |#| +% tokens are doubled. +% \item[f] Expanding the first token recursively in a braced token +% list.\\ Almost the same as the |x| type except here the token list +% is expanded fully until the first unexpandable token is found and +% the rest is left unchanged. Note that if this function finds a +% space at the beginning of the argument it gobbles it and does not +% expand the next token. % \item[o] One-level-expanded token or braced token list.\\ % This means that the argument is expanded one level, as by % \tn{expandafter}, and the expansion is passed to the function as a @@ -629,12 +639,6 @@ % token list then only the first token in that list is expanded. % In general, using \texttt{V} should be preferred to using % \texttt{o} for simple variable retrieval. -% \item[f] Expanding the first token recursively in a braced token -% list.\\ Almost the same as the |x| type except here the token list -% is expanded fully until the first unexpandable token is found and -% the rest is left unchanged. Note that if this function finds a -% space at the beginning of the argument it gobbles it and does not -% expand the next token. % \end{description} % % \subsection{Simpler means better} @@ -948,15 +952,10 @@ % These functions can only be used if \pkg{expl3} is loaded with the % \texttt{enable-debug} option. % -% \DescribeOption{driver} -% Selects the driver to be used for color, graphics and related operations that -% are driver-dependent. Options available are +% \DescribeOption{backend} +% Selects the backend to be used for color, graphics and related operations that +% are backend-dependent. Options available are % \begin{itemize}[font = \texttt] -% \item[auto] Let \LaTeX3 determine the correct driver. With DVI output, this -% selects the \texttt{dvips} back-end for \pdfTeX{} and \LuaTeX{}, and -% \texttt{dvipdfmx} for \pTeX{} and \upTeX{}. This is the standard setting. -% \item[latex2e] Use the \pkg{graphics} package to select the driver, rather -% than \LaTeX3 code. % \item[dvips] Use the \texttt{dvips} driver. % \item[dvipdfmx] Use the \texttt{dvipdfmx} driver. % \item[dvisvgm] Use the \texttt{dvisvgm} driver. @@ -1172,64 +1171,6 @@ ]% % \end{macrocode} % -% \begin{macro}[int]{\expl@create@bool@option} -% \begin{variable}[int] -% { -% \l@expl@undo@recent@deprecations@bool , -% \l@expl@check@declarations@bool , -% \l@expl@log@functions@bool , -% \l@expl@enable@debug@bool -% } -% \begin{variable}[int]{\l@expl@options@clist} -% Options to be set up. These have to be done by hand as there is no -% \pkg{expl3} yet: the logging option is needed before loading -% \pkg{l3basics}! Only a minimal set of options are handled here: -% others are left for a proper key--value approach once the kernel is -% loaded. After processing the options we set the -% \texttt{enable-debug} boolean so that the options -% \texttt{check-declarations} and \texttt{log-functions} imply -% \texttt{enable-debug}: otherwise the necessary debugging code would -% not be set up properly. -% \begin{macrocode} -\newcommand\expl@create@bool@option[2]% - {% - \DeclareOption{#1}{\chardef #2=1 }% - \DeclareOption{#1=true}{\chardef #2=1 }% - \DeclareOption{#1=false}{\chardef #2=0 }% - \newcommand*#2{}% - \chardef #2=0 % - }% -\expl@create@bool@option - {undo-recent-deprecations}\l@expl@undo@recent@deprecations@bool -\expl@create@bool@option{check-declarations}\l@expl@check@declarations@bool -\expl@create@bool@option{log-functions}\l@expl@log@functions@bool -\expl@create@bool@option{enable-debug}\l@expl@enable@debug@bool -\let\expl@create@bool@option\@undefined -\chardef\l@expl@enable@debug@bool=0 % -\newcommand*\l@expl@options@clist{}% -\DeclareOption* - {% - \ifx\l@expl@options@clist\@empty - \let\l@expl@options@clist\CurrentOption - \else - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter\l@expl@options@clist - \expandafter\expandafter\expandafter - {\expandafter\l@expl@options@clist\expandafter,\CurrentOption} - \fi - }% -\ProcessOptions\relax -\ifodd\l@expl@check@declarations@bool - \chardef\l@expl@enable@debug@bool=1 % -\fi -\ifodd\l@expl@log@functions@bool - \chardef\l@expl@enable@debug@bool=1 % -\fi -% \end{macrocode} -% \end{variable} -% \end{variable} -% \end{macro} -% % \begin{macro}{\ProvidesExplPackage, \ProvidesExplClass, \ProvidesExplFile} % For other packages and classes building on this one it is convenient % not to need \cs{ExplSyntaxOn} each time. @@ -1266,245 +1207,86 @@ \fi % \end{macrocode} % -% \begin{variable}{\l__expl_driver_tl} -% \begin{variable}{\l__expl_native_drivers_bool} -% With the code now loaded, options can be handled using a real key--value -% interpreter. The \enquote{faked} options are also included so that any -% erroneous input is mopped up (\emph{e.g.}~\texttt{log-function = -% foo}). The checks on driver choice are set up here, so when actually -% the driver it's a straight forward operation. % \begin{macrocode} -\__kernel_msg_new:nnnn { expl } { wrong-driver } - { Driver~request~inconsistent~with~engine:~using~'#2'~driver. } - { - You~have~requested~driver~'#1',~but~this~is~not~suitable~for~use~with~the~ - active~engine.~LaTeX3~will~use~the~'#2'~driver~instead. - } -\tl_new:N \l__expl_driver_tl -\keys_define:nn { expl } - { - driver .choice:, - driver / auto .code:n = - { - \tl_set:Nx \l__expl_driver_tl - { - \sys_if_engine_xetex:TF - { xdvipdfmx } - { - \sys_if_output_pdf:TF - { pdfmode } - { - \bool_lazy_or:nnTF - { \sys_if_engine_pdftex_p: } - { \sys_if_engine_luatex_p: } - { dvips } - { dvipdfmx } - } - } - } - }, - driver / dvipdfmx .code:n = - { - \tl_set:Nn \l__expl_driver_tl { dvipdfmx } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvipdfmx } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:T - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvipdfmx } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - } - }, - driver / dvips .code:n = - { - \tl_set:Nn \l__expl_driver_tl { dvips } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:T - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - } - }, - driver / dvisvgm .code:n = - { - \tl_set:Nn \l__expl_driver_tl { dvisvgm } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:T - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { dvips } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - } - }, - driver / latex2e .code:n = - { \tl_set:Nn \l__expl_driver_tl { latex2e } }, - driver / pdfmode .code:n = - { - \tl_set:Nn \l__expl_driver_tl { pdfmode } - \sys_if_engine_xetex:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { pdfmode } { xdvipdfmx } - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - } - { - \sys_if_output_pdf:F - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { pdfmode } { dvips } - \tl_set:Nn \l__expl_driver_tl { dvips } - } - } - }, - driver / xdvipdfmx .code:n = - { - \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } - \sys_if_engine_xetex:F - { - \sys_if_output_pdf:TF - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { xdvipdfmx } { pdfmode } - \tl_set:Nn \l__expl_driver_tl { pdfmode } - } - { - \__kernel_msg_error:nnnn { expl } { wrong-driver } - { xdvipdfmx } { dvips } - \tl_set:Nn \l__expl_driver_tl { dvips } - } - } - }, - driver .initial:n = { auto } , - native-drivers .choice:, - native-drivers .default:n = { true }, - native-drivers / false .meta:n = { driver = latex2e }, - native-drivers / true .meta:n = { driver = auto } - } +%<@@=expl> % \end{macrocode} -% Mop up any incorrect settings for the other options. +% +% \begin{variable}{\c_@@_def_ext_tl} +% Needed by \LaTeXe{}. % \begin{macrocode} -\keys_define:nn { expl } - { - undo-recent-deprecations .bool_set:N = \l@expl@undo@recent@deprecations@bool, - check-declarations .bool_set:N = \l@expl@check@declarations@bool, - log-functions .bool_set:N = \l@expl@log@functions@bool - } -\keys_set:nV { expl } \l@expl@options@clist +\tl_const:Nn \c_@@_def_ext_tl { def } % \end{macrocode} % \end{variable} -% \end{variable} % -% \begin{macro} -% { -% \box_rotate:Nn, -% \box_resize_to_wd_and_ht_plus_dp:Nnn, -% \box_resize_to_ht_plus_dp:Nn, -% \box_resize_to_wd:Nn, -% \box_scale:Nnn -% } -% For the \LaTeXe{} drivers, -% alter various definitions to use the \pkg{graphics} package -% instead. The package is loaded right at the start of the hook -% as there is otherwise a potential issue with \pkg{(x)color}: see -% \url{http://groups.google.com/group/comp.text.tex/msg/c9de8913c756ef4c}. +% \begin{macro}{\__kernel_sys_configuration_load:n} +% For \LaTeXe{}, option loading uses the built-in functionality: as this +% may be a reload we have to force the issue. % \begin{macrocode} -\str_if_eq:VnTF \l__expl_driver_tl { latex2e } +\cs_new_protected:Npn \__kernel_sys_configuration_load:n #1 { - \tl_gput_left:Nn \@begindocumenthook { \RequirePackage { graphics } } - \__kernel_msg_new:nnnn { box } { clipping-not-available } - { Box~clipping~not~available. } - { - The~\box_clip:N~function~is~only~available~when~loading~expl3~ - with~the~"native-drivers"~option. - } - \cs_set_protected:Npn \box_clip:N #1 - { - \hbox_set:Nn #1 { \box_use:N #1 } - \__kernel_msg_error:nn { box } { clipping-not-available } - } - \cs_set_protected:Npn \box_rotate:Nn #1#2 - { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } - \cs_set_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \resizebox * - { \dim_eval:n {#2} } - { \dim_eval:n {#3} } - { \box_use:N #1 } - } - } - \cs_set_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 - { - \hbox_set:Nn #1 - { - \resizebox * { ! } { \dim_eval:n {#2} } - { \box_use:N #1 } - } - } - \cs_set_protected:Npn \box_resize_to_wd:Nn #1#2 + \group_begin: + \cs_set_protected:Npn \ProvidesExplFile { - \hbox_set:Nn #1 - { - \resizebox * { \dim_eval:n {#2} } { ! } - { \box_use:N #1 } - } + \char_set_catcode_space:n { `\ } + \ProvidesExplFileAux } - \cs_set_protected:Npn \__box_scale_aux:N #1 + \cs_set_protected:Npn \ProvidesExplFileAux ##1##2##3##4 { - \exp_last_unbraced:Nx \scalebox - { { \fp_use:N \l__box_scale_x_fp } [ \fp_use:N \l__box_scale_y_fp ] } - { \box_use:N #1 } + \group_end: + \ProvidesFile {##1} [ ##2~v##3~##4 ] } - \cs_set_protected:Npn \color_ensure_current: { \set@color } + \cs_undefine:c { ver@ #1 .def } + \@onefilewithoptions {#1} [ ] [ ] + \c_@@_def_ext_tl } % \end{macrocode} % \end{macro} -% For native drivers, just load the appropriate file. As \cs{expl3} syntax -% is already on and the full mechanism is only engaged at the end of the -% loader, \cs{ProvidesExplFile} is temporarily redefined here. +% +% \begin{variable}{\l_@@_options_clist} % \begin{macrocode} +\clist_new:N \l_@@_options_clist +\DeclareOption* + { \clist_put_right:NV \l_@@_options_clist \CurrentOption } +\ProcessOptions \relax +% \end{macrocode} +% \end{variable} +% +% Pretty standard setting creation. +% \begin{macrocode} +\keys_define:nn { sys } { - \group_begin: - \cs_set_protected:Npn \ProvidesExplFile + backend .choices:nn = + { dvipdfmx , dvips , dvisvgm , pdfmode , xdvipdfmx } + { \sys_load_backend:n {#1} } , + check-declarations .code:n = { - \char_set_catcode_space:n { `\ } - \ProvidesExplFileAux - } - \cs_set_protected:Npn \ProvidesExplFileAux #1#2#3#4 + \sys_load_debug: + \debug_on:n { check-declarations } + } , + driver .meta:n = { backend = #1 } , + enable-debug .code:n = + \sys_load_debug: , + log-functions .code:n = { - \group_end: - \ProvidesFile {#1} [ #2~v#3~#4 ] + \sys_load_debug: + \debug_on:n { log-functions } + } , + undo-recent-deprecations .code:n = + { + \sys_load_deprecation: + \bool_gset_true:N \g__kernel_deprecation_undo_recent_bool } - \tl_const:Nn \c__expl_def_ext_tl { def } - \@onefilewithoptions { l3backend- \l__expl_driver_tl } [ ] [ ] - \c__expl_def_ext_tl } % \end{macrocode} % +% \begin{macrocode} +\keys_set:nV { sys } \l_@@_options_clist +\str_if_exist:NF \c_sys_backend_str + { \sys_load_backend:n { } } +% \end{macrocode} +% % \begin{macro}{\@pushfilename, \@popfilename} -% \begin{macro}{\__expl_status_pop:w} +% \begin{macro}{\@@_status_pop:w} % The idea here is to use \LaTeXe{}'s \tn{@pushfilename} and % \tn{@popfilename} to track the current syntax status. This can be % achieved by saving the current status flag at each push to a stack, @@ -1541,14 +1323,14 @@ \__kernel_file_input_pop: \tl_if_empty:NTF \l__expl_status_stack_tl { \ExplSyntaxOff } - { \exp_after:wN \__expl_status_pop:w \l__expl_status_stack_tl \q_stop } + { \exp_after:wN \@@_status_pop:w \l__expl_status_stack_tl \q_stop } } % \end{macrocode} % The pop auxiliary function removes the first item from the stack, % saves the rest of the stack and then does the test. The flag here % is not a proper \texttt{bool}, so a low-level test is used. % \begin{macrocode} -\cs_new_protected:Npn \__expl_status_pop:w #1#2 \q_stop +\cs_new_protected:Npn \@@_status_pop:w #1#2 \q_stop { \tl_set:Nn \l__expl_status_stack_tl {#2} \int_if_odd:nTF {#1} @@ -1639,24 +1421,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}[int] -% { -% \l@expl@undo@recent@deprecations@bool , -% \l@expl@check@declarations@bool , -% \l@expl@log@functions@bool , -% \l@expl@enable@debug@bool -% } -% In generic mode, there is no convenient option handling and so instead -% the two variables are defined to do nothing. -% Appropriate value before input of the loader. -% \begin{macrocode} -\chardef \l@expl@undo@recent@deprecations@bool = 0 % -\chardef \l@expl@check@declarations@bool = 0 % -\chardef \l@expl@log@functions@bool = 0 % -\chardef \l@expl@enable@debug@bool = 0 % -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\AtBeginDocument} % \begin{macro}[int]{\expl@AtBeginDocument} % There are a few uses of \cs{AtBeginDocument} in the package code: the @@ -1690,35 +1454,30 @@ \fi % \end{macrocode} % -% For driver loading in generic mode, there are no options: pick the most -% appropriate case! To allow this loading to take place a temporary -% definition of \cs{ProvidesExplFile} is provided +% \begin{macro}{\__kernel_sys_configuration_load:n} +% Very basic. % \begin{macrocode} -\cs_set_protected:Npn \ProvidesExplFile +\cs_new_protected:Npn \__kernel_sys_configuration_load:n #1 { \group_begin: - \char_set_catcode_space:n { `\ } - \ProvidesExplFileAux - } -\cs_set_protected:Npn \ProvidesExplFileAux #1#2#3#4 - { - \group_end: - \iow_log:x { File:~#1~#2~v#3~#4 } + \cs_set_protected:Npn \ProvidesExplFile + { + \char_set_catcode_space:n { `\ } + \ProvidesExplFileAux + } + \cs_set_protected:Npn \ProvidesExplFileAux ##1##2##3##4 + { + \group_end: + \iow_log:x { File:~##1~##2~v##3~##4 } + } + \tex_input:D #1 .def \scan_stop: } -\tex_input:D - l3backend- - \sys_if_engine_xetex:TF - { xdvipdfmx } - { - \bool_lazy_and:nnTF - { \cs_if_exist_p:N \tex_pdfoutput:D } - { \int_compare_p:nNn \tex_pdfoutput:D > 0 } - { pdfmode } - { dvips } - } - .def \scan_stop: -\cs_undefine:N \ProvidesExplFile -\cs_undefine:N \ProvidesExplFileAux +% \end{macrocode} +% \end{macro} +% +% Load the standard back-end. +% \begin{macrocode} +\sys_load_backend:n { } % \end{macrocode} % % For the generic loader, a few final steps to take. Turn of \cs{expl3} diff --git a/macros/latex/contrib/l3kernel/expl3.pdf b/macros/latex/contrib/l3kernel/expl3.pdf Binary files differindex 2dccb5f37c..9238eea6fc 100644 --- a/macros/latex/contrib/l3kernel/expl3.pdf +++ b/macros/latex/contrib/l3kernel/expl3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.pdf b/macros/latex/contrib/l3kernel/interface3.pdf Binary files differindex ed56cf9581..86d1535a11 100644 --- a/macros/latex/contrib/l3kernel/interface3.pdf +++ b/macros/latex/contrib/l3kernel/interface3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.tex b/macros/latex/contrib/l3kernel/interface3.tex index b1e51566db..98a236cb65 100644 --- a/macros/latex/contrib/l3kernel/interface3.tex +++ b/macros/latex/contrib/l3kernel/interface3.tex @@ -54,7 +54,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2019-09-19} +\date{Released 2019-09-28} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/l3kernel/l3.ins b/macros/latex/contrib/l3kernel/l3.ins index 8affab2c2d..343d8d7f18 100644 --- a/macros/latex/contrib/l3kernel/l3.ins +++ b/macros/latex/contrib/l3kernel/l3.ins @@ -106,7 +106,7 @@ and all files in that bundle must be distributed together. \from{l3unicode.dtx} {package} \from{l3candidates.dtx} {package} \from{l3legacy.dtx} {package} - \from{l3deprecation.dtx}{package} + \from{l3deprecation.dtx}{package,kernel} } } @@ -136,6 +136,9 @@ and all files in that bundle must be distributed together. \file{l3str-enc-iso885916.def} {\from{l3str-convert.dtx}{iso885916}}% } +\generate{\file{l3debug.def} {\from{l3debug.dtx} {package}}} +\generate{\file{l3deprecation.def}{\from{l3deprecation.dtx}{package,patches}}} + \generate{\file{l3docstrip.tex} {\from{l3docstrip.dtx} {program}}} \generate{\file{l3names.def} {\from{l3names.dtx} {names}}} diff --git a/macros/latex/contrib/l3kernel/l3alloc.dtx b/macros/latex/contrib/l3kernel/l3alloc.dtx index ea73886535..30f1859170 100644 --- a/macros/latex/contrib/l3kernel/l3alloc.dtx +++ b/macros/latex/contrib/l3kernel/l3alloc.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3basics.dtx b/macros/latex/contrib/l3kernel/l3basics.dtx index 1901447816..002e524aa8 100644 --- a/macros/latex/contrib/l3kernel/l3basics.dtx +++ b/macros/latex/contrib/l3kernel/l3basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -1275,6 +1275,24 @@ % execute <false code>. Similar for the other functions. % \end{function} % +% \section{Starting a paragraph} +% +% \begin{function}[added = 2017-07-04]{\mode_leave_vertical:} +% \begin{syntax} +% \cs{mode_leave_vertical:} +% \end{syntax} +% Ensures that \TeX{} is not in vertical (inter-paragraph) mode. In +% horizontal or math mode this command has no effect, in vertical mode it +% switches to horizontal mode, and inserts a box of width +% \tn{parindent}, followed by the \tn{everypar} token list. +% \begin{texnote} +% This results in the contents of the \tn{everypar} token register being +% inserted, after \cs{mode_leave_vertical:} is complete. Notice that in +% contrast to the \LaTeXe{} \tn{leavevmode} approach, no box is used +% by the method implemented here. +% \end{texnote} +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -1690,447 +1708,51 @@ % \begin{macro}{\__kernel_if_debug:TF} % A more meaningful test of whether debugging is enabled than messing % up with guards. We can also more easily change the logic in one -% place then. At present, debugging is disabled in the format and in -% generic mode, while in \LaTeXe{} mode it is enabled if one of the -% options \texttt{enable-debug}, \texttt{log-functions} or -% \texttt{check-declarations} was given. +% place then. This is needed primarily for deprecations. % \begin{macrocode} \cs_set_protected:Npn \__kernel_if_debug:TF #1#2 {#2} -%<*package> -\tex_ifodd:D \l@expl@enable@debug@bool - \cs_set_protected:Npn \__kernel_if_debug:TF #1#2 {#1} -\fi: -%</package> % \end{macrocode} % \end{macro} % -% \begin{macro}{\debug_on:n, \debug_off:n, \@@_all_on:, \@@_all_off:} -% +% \begin{macro}{\debug_on:n, \debug_off:n} +% Stubs. % \begin{macrocode} -\__kernel_if_debug:TF +\cs_set_protected:Npn \debug_on:n #1 { - \cs_set_protected:Npn \debug_on:n #1 - { - \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} } - { - \cs_if_exist_use:cF { @@_ ##1 _on: } - { \__kernel_msg_error:nnn { kernel } { debug } {##1} } - } - } - \cs_set_protected:Npn \debug_off:n #1 - { - \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} } - { - \cs_if_exist_use:cF { @@_ ##1 _off: } - { \__kernel_msg_error:nnn { kernel } { debug } {##1} } - } - } - \cs_set_protected:Npn \@@_all_on: - { - \debug_on:n - { - check-declarations , - check-expressions , - deprecation , - log-functions , - } - } - \cs_set_protected:Npn \@@_all_off: - { - \debug_off:n - { - check-declarations , - check-expressions , - deprecation , - log-functions , - } - } + \__kernel_msg_error:nnx { kernel } { enable-debug } + { \tl_to_str:n { \debug_on:n {#1} } } } +\cs_set_protected:Npn \debug_off:n #1 { - \cs_set_protected:Npn \debug_on:n #1 - { - \__kernel_msg_error:nnx { kernel } { enable-debug } - { \tl_to_str:n { \debug_on:n {#1} } } - } - \cs_set_protected:Npn \debug_off:n #1 - { - \__kernel_msg_error:nnx { kernel } { enable-debug } - { \tl_to_str:n { \debug_off:n {#1} } } - } + \__kernel_msg_error:nnx { kernel } { enable-debug } + { \tl_to_str:n { \debug_off:n {#1} } } } % \end{macrocode} % \end{macro} % % \begin{macro}{\debug_suspend:, \debug_resume:} -% \begin{macro}{\@@_suspended:T} -% \begin{macro}{\l_@@_suspended_tl} -% Suspend and resume locally all debug-related errors and logging -% except deprecation errors. The \cs{debug_suspend:} and \cs{debug_resume:} -% pairs can be nested. We keep track of nesting in a token list -% containing a number of periods. At first begin with the -% \enquote{non-suspended} version of \cs{@@_suspended:T}. -% \begin{macrocode} -\__kernel_if_debug:TF - { - \cs_set_nopar:Npn \l_@@_suspended_tl { } - \cs_set_protected:Npn \debug_suspend: - { - \tl_put_right:Nn \l_@@_suspended_tl { . } - \cs_set_eq:NN \@@_suspended:T \use:n - } - \cs_set_protected:Npn \debug_resume: - { - \tl_set:Nx \l_@@_suspended_tl - { \tl_tail:N \l_@@_suspended_tl } - \tl_if_empty:NT \l_@@_suspended_tl - { - \cs_set_eq:NN \@@_suspended:T \use_none:n - } - } - \cs_set:Npn \@@_suspended:T #1 { } - } - { - \cs_set_protected:Npn \debug_suspend: { } - \cs_set_protected:Npn \debug_resume: { } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% {\@@_check-declarations_on:, \@@_check-declarations_off:} -% \begin{macro}{\__kernel_chk_var_exist:N} -% \begin{macro}{\__kernel_chk_cs_exist:N, \__kernel_chk_cs_exist:c} -% \begin{macro}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N} -% \begin{macro}{\__kernel_chk_var_scope:NN} -% When debugging is enabled these two functions set up functions that -% test their argument (when \texttt{check-declarations} is active) -% \begin{itemize} -% \item \cs{__kernel_chk_var_exist:N} and \cs{__kernel_chk_cs_exist:N}, two -% functions that test that their argument is defined; -% \item \cs{__kernel_chk_var_scope:NN} that checks that its argument |#2| -% has scope |#1|. -% \item \cs{__kernel_chk_var_local:N} and \cs{__kernel_chk_var_global:N} that -% perform both checks. -% \end{itemize} -% \begin{macrocode} -\__kernel_if_debug:TF - { - \exp_args:Nc \cs_set_protected:Npn { @@_check-declarations_on: } - { - \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 - { - \@@_suspended:T \use_none:nnn - \cs_if_exist:NF ##1 - { - \__kernel_msg_error:nnx { kernel } { non-declared-variable } - { \token_to_str:N ##1 } - } - } - \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 - { - \@@_suspended:T \use_none:nnn - \cs_if_exist:NF ##1 - { - \__kernel_msg_error:nnx { kernel } { command-not-defined } - { \token_to_str:N ##1 } - } - } - \cs_set_protected:Npn \__kernel_chk_var_scope:NN - { - \@@_suspended:T \use_none:nnn - \@@_chk_var_scope_aux:NN - } - \cs_set_protected:Npn \__kernel_chk_var_local:N ##1 - { - \@@_suspended:T \use_none:nnnnn - \__kernel_chk_var_exist:N ##1 - \@@_chk_var_scope_aux:NN l ##1 - } - \cs_set_protected:Npn \__kernel_chk_var_global:N ##1 - { - \@@_suspended:T \use_none:nnnnn - \__kernel_chk_var_exist:N ##1 - \@@_chk_var_scope_aux:NN g ##1 - } - } - \exp_args:Nc \cs_set_protected:Npn { @@_check-declarations_off: } - { - \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 { } - \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 { } - \cs_set_protected:Npn \__kernel_chk_var_local:N ##1 { } - \cs_set_protected:Npn \__kernel_chk_var_global:N ##1 { } - \cs_set_protected:Npn \__kernel_chk_var_scope:NN ##1##2 { } - } - \cs_set_protected:Npn \__kernel_chk_cs_exist:c - { \exp_args:Nc \__kernel_chk_cs_exist:N } - \tex_ifodd:D \l@expl@check@declarations@bool - \use:c { @@_check-declarations_on: } - \else: - \use:c { @@_check-declarations_off: } - \fi: - } - { } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@@_chk_var_scope_aux:NN} -% \begin{macro}{\@@_chk_var_scope_aux:Nn} -% \begin{macro}{\@@_chk_var_scope_aux:NNn} -% First check whether the name of the variable |#2| starts with -% \meta{letter}|_|. If it does then pass that letter, the -% \meta{scope}, and the variable name to -% \cs{@@_chk_var_scope_aux:NNn}. That function compares the two -% letters and triggers an error if they differ (the \cs{scan_stop:} -% case is not reachable here). If the second character was not |_| -% then pass the same data to the same auxiliary, except for its first -% argument which is now a control sequence. That control sequence is -% actually a token list (but to avoid triggering the checking code we -% manipulate it using \cs{cs_set_nopar:Npn}) containing a single -% letter \meta{scope} according to what the first assignment to the -% given variable was. -% \begin{macrocode} -\__kernel_if_debug:TF - { - \cs_set_protected:Npn \@@_chk_var_scope_aux:NN #1#2 - { \exp_args:NNf \@@_chk_var_scope_aux:Nn #1 { \cs_to_str:N #2 } } - \cs_set_protected:Npn \@@_chk_var_scope_aux:Nn #1#2 - { - \if:w _ \use_i:nn \use_i_delimit_by_q_stop:nw #2 ? ? \q_stop - \exp_after:wN \@@_chk_var_scope_aux:NNn - \use_i_delimit_by_q_stop:nw #2 ? \q_stop - #1 {#2} - \else: - \exp_args:Nc \@@_chk_var_scope_aux:NNn - { @@_chk_/ #2 } - #1 {#2} - \fi: - } - \cs_set_protected:Npn \@@_chk_var_scope_aux:NNn #1#2#3 - { - \if:w #1 #2 - \else: - \if:w #1 \scan_stop: - \cs_gset_nopar:Npn #1 {#2} - \else: - \__kernel_msg_error:nnxxx { kernel } { local-global } - {#1} {#2} { \iow_char:N \\ #3 } - \fi: - \fi: - } - } - { } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% {\@@_check-expressions_on:, \@@_check-expressions_off:} -% \begin{macro}{\__kernel_chk_expr:nNnN} -% \begin{macro}{\@@_chk_expr_aux:nNnN} -% When debugging is enabled these two functions set -% \cs{__kernel_chk_expr:nNnN} to test or not whether the given -% expression is valid. The idea is to evaluate the expression within -% a brace group (to catch trailing \cs{use_none:nn} or similar), then -% test that the result is what we expect. This is done by turning it -% to an integer and hitting that with \cs{tex_romannumeral:D} after -% replacing the first character by |-0|. If all goes well, that -% primitive finds a non-positive integer and gives an empty output. -% If the original expression evaluation stopped early it leaves a -% trailing \cs{tex_relax:D}, which stops the second evaluation (used -% to convert to integer) before it encounters the final -% \cs{tex_relax:D}. Since \cs{tex_romannumeral:D} does not absorb -% \cs{tex_relax:D} the output will be nonempty. Note that |#3| is -% empty except for mu expressions for which it is \cs{tex_mutoglue:D} -% to avoid an \enquote{incompatible glue units} error. Note also that -% if we had omitted the first \cs{tex_relax:D} then for instance -% |1+2\relax+3| would incorrectly be accepted as a valid integer -% expression. -% \begin{macrocode} -\__kernel_if_debug:TF - { - \exp_args:Nc \cs_set_protected:Npn { @@_check-expressions_on: } - { - \cs_set:Npn \__kernel_chk_expr:nNnN ##1##2 - { - \@@_suspended:T { ##1 \use_none:nnnnnnn } - \exp_after:wN \@@_chk_expr_aux:nNnN - \exp_after:wN { \tex_the:D ##2 ##1 \scan_stop: } - ##2 - } - } - \exp_args:Nc \cs_set_protected:Npn { @@_check-expressions_off: } - { \cs_set:Npn \__kernel_chk_expr:nNnN ##1##2##3##4 {##1} } - \use:c { @@_check-expressions_off: } - \cs_set:Npn \@@_chk_expr_aux:nNnN #1#2#3#4 - { - \tl_if_empty:oF - { - \tex_romannumeral:D - 0 - \exp_after:wN \use_none:n - \int_value:w #3 #2 #1 \scan_stop: - } - { - \__kernel_msg_expandable_error:nnnn - { kernel } { expr } {#4} {#1} - } - #1 - } - } - { } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@@_log-functions_on:, \@@_log-functions_off:} -% \begin{macro}{\__kernel_debug_log:x} -% These two functions (corresponding to the \pkg{expl3} option -% \texttt{log-functions}) control whether \cs{__kernel_debug_log:x} writes to the -% log file or not. Since \cs{iow_log:x} does not yet have its final -% definition we do not use \cs{cs_set_eq:NN} (not defined yet anyway). -% Once everything is defined, turn logging on or off depending on what -% option was given. When debugging is not enabled, simply produce an -% error. % \begin{macrocode} -\__kernel_if_debug:TF - { - \exp_args:Nc \cs_set_protected:Npn { @@_log-functions_on: } - { - \cs_set_protected:Npn \__kernel_debug_log:x - { \@@_suspended:T \use_none:nn \iow_log:x } - } - \exp_args:Nc \cs_set_protected:Npn { @@_log-functions_off: } - { \cs_set_protected:Npn \__kernel_debug_log:x { \use_none:n } } - \tex_ifodd:D \l@expl@log@functions@bool - \use:c { @@_log-functions_on: } - \else: - \use:c { @@_log-functions_off: } - \fi: - } - { } +\cs_set_protected:Npn \debug_suspend: { } +\cs_set_protected:Npn \debug_resume: { } % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\@@_deprecation_on:, \@@_deprecation_off:} % \begin{macro}{\__kernel_deprecation_code:nn} % \begin{variable}{\g_@@_deprecation_on_tl, \g_@@_deprecation_off_tl} % Some commands were more recently deprecated and not yet removed; % only make these into errors if the user requests it. This relies on % two token lists, filled up in \pkg{l3deprecation}. % \begin{macrocode} -\__kernel_if_debug:TF - { - \cs_set_protected:Npn \@@_deprecation_on: - { \g_@@_deprecation_on_tl } - \cs_set_protected:Npn \@@_deprecation_off: - { \g_@@_deprecation_off_tl } - \cs_set_nopar:Npn \g_@@_deprecation_on_tl { } - \cs_set_nopar:Npn \g_@@_deprecation_off_tl { } - \cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2 - { - \tl_gput_right:Nn \g_@@_deprecation_on_tl {#1} - \tl_gput_right:Nn \g_@@_deprecation_off_tl {#2} - } - } +\cs_set_nopar:Npn \g_@@_deprecation_on_tl { } +\cs_set_nopar:Npn \g_@@_deprecation_off_tl { } +\cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2 { - \cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2 { } + \tl_gput_right:Nn \g_@@_deprecation_on_tl {#1} + \tl_gput_right:Nn \g_@@_deprecation_off_tl {#2} } % \end{macrocode} % \end{variable} % \end{macro} -% \end{macro} -% -% \begin{macro} -% {\__kernel_patch:nnNNpn, \__kernel_patch_conditional:nNNpnn} -% \begin{macro} -% {\@@_patch_aux:nnnn, \@@_patch_auxii:nnnn} -% When debugging is not enabled, \cs{__kernel_patch:nnNNpn} and -% \cs{__kernel_patch_conditional:nNNpnn} throw the patch away. -% Otherwise they can be followed by \cs{cs_new:Npn} (or similar), and -% \cs{prg_new_conditional:Npnn} (or similar), respectively. In each -% case, grab the name of the function to be defined and its parameters -% then insert tokens before and/or after the definition. -% \begin{macrocode} -\__kernel_if_debug:TF - { - \cs_set_protected:Npn \__kernel_patch:nnNNpn #1#2#3#4#5# - { \@@_patch_aux:nnnn {#1} {#2} { #3 #4 #5 } } - \cs_set_protected:Npn \__kernel_patch_conditional:nNNpnn #1#2#3#4# - { \@@_patch_auxii:nnnn {#1} { #2 #3 #4 } } - \cs_set_protected:Npn \@@_patch_aux:nnnn #1#2#3#4 - { #3 { #1 #4 #2 } } - \cs_set_protected:Npn \@@_patch_auxii:nnnn #1#2#3#4 - { #2 {#3} { #1 #4 } } - } - { - \cs_set_protected:Npn \__kernel_patch:nnNNpn #1#2 { } - \cs_set_protected:Npn \__kernel_patch_conditional:nNNpnn #1 { } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% {\__kernel_patch_args:nNNpn, \__kernel_patch_conditional_args:nNNpnn} -% \begin{macro} -% {\__kernel_patch_args:nnnNNpn, \__kernel_patch_conditional_args:nnnNNpnn} -% \begin{macro} -% { -% \@@_tmp:w, -% \@@_patch_args_aux:nnnNNnn, -% \@@_patch_args_aux:nnnNNnnn, -% \@@_patch_args_aux:nnnn -% } -% See \cs{__kernel_patch:nnNNpn}. The first argument is something like -% |{#1}{(#2)}|. Define a temporary macro using the \meta{parameters} -% and \meta{code} of the definition that follows, then expand that -% temporary macro in front of the first argument to obtain new -% \meta{code}. Then perform the definition as if that new \meta{code} -% was directly typed in the file. -% \begin{macrocode} -\cs_set_protected:Npn \__kernel_patch_args:nNNpn - { \__kernel_patch_args:nnnNNpn { } { } } -\cs_set_protected:Npn \__kernel_patch_conditional_args:nNNpnn - { \__kernel_patch_conditional_args:nnnNNpnn { } { } } -\__kernel_if_debug:TF - { - \cs_set_protected:Npn \__kernel_patch_args:nnnNNpn #1#2#3#4#5#6# - { \@@_patch_args_aux:nnnNNnn {#1} {#2} {#3} #4 #5 {#6} } - \cs_set_protected:Npn \__kernel_patch_conditional_args:nnnNNpnn - #1#2#3#4#5#6# - { \@@_patch_args_aux:nnnNNnnn {#1} {#2} {#3} #4 #5 {#6} } - \cs_set_protected:Npn \@@_patch_args_aux:nnnNNnn #1#2#3#4#5#6#7 - { - \cs_set:Npn \@@_tmp:w #6 {#7} - \exp_after:wN \@@_patch_args_aux:nnnn \exp_after:wN - { \@@_tmp:w #3 } { #4 #5 #6 } {#1} {#2} - } - \cs_set_protected:Npn \@@_patch_args_aux:nnnNNnnn #1#2#3#4#5#6#7#8 - { - \cs_set:Npn \@@_tmp:w #6 {#8} - \exp_after:wN \@@_patch_args_aux:nnnn \exp_after:wN - { \@@_tmp:w #3 } { #4 #5 #6 {#7} } {#1} {#2} - } - \cs_set_protected:Npn \@@_patch_args_aux:nnnn #1#2#3#4 - { #2 { #3 #1 #4 } } - } - { - \cs_set_protected:Npn \__kernel_patch_args:nnnNNpn #1#2#3 { } - \cs_set_protected:Npn \__kernel_patch_conditional_args:nnnNNpnn - #1#2#3 { } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Conditional processing and definitions} % @@ -2515,20 +2137,12 @@ #5 {#1} {#2} {#3} {#4} \@@_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5 } -\__kernel_patch:nnNNpn - { \__kernel_chk_cs_exist:c { #5 _p : #6 } } { } \cs_set:Npn \@@_set_eq_conditional_p_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 _p : #4 } { #5 _p : #6 } } -\__kernel_patch:nnNNpn - { \__kernel_chk_cs_exist:c { #5 : #6 TF } } { } \cs_set:Npn \@@_set_eq_conditional_TF_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 : #4 TF } { #5 : #6 TF } } -\__kernel_patch:nnNNpn - { \__kernel_chk_cs_exist:c { #5 : #6 T } } { } \cs_set:Npn \@@_set_eq_conditional_T_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 : #4 T } { #5 : #6 T } } -\__kernel_patch:nnNNpn - { \__kernel_chk_cs_exist:c { #5 : #6 F } } { } \cs_set:Npn \@@_set_eq_conditional_F_form:wNnnnn #1 \q_stop #2#3#4#5#6 { #2 { #3 : #4 F } { #5 : #6 F } } % \end{macrocode} @@ -2889,11 +2503,6 @@ % issued. We have to make sure we don't put the argument into the % conditional processing since it may be an |\if...| type function! % \begin{macrocode} -\__kernel_patch:nnNNpn { } - { - \__kernel_debug_log:x - { Defining~\token_to_str:N #1~ \msg_line_context: } - } \cs_set_protected:Npn \__kernel_chk_if_free_cs:N #1 { \cs_if_free:NF #1 @@ -3591,6 +3200,28 @@ % \end{macro} % \end{macro} % +% \subsection{Starting a paragraph} +% +% \begin{macro}{\mode_leave_vertical:} +% The approach here is different to that used by \LaTeXe{} or plain \TeX{}, +% which unbox a void box to force horizontal mode. That inserts the +% \tn{everypar} tokens \emph{before} the re-inserted unboxing tokens. The +% approach here uses either the \tn{quitvmode} primitive or the equivalent +% protected macro. In vertical mode, the \tn{indent} primitive is inserted: +% this will switch to horizontal mode and insert \tn{everypar} tokens and +% nothing else. Unlike the \LaTeXe{} version, the availability of \eTeX{} +% means using a mode test can be done at for example the start of an +% \tn{halign}. +% \begin{macrocode} +\cs_new_protected:Npn \mode_leave_vertical: + { + \if_mode_vertical: + \exp_after:wN \tex_indent:D + \fi: + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3bootstrap.dtx b/macros/latex/contrib/l3kernel/l3bootstrap.dtx index d694a67540..8dd79bc523 100644 --- a/macros/latex/contrib/l3kernel/l3bootstrap.dtx +++ b/macros/latex/contrib/l3kernel/l3bootstrap.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3box.dtx b/macros/latex/contrib/l3kernel/l3box.dtx index c72206a2b2..815f0ca6df 100644 --- a/macros/latex/contrib/l3kernel/l3box.dtx +++ b/macros/latex/contrib/l3kernel/l3box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -903,13 +903,6 @@ % produce an internal dimension rather than expand it into characters. % \begin{macrocode} \cs_new_eq:NN \@@_dim_eval:w \tex_dimexpr:D -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} - \@@_dim_eval:w { } \@@_dim_eval:n - } - } \cs_new:Npn \@@_dim_eval:n #1 { \@@_dim_eval:w #1 \scan_stop: } % \end{macrocode} @@ -972,10 +965,8 @@ % \testfile* % Assigning the contents of a box to be another box. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \box_set_eq:NN #1#2 { \tex_setbox:D #1 \tex_copy:D #2 } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \box_gset_eq:NN #1#2 { \tex_global:D \tex_setbox:D #1 \tex_copy:D #2 } \cs_generate_variant:Nn \box_set_eq:NN { c , Nc , cc } @@ -997,10 +988,8 @@ % Assigning the contents of a box to be another box, then drops the % original box. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \box_set_eq_drop:NN #1#2 { \tex_setbox:D #1 \tex_box:D #2 } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \box_gset_eq_drop:NN #1#2 { \tex_global:D \tex_setbox:D #1 \tex_box:D #2 } \cs_generate_variant:Nn \box_set_eq_drop:NN { c , Nc , cc } @@ -1165,10 +1154,8 @@ % \testfile* % Set a box to the previous box. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \box_set_to_last:N #1 { \tex_setbox:D #1 \tex_lastbox:D } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \box_gset_to_last:N #1 { \tex_global:D \tex_setbox:D #1 \tex_lastbox:D } \cs_generate_variant:Nn \box_set_to_last:N { c } @@ -1285,13 +1272,11 @@ % \begin{macro}{\hbox_gset:Nn, \hbox_gset:cn} % \testfile* % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D { \color_group_begin: #2 \color_group_end: } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \hbox_gset:Nn #1#2 { \tex_global:D \tex_setbox:D #1 \tex_hbox:D @@ -1309,13 +1294,11 @@ % Storing material in a horizontal box with a specified width. % Again, put the dimension expression in parentheses when debugging. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 { \tex_setbox:D #1 \tex_hbox:D to \@@_dim_eval:n {#2} { \color_group_begin: #3 \color_group_end: } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \hbox_gset_to_wd:Nnn #1#2#3 { \tex_global:D \tex_setbox:D #1 \tex_hbox:D to \@@_dim_eval:n {#2} @@ -1334,14 +1317,12 @@ % Storing material in a horizontal box. This type is useful in % environment definitions. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \hbox_set:Nw #1 { \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token \color_group_begin: } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \hbox_gset:Nw #1 { \tex_global:D \tex_setbox:D #1 \tex_hbox:D @@ -1365,14 +1346,12 @@ % \begin{macro}{\hbox_gset_to_wd:Nnw, \hbox_gset_to_wd:cnw} % Combining the above ideas. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2 { \tex_setbox:D #1 \tex_hbox:D to \@@_dim_eval:n {#2} \c_group_begin_token \color_group_begin: } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \hbox_gset_to_wd:Nnw #1#2 { \tex_global:D \tex_setbox:D #1 \tex_hbox:D to \@@_dim_eval:n {#2} @@ -1473,13 +1452,11 @@ % \testfile* % Storing material in a vertical box with a natural height. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \vbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_vbox:D { \color_group_begin: #2 \par \color_group_end: } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \vbox_gset:Nn #1#2 { \tex_global:D \tex_setbox:D #1 \tex_vbox:D @@ -1497,13 +1474,11 @@ % Storing material in a vertical box with a natural height and reference % point at the baseline of the first object in the box. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \vbox_set_top:Nn #1#2 { \tex_setbox:D #1 \tex_vtop:D { \color_group_begin: #2 \par \color_group_end: } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \vbox_gset_top:Nn #1#2 { \tex_global:D \tex_setbox:D #1 \tex_vtop:D @@ -1520,13 +1495,11 @@ % \testfile* % Storing material in a vertical box with a specified height. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 { \tex_setbox:D #1 \tex_vbox:D to \@@_dim_eval:n {#2} { \color_group_begin: #3 \par \color_group_end: } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \vbox_gset_to_ht:Nnn #1#2#3 { \tex_global:D \tex_setbox:D #1 \tex_vbox:D to \@@_dim_eval:n {#2} @@ -1545,14 +1518,12 @@ % Storing material in a vertical box. This type is useful in % environment definitions. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \vbox_set:Nw #1 { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token \color_group_begin: } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \vbox_gset:Nw #1 { \tex_global:D \tex_setbox:D #1 \tex_vbox:D @@ -1577,14 +1548,12 @@ % \begin{macro}{\vbox_gset_to_ht:Nnw, \vbox_gset_to_ht:cnw} % A combination of the above ideas. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2 { \tex_setbox:D #1 \tex_vbox:D to \@@_dim_eval:n {#2} \c_group_begin_token \color_group_begin: } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \vbox_gset_to_ht:Nnw #1#2 { \tex_global:D \tex_setbox:D #1 \tex_vbox:D to \@@_dim_eval:n {#2} @@ -1620,11 +1589,9 @@ % \testfile* % Splitting a vertical box in two. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3 { \tex_setbox:D #1 \tex_vsplit:D #2 to \@@_dim_eval:n {#3} } \cs_generate_variant:Nn \vbox_set_split_to_ht:NNn { c , Nc , cc } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \vbox_gset_split_to_ht:NNn #1#2#3 { \tex_global:D \tex_setbox:D #1 diff --git a/macros/latex/contrib/l3kernel/l3candidates.dtx b/macros/latex/contrib/l3kernel/l3candidates.dtx index 96dbdc5c78..d726722ad1 100644 --- a/macros/latex/contrib/l3kernel/l3candidates.dtx +++ b/macros/latex/contrib/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -123,22 +123,6 @@ % See for instance \pkg{l3coffins}. % \end{function} % -% \begin{function}[added = 2017-07-04]{\mode_leave_vertical:} -% \begin{syntax} -% \cs{mode_leave_vertical:} -% \end{syntax} -% Ensures that \TeX{} is not in vertical (inter-paragraph) mode. In -% horizontal or math mode this command has no effect, in vertical mode it -% switches to horizontal mode, and inserts a box of width -% \tn{parindent}, followed by the \tn{everypar} token list. -% \begin{texnote} -% This results in the contents of the \tn{everypar} token register being -% inserted, after \cs{mode_leave_vertical:} is complete. Notice that in -% contrast to the \LaTeXe{} \tn{leavevmode} approach, no box is used -% by the method implemented here. -% \end{texnote} -% \end{function} -% % \section{Additions to \pkg{l3box}} % % \subsection{Viewing part of a box} @@ -221,31 +205,6 @@ % % \section{Additions to \pkg{l3fp}} % -% \begin{function}[EXP, added = 2018-11-03]{logb} -% \begin{syntax} -% \cs{fp_eval:n} \{ |logb(| \meta{fpexpr} |)| \} -% \end{syntax} -% Determines the exponent of the \meta{fpexpr}, namely the floor of -% the base-$10$ logarithm of its absolute value. \enquote{Division by -% zero} occurs when evaluating $\operatorname{logb}(\pm 0) = -\infty$. -% Other special values are $\operatorname{logb}(\pm\infty)=+\infty$ -% and $\operatorname{logb}(\nan{})=\nan{}$. If the operand is a tuple -% or is \nan{}, then \enquote{invalid operation} occurs and the result -% is \nan{}. -% \end{function} -% -% \begin{function}[EXP, added = 2018-11-03]{\fp_sign:n} -% \begin{syntax} -% \cs{fp_sign:n} \Arg{fpexpr} -% \end{syntax} -% Evaluates the \meta{fpexpr} and leaves its sign in the input stream -% using \cs{fp_eval:n} |{sign(|\meta{result}|)}|: $+1$ for positive -% numbers and for $+\infty$, $-1$ for negative numbers and for -% $-\infty$, $\pm 0$ for $\pm 0$. If the operand is a tuple or is -% \nan{}, then \enquote{invalid operation} occurs and the result -% is~$0$. -% \end{function} -% % \begin{function}[pTF, added = 2019-08-25]{\fp_if_nan:n} % \begin{syntax} % \cs{fp_if_nan:n} \Arg{fpexpr} @@ -255,112 +214,8 @@ % a tuple containing \nan{}. % \end{function} % -% \section{Additions to \pkg{l3fparray}} -% -% \begin{function}[added = 2018-05-05]{\fparray_new:Nn} -% \begin{syntax} -% \cs{fparray_new:Nn} \meta{fparray~var} \Arg{size} -% \end{syntax} -% Evaluates the integer expression \meta{size} and allocates an -% \meta{floating point array variable} with that number of (zero) -% entries. The variable name should start with |\g_| because -% assignments are always global. -% \end{function} -% -% \begin{function}[EXP, added = 2018-05-05]{\fparray_count:N} -% \begin{syntax} -% \cs{fparray_count:N} \meta{fparray~var} -% \end{syntax} -% Expands to the number of entries in the \meta{floating point array -% variable}. This is performed in constant time. -% \end{function} -% -% \begin{function}[added = 2018-05-05]{\fparray_gset:Nnn} -% \begin{syntax} -% \cs{fparray_gset:Nnn} \meta{fparray~var} \Arg{position} \Arg{value} -% \end{syntax} -% Stores the result of evaluating the floating point expression -% \meta{value} into the \meta{floating point array variable} at the -% (integer expression) \meta{position}. If the \meta{position} is not -% between $1$ and the \cs{fparray_count:N}, an error occurs. -% Assignments are always global. -% \end{function} -% -% \begin{function}[added = 2018-05-05]{\fparray_gzero:N} -% \begin{syntax} -% \cs{fparray_gzero:N} \meta{fparray~var} -% \end{syntax} -% Sets all entries of the \meta{floating point array variable} to -% $+0$. Assignments are always global. -% \end{function} -% -% \begin{function}[EXP, added = 2018-05-05] -% {\fparray_item:Nn, \fparray_item_to_tl:Nn} -% \begin{syntax} -% \cs{fparray_item:Nn} \meta{fparray~var} \Arg{position} -% \end{syntax} -% Applies \cs{fp_use:N} or \cs{fp_to_tl:N} (respectively) to the -% floating point entry stored at the (integer expression) -% \meta{position} in the \meta{floating point array variable}. If the -% \meta{position} is not between $1$ and the \cs{fparray_count:N}, an -% error occurs. -% \end{function} -% % \section{Additions to \pkg{l3file}} % -% \begin{function}[added = 2019-05-13, TF]{\file_compare_timestamp:nNn} -% \begin{syntax} -% \cs{file_compare_timestamp:nNn} \Arg{file-1} \meta{comparator} \Arg{file-2} \Arg{true code} \Arg{false code} -% \end{syntax} -% Compares the file stamps on the two \meta{files} as indicated by -% the \meta{comparator}, and inserts either the \meta{true code} -% or \meta{false case} as required. A file which is not found -% is treated as older than any file which is found.This allows for -% example the construct -% \begin{verbatim} -% \file_compare_timestamp:nNnT { source-file } > { derived-file } -% { -% % Code to regenerate derived file -% } -% \end{verbatim} -% to work when the derived file is entirely absent. The timestamp -% of two absent files is regarded as different. -% \end{function} -% -% \begin{function}[added = 2019-01-13]{\ior_map_variable:NNn} -% \begin{syntax} -% \cs{ior_map_variable:NNn} \meta{stream} \meta{tl~var} \Arg{code} -% \end{syntax} -% For each set of \meta{lines} obtained by calling \cs{ior_get:NN} -% until reaching the end of the file, stores the \meta{lines} in the -% \meta{tl~var} then applies the \meta{code}. The \meta{code} will -% usually make use of the \meta{variable}, but this is not enforced. -% The assignments to the \meta{variable} are local. -% Its value after the loop is the last set of \meta{lines}, or its -% original value if the \meta{stream} is empty. \TeX{} ignores -% any trailing new-line marker from the file it reads. -% This function is typically faster than \cs{ior_map_inline:Nn}. -% \end{function} -% -% \begin{function}[added = 2019-01-13]{\ior_str_map_variable:NNn} -% \begin{syntax} -% \cs{ior_str_map_variable:NNn} \meta{stream} \meta{variable} \Arg{code} -% \end{syntax} -% For each \meta{line} in the \meta{stream}, stores the \meta{line} in -% the \meta{variable} then applies the \meta{code}. The material is -% read from the \meta{stream} as a series of tokens with category code -% $12$ (other), with the exception of space characters which are given -% category code $10$ (space). The \meta{code} will usually make use -% of the \meta{variable}, but this is not enforced. The assignments -% to the \meta{variable} are local. Its value after the loop is the -% last \meta{line}, or its original value if the \meta{stream} is -% empty. Note that \TeX{} removes trailing -% space and tab characters (character codes 32 and 9) from every line -% upon input. \TeX{} also ignores any trailing new-line marker from -% the file it reads. -% This function is typically faster than \cs{ior_str_map_inline:Nn}. -% \end{function} -% % \begin{function}[added = 2018-12-29]{\iow_allow_break:} % \begin{syntax} % \cs{iow_allow_break:} @@ -402,7 +257,7 @@ % If piped system calls are disabled an error is raised. % % For details of handling of the \meta{shell command}, see -% \cs{sys_shell_get:nnN(TF)}. +% \cs{sys_get_shell:nnN(TF)}. % \end{function} % % \section{Additions to \pkg{l3flag}} @@ -415,19 +270,13 @@ % locally. % \end{function} % -% \section{Additions to \pkg{l3int}} -% -% \begin{function}[EXP, added = 2018-11-03]{\int_sign:n} -% \begin{syntax} -% \cs{int_sign:n} \Arg{intexpr} -% \end{syntax} -% Evaluates the \meta{integer expression} then leaves $1$ or $0$ or -% $-1$ in the input stream according to the sign of the result. -% \end{function} -% % \section{Additions to \pkg{l3intarray}} % -% \begin{function}[added = 2018-05-05]{\intarray_gset_rand:Nnn, \intarray_gset_rand:Nn} +% \begin{function}[added = 2018-05-05] +% { +% \intarray_gset_rand:Nnn, \intarray_gset_rand:cnn, +% \intarray_gset_rand:Nn, \intarray_gset_rand:cn +% } % \begin{syntax} % \cs{intarray_gset_rand:Nnn} \meta{intarray~var} \Arg{minimum} \Arg{maximum} % \cs{intarray_gset_rand:Nn} \meta{intarray~var} \Arg{maximum} @@ -446,16 +295,6 @@ % % \subsection{Working with contents of integer arrays} % -% \begin{function}[added = 2018-05-04, rEXP]{\intarray_const_from_clist:Nn} -% \begin{syntax} -% \cs{intarray_const_from_clist:Nn} \meta{intarray~var} \meta{intexpr clist} -% \end{syntax} -% Creates a new constant \meta{integer array variable} or raises an -% error if the name is already taken. The \meta{integer array -% variable} is set (globally) to contain as its items the results of -% evaluating each \meta{integer expression} in the \meta{comma list}. -% \end{function} -% % \begin{function}[added = 2018-05-04, rEXP]{\intarray_to_clist:N} % \begin{syntax} % \cs{intarray_to_clist:N} \meta{intarray~var} @@ -466,15 +305,6 @@ % result has one fewer comma than the number of items. % \end{function} % -% \begin{function}[added = 2018-05-04]{\intarray_show:N, \intarray_log:N} -% \begin{syntax} -% \cs{intarray_show:N} \meta{intarray~var} -% \cs{intarray_log:N} \meta{intarray~var} -% \end{syntax} -% Displays the items in the \meta{integer array variable} in the -% terminal or writes them in the log file. -% \end{function} -% % \section{Additions to \pkg{l3msg}} % % In very rare cases it may be necessary to produce errors in an @@ -566,15 +396,6 @@ % % \section{Additions to \pkg{l3prg}} % -% \begin{function}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn} -% \begin{syntax} -% \cs{bool_const:Nn} \meta{boolean} \Arg{boolexpr} -% \end{syntax} -% Creates a new constant \meta{boolean} or raises an error if the name -% is already taken. The value of the \meta{boolean} is set globally to -% the result of evaluating the \meta{boolexpr}. -% \end{function} -% % \begin{function}[added = 2018-05-10] % { % \bool_set_inverse:N , \bool_set_inverse:c , @@ -606,37 +427,6 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2017-11-28, updated = 2019-08-25] -% { -% \prop_set_from_keyval:Nn, \prop_set_from_keyval:cn, -% \prop_gset_from_keyval:Nn, \prop_gset_from_keyval:cn, -% } -% \begin{syntax} -% \cs{prop_set_from_keyval:Nn} \meta{prop~var} -% \{ -% \meta{key1} |=| \meta{value1} |,| -% \meta{key2} |=| \meta{value2} |,| \ldots{} -% \} -% \end{syntax} -% Sets \meta{prop~var} to contain key--value pairs given in the second -% argument. If duplicate keys appear only one of the values is kept. -% \end{function} -% -% \begin{function}[added = 2017-11-28, updated = 2019-08-25] -% {\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn} -% \begin{syntax} -% \cs{prop_const_from_keyval:Nn} \meta{prop~var} -% \{ -% \meta{key1} |=| \meta{value1} |,| -% \meta{key2} |=| \meta{value2} |,| \ldots{} -% \} -% \end{syntax} -% Creates a new constant \meta{prop~var} or raises an error if the -% name is already taken. The \meta{prop~var} is set globally to -% contain key--value pairs given in the second argument. -% If duplicate keys appear only one of the values is kept. -% \end{function} -% % \section{Additions to \pkg{l3seq}} % % \begin{function}[rEXP] @@ -690,16 +480,6 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2017-11-28] -% {\seq_const_from_clist:Nn, \seq_const_from_clist:cn} -% \begin{syntax} -% \cs{seq_const_from_clist:Nn} \meta{seq~var} \Arg{comma-list} -% \end{syntax} -% Creates a new constant \meta{seq~var} or raises an error if the name -% is already taken. The \meta{seq~var} is set globally to contain the -% items in the \meta{comma list}. -% \end{function} -% % \begin{function}[added = 2018-04-06] % {\seq_set_from_function:NnN, \seq_gset_from_function:NnN} % \begin{syntax} @@ -738,23 +518,6 @@ % mappings. % \end{function} % -% \begin{function}[added = 2018-04-29]{\seq_shuffle:N, \seq_gshuffle:N} -% \begin{syntax} -% \cs{seq_shuffle:N} \meta{seq~var} -% \end{syntax} -% Sets the \meta{seq~var} to the result of placing the items of the -% \meta{seq~var} in a random order. Each item is (roughly) as likely -% to end up in any given position. -% \begin{texnote} -% For sequences with more than $13$ items or so, only a small -% proportion of all possible permutations can be reached, because -% the random seed \cs{sys_rand_seed:} only has $28$-bits. The use -% of \tn{toks} internally means that sequences with more than -% $32767$ or $65535$ items (depending on the engine) cannot be -% shuffled. -% \end{texnote} -% \end{function} -% % \begin{function}[added = 2018-05-03]{\seq_indexed_map_function:NN} % \begin{syntax} % \cs{seq_indexed_map_function:NN} \meta{seq~var} \meta{function} @@ -775,37 +538,8 @@ % and so on) as~|#1| and the \meta{item} as~|#2|. % \end{function} % -% \section{Additions to \pkg{l3skip}} -% -% \begin{function}[EXP, added = 2018-11-03]{\dim_sign:n} -% \begin{syntax} -% \cs{dim_sign:n} \Arg{dimexpr} -% \end{syntax} -% Evaluates the \meta{dimexpr} then leaves $1$ or $0$ or $-1$ in the -% input stream according to the sign of the result. -% \end{function} -% % \section{Additions to \pkg{l3sys}} % -% \begin{function}[noTF, added = 2019-01-16, updated = 2019-02-16] -% {\sys_shell_get:nnN} -% \begin{syntax} -% \cs{sys_shell_get:nnN} \Arg{shell~command} \Arg{setup} \meta{tl~var} -% \cs{sys_shell_get:nnNTF} \Arg{shell~command} \Arg{setup} \meta{tl~var} \Arg{true code} \Arg{false code} -% \end{syntax} -% Defines \meta{tl} to the text returned by the \meta{shell command}. -% The \meta{shell command} is converted to a string using -% \cs{tl_to_str:n}. Category codes may need to be set appropriately -% via the \meta{setup} argument, which is run just before running the -% \meta{shell command} (in a group). -% If shell escape is disabled, the \meta{tl~var} will be set to -% \cs{q_no_value} in the non-branching version. -% Note that quote characters (|"|) \emph{cannot} be used inside the -% \meta{shell command}. The \cs{sys_shell_get:nnNTF} conditional -% returns \texttt{true} if the shell is available and no quote is -% detected, and \texttt{false} otherwise. -% \end{function} -% % \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str} % The version string of the current engine, in the same form as % given in the banner issued when running a job. For \pdfTeX{} @@ -836,106 +570,6 @@ % this is the case in \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{}. % \end{function} % -% \begin{function}[added = 2017-05-27, EXP]{\sys_rand_seed:} -% \begin{syntax} -% \cs{sys_rand_seed:} -% \end{syntax} -% Expands to the current value of the engine's random seed, a -% non-negative integer. In engines without random number support this -% expands to $0$. -% \end{function} -% -% \begin{function}[added = 2017-05-27]{\sys_gset_rand_seed:n} -% \begin{syntax} -% \cs{sys_gset_rand_seed:n} \Arg{intexpr} -% \end{syntax} -% Globally sets the seed for the engine's pseudo-random number -% generator to the \meta{integer expression}. This random seed -% affects all \cs[no-index]{\ldots{}_rand} functions (such as -% \cs{int_rand:nn} or \cs{clist_rand_item:n}) as well as other -% packages relying on the engine's random number generator. In -% engines without random number support this produces an error. -% \begin{texnote} -% While a $32$-bit (signed) integer can be given as a seed, only the -% absolute value is used and any number beyond $2^{28}$ is divided -% by an appropriate power of~$2$. We recommend using an integer in -% $[0,2^{28}-1]$. -% \end{texnote} -% \end{function} -% -% \begin{function}[added = 2018-07-27, EXP, pTF] -% { -% \sys_if_platform_unix:, -% \sys_if_platform_windows: -% } -% \begin{syntax} -% \cs{sys_if_platform_unix:TF} \Arg{true code} \Arg{false code} -% \end{syntax} -% Conditionals which allow platform-specific code to be used. The names -% follow the \Lua{} |os.type()| function, \emph{i.e.}~all Unix-like systems -% are |unix| (including Linux and MacOS). -% \end{function} -% -% \begin{variable}[added = 2018-07-27]{\c_sys_platform_str} -% The current platform given as a lower case string: one of -% |unix|, |windows| or |unknown|. -% \end{variable} -% -% \begin{variable}[added = 2017-05-27]{\c_sys_shell_escape_int} -% This variable exposes the internal triple of the shell escape -% status. The possible values are -% \begin{description} -% \item[0] Shell escape is disabled -% \item[1] Unrestricted shell escape is enabled -% \item[2] Restricted shell escape is enabled -% \end{description} -% \end{variable} -% -% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell:} -% \begin{syntax} -% \cs{sys_if_shell_p:} -% \cs{sys_if_shell:TF} \Arg{true code} \Arg{false code} -% \end{syntax} -% Performs a check for whether shell escape is enabled. This -% returns true if either of restricted or unrestricted shell escape -% is enabled. -% \end{function} -% -% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_unrestricted:} -% \begin{syntax} -% \cs{sys_if_shell_unrestricted_p:} -% \cs{sys_if_shell_unrestricted:TF} \Arg{true code} \Arg{false code} -% \end{syntax} -% Performs a check for whether \emph{unrestricted} shell escape is -% enabled. -% \end{function} -% -% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_restricted:} -% \begin{syntax} -% \cs{sys_if_shell_restricted_p:} -% \cs{sys_if_shell_restricted:TF} \Arg{true code} \Arg{false code} -% \end{syntax} -% Performs a check for whether \emph{restricted} shell escape is -% enabled. This returns false if unrestricted shell escape is -% enabled. Unrestricted shell escape is not considered a superset -% of restricted shell escape in this case. To find whether any -% shell escape is enabled use \cs{sys_if_shell:}. -% \end{function} -% -% \begin{function}[added = 2017-05-27]{\sys_shell_now:n, \sys_shell_now:x} -% \begin{syntax} -% \cs{sys_shell_now:n} \Arg{tokens} -% \end{syntax} -% Execute \meta{tokens} through shell escape immediately. -% \end{function} -% -% \begin{function}[added = 2017-05-27]{\sys_shell_shipout:n, \sys_shell_shipout:x} -% \begin{syntax} -% \cs{sys_shell_shipout:n} \Arg{tokens} -% \end{syntax} -% Execute \meta{tokens} through shell escape at shipout. -% \end{function} -% % \section{Additions to \pkg{l3tl}} % % \begin{function}[EXP, added = 2014-06-30, updated = 2016-01-12] @@ -1335,28 +969,6 @@ %<*initex|package> % \end{macrocode} % -% \subsection{Additions to \pkg{l3basics}} -% -% \begin{macro}{\mode_leave_vertical:} -% The approach here is different to that used by \LaTeXe{} or plain \TeX{}, -% which unbox a void box to force horizontal mode. That inserts the -% \tn{everypar} tokens \emph{before} the re-inserted unboxing tokens. The -% approach here uses either the \tn{quitvmode} primitive or the equivalent -% protected macro. In vertical mode, the \tn{indent} primitive is inserted: -% this will switch to horizontal mode and insert \tn{everypar} tokens and -% nothing else. Unlike the \LaTeXe{} version, the availability of \eTeX{} -% means using a mode test can be done at for example the start of an -% \tn{halign}. -% \begin{macrocode} -\cs_new_protected:Npn \mode_leave_vertical: - { - \if_mode_vertical: - \exp_after:wN \tex_indent:D - \fi: - } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3box}} % % \begin{macrocode} @@ -1519,22 +1131,6 @@ % \end{macro} % \end{macro} % -% \subsection{Additions to \pkg{l3fp-convert}} -% -% \begin{macrocode} -%<@@=fp> -% \end{macrocode} -% -% \begin{macro}{\fp_sign:n} -% Trivial but useful. See the implementation of \cs{fp_add:Nn} for an -% explanation of why to use \cs{@@_parse:n}, namely, for better error -% reporting. -% \begin{macrocode} -\cs_new:Npn \fp_sign:n #1 - { \fp_to_decimal:n { sign \@@_parse:n {#1} } } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3flag}} % % \begin{macrocode} @@ -1547,7 +1143,6 @@ % it if the flag is zero in case the \enquote{trap} made customizable % in the future. % \begin{macrocode} -\__kernel_patch:nnNNpn { \@@_chk_exist:n {#1} } { } \cs_new:Npn \flag_raise_if_clear:n #1 { \if_cs_exist:w flag~#1~0 \cs_end: @@ -1558,39 +1153,6 @@ % \end{macrocode} % \end{macro} % -% \subsection{Additions to \pkg{l3int}} -% -% \begin{macrocode} -%<@@=int> -% \end{macrocode} -% -% \begin{macro}[EXP]{\int_sign:n, \@@_sign:Nw} -% See \cs{int_abs:n}. Evaluate the expression once (and when -% debugging is enabled, check that the expression is well-formed), -% then test the first character to determine the sign. This is -% wrapped in \cs{int_value:w} \ldots{} \cs{exp_stop_f:} to ensure a -% fixed number of expansions and to avoid dealing with closing the -% conditionals. -% \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_sign:n } } -\cs_new:Npn \int_sign:n #1 - { - \int_value:w \exp_after:wN \@@_sign:Nw - \int_value:w \@@_eval:w #1 \@@_eval_end: ; - \exp_stop_f: - } -\cs_new:Npn \@@_sign:Nw #1#2 ; - { - \if_meaning:w 0 #1 - 0 - \else: - \if_meaning:w - #1 - \fi: 1 - \fi: - } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3msg}} % % \begin{macrocode} @@ -1701,19 +1263,6 @@ % % \subsection{Additions to \pkg{l3prg}} % -% \begin{macro}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn} -% A merger between \cs{tl_const:Nn} and \cs{bool_set:Nn}. -% \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } -\cs_new_protected:Npn \bool_const:Nn #1#2 - { - \__kernel_chk_if_free_cs:N #1 - \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} - } -\cs_generate_variant:Nn \bool_const:Nn { c } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[added = 2018-05-10] % {\bool_set_inverse:N, \bool_set_inverse:c, \bool_gset_inverse:N, \bool_gset_inverse:c} % Set to \texttt{false} or \texttt{true} locally or globally. @@ -1888,85 +1437,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\seq_const_from_clist:Nn, \seq_const_from_clist:cn} -% Almost identical to \cs{seq_set_from_clist:Nn}. -% \begin{macrocode} -\cs_new_protected:Npn \seq_const_from_clist:Nn #1#2 - { - \tl_const:Nx #1 - { \s_@@ \clist_map_function:nN {#2} \@@_wrap_item:n } - } -\cs_generate_variant:Nn \seq_const_from_clist:Nn { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\seq_shuffle:N, \seq_gshuffle:N, \@@_shuffle:NN, \@@_shuffle_item:n} -% \begin{variable}{\g_@@_internal_seq, \l_@@_internal_a_int, \l_@@_internal_b_int} -% We apply the Fisher–Yates shuffle, storing items in \tn{toks} -% registers. We use the primitive \cs{tex_uniformdeviate:D} for -% speed reasons. Its non-uniformity is of order its argument divided -% by $2^{28}$, not too bad for small lists. For sequences with more -% than $13$ elements there are more possible permutations than -% possible seeds ($13!>2^{28}$) so the question of uniformity is -% somewhat moot. -% \begin{macrocode} -\cs_if_exist:NTF \tex_uniformdeviate:D - { - \int_new:N \l_@@_internal_a_int - \int_new:N \l_@@_internal_b_int - \seq_new:N \g_@@_internal_seq - \cs_new_protected:Npn \seq_shuffle:N { \@@_shuffle:NN \seq_set_eq:NN } - \cs_new_protected:Npn \seq_gshuffle:N { \@@_shuffle:NN \seq_gset_eq:NN } - \cs_new_protected:Npn \@@_shuffle:NN #1#2 - { - \int_compare:nNnTF { \seq_count:N #2 } > \c_max_register_int - { - \__kernel_msg_error:nnx { kernel } { shuffle-too-large } - { \token_to_str:N #2 } - } - { - \group_begin: - \cs_set_eq:NN \@@_item:n \@@_shuffle_item:n - \int_zero:N \l_@@_internal_a_int - #2 - \seq_gset_from_inline_x:Nnn \g_@@_internal_seq - { \int_step_function:nN { \l_@@_internal_a_int } } - { \tex_the:D \tex_toks:D ##1 } - \group_end: - #1 #2 \g_@@_internal_seq - \seq_gclear:N \g_@@_internal_seq - } - } - \cs_new_protected:Npn \@@_shuffle_item:n - { - \int_incr:N \l_@@_internal_a_int - \int_set:Nn \l_@@_internal_b_int - { 1 + \tex_uniformdeviate:D \l_@@_internal_a_int } - \tex_toks:D \l_@@_internal_a_int - = \tex_toks:D \l_@@_internal_b_int - \tex_toks:D \l_@@_internal_b_int - } - \__kernel_msg_new:nnnn { kernel } { shuffle-too-large } - { The~sequence~#1~is~too~long~to~be~shuffled~by~TeX. } - { - TeX~has~ \int_eval:n { \c_max_register_int + 1 } ~ - toks~registers:~this~only~allows~to~shuffle~up~to~ - \int_use:N \c_max_register_int \ items.~ - The~list~will~not~be~shuffled. - } - } - { - \cs_new_protected:Npn \seq_shuffle:N #1 - { - \__kernel_msg_error:nnn { kernel } { fp-no-random } - { \seq_shuffle:N #1 } - } - \cs_new_eq:NN \seq_gshuffle:N \seq_shuffle:N - } -% \end{macrocode} -% \end{variable} -% \end{macro} -% % \begin{macro} % { % \seq_indexed_map_function:NN, \seq_indexed_map_inline:Nn, @@ -2011,42 +1481,6 @@ % \end{macrocode} % \end{macro} % -% \subsection{Additions to \pkg{l3skip}} -% -% \begin{macrocode} -%<@@=dim> -% \end{macrocode} -% -% \begin{macro}[EXP]{\dim_sign:n, \@@_sign:Nw} -% See \cs{dim_abs:n}. Contrarily to \cs{int_sign:n} the case of a -% zero dimension cannot be distinguished from a positive dimension by -% looking only at the first character, since |0.2pt| and |0pt| start -% the same way. We need explicit comparisons. We start by -% distinguishing the most common case of a positive dimension. -% \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_sign:n } } -\cs_new:Npn \dim_sign:n #1 - { - \int_value:w \exp_after:wN \@@_sign:Nw - \dim_use:N \@@_eval:w #1 \@@_eval_end: ; - \exp_stop_f: - } -\cs_new:Npn \@@_sign:Nw #1#2 ; - { - \if_dim:w #1#2 > \c_zero_dim - 1 - \else: - \if_meaning:w - #1 - -1 - \else: - 0 - \fi: - \fi: - } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3sys}} % % \begin{macrocode} @@ -2073,6 +1507,7 @@ { p \int_use:N \tex_ptexversion:D + . \int_use:N \tex_ptexminorversion:D \tex_ptexrevision:D - @@ -2091,6 +1526,7 @@ { p \int_use:N \tex_ptexversion:D + . \int_use:N \tex_ptexminorversion:D \tex_ptexrevision:D - @@ -2111,327 +1547,9 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}[EXP]{\sys_rand_seed:} -% Unpack the primitive. When random numbers are not available, we -% return zero after an error (and incidentally make sure the number of -% expansions needed is the same as with random numbers available). -% \begin{macrocode} -\sys_if_rand_exist:TF - { \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D } } - { - \cs_new:Npn \sys_rand_seed: - { - \int_value:w - \__kernel_msg_expandable_error:nnn { kernel } { fp-no-random } - { \sys_rand_seed: } - \c_zero_int - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sys_gset_rand_seed:n} -% The primitive always assigns the seed globally. -% \begin{macrocode} -\sys_if_rand_exist:TF - { - \cs_new_protected:Npn \sys_gset_rand_seed:n #1 - { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: } - } - { - \cs_new_protected:Npn \sys_gset_rand_seed:n #1 - { - \__kernel_msg_error:nnn { kernel } { fp-no-random } - { \sys_gset_rand_seed:n {#1} } - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{variable}{\c_sys_shell_escape_int} -% Expose the engine's shell escape status to the user. -% \begin{macrocode} -\int_const:Nn \c_sys_shell_escape_int - { - \sys_if_engine_luatex:TF - { - \tex_directlua:D - { tex.sprint(status.shell_escape~or~os.execute()) } - } - { - \tex_shellescape:D - } - } -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_@@_internal_tl} -% \begin{macrocode} -\tl_new:N \l_@@_internal_tl -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\c_@@_marker_tl} -% The same idea as the marker for rescanning token lists. -% \begin{macrocode} -\tl_const:Nx \c_@@_marker_tl { : \token_to_str:N : } -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[TF]{\sys_shell_get:nnN} -% \begin{macro}{\sys_shell_get:nnN,\@@_get:nnN,\@@_get_do:Nw} -% Setting using a shell is at this level just a slightly specialised file -% operation, with an additional check for quotes, as these are not supported. -% \begin{macrocode} -\cs_new_protected:Npn \sys_shell_get:nnN #1#2#3 - { - \sys_shell_get:nnNF {#1} {#2} #3 - { \tl_set:Nn #3 { \q_no_value } } - } -\prg_new_protected_conditional:Npnn \sys_shell_get:nnN #1#2#3 { T , F , TF } - { - \sys_if_shell:TF - { \exp_args:No \@@_get:nnN { \tl_to_str:n {#1} } {#2} #3 } - { \prg_return_false: } - } -\cs_new_protected:Npn \@@_get:nnN #1#2#3 - { - \tl_if_in:nnTF {#1} { " } - { - \__kernel_msg_error:nnx - { kernel } { quote-in-shell } {#1} - \prg_return_false: - } - { - \group_begin: - \if_false: { \fi: - \int_set_eq:NN \tex_tracingnesting:D \c_zero_int - \exp_args:No \tex_everyeof:D { \c_@@_marker_tl } - #2 \scan_stop: - \exp_after:wN \@@_get_do:Nw - \exp_after:wN #3 - \exp_after:wN \prg_do_nothing: - \tex_input:D | "#1" \scan_stop: - \if_false: } \fi: - \prg_return_true: - } - } -\exp_args:Nno \use:nn - { \cs_new_protected:Npn \@@_get_do:Nw #1#2 } - { \c_@@_marker_tl } - { - \group_end: - \tl_set:No #1 {#2} - } -\__kernel_msg_new:nnnn { kernel } { quote-in-shell } - { Quotes~in~shell~command~'#1'. } - { Shell~commands~cannot~contain~quotes~("). } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{variable}{\c_sys_platform_str} -% Detecting the platform on \LuaTeX{} is easy: for other engines, we use -% the fact that the two common cases have special null files. It is possible -% to probe further (see package \pkg{platform}), but that requires shell -% escape and seems unlikely to be useful. -% \begin{macrocode} -\sys_if_engine_luatex:TF - { - \str_const:Nx \c_sys_platform_str - { \lua_now:n { tex.print(os.type) } } - } - { - \file_if_exist:nTF { nul: } - { - \file_if_exist:nF { /dev/null } - { \str_const:Nn \c_sys_platform_str { windows } } - } - { - \file_if_exist:nT { /dev/null } - { \str_const:Nn \c_sys_platform_str { unix } } - } - } -\cs_if_exist:NF \c_sys_platform_str - { \str_const:Nn \c_sys_platform_str { unknown } } -% \end{macrocode} -% \end{variable} -% \begin{macro}[pTF]{\sys_if_platform_unix:} -% \begin{macro}[pTF]{\sys_if_platform_windows:} -% We can now set up the tests. -% \begin{macrocode} -\clist_map_inline:nn { unix , windows } - { - \@@_const:nn { sys_if_platform_ #1 } - { \str_if_eq_p:Vn \c_sys_platform_str { #1 } } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[EXP, pTF]{\sys_if_shell:, \sys_if_shell_unrestricted:, \sys_if_shell_restricted:} -% Performs a check for whether shell escape is enabled. The first set -% of functions returns true if either of restricted or unrestricted -% shell escape is enabled, while the other two sets of functions -% return true in only one of these two cases. -% \begin{macrocode} -\@@_const:nn { sys_if_shell } - { \int_compare_p:nNn \c_sys_shell_escape_int > 0 } -\@@_const:nn { sys_if_shell_unrestricted } - { \int_compare_p:nNn \c_sys_shell_escape_int = 1 } -\@@_const:nn { sys_if_shell_restricted } - { \int_compare_p:nNn \c_sys_shell_escape_int = 2 } -% \end{macrocode} -% \end{macro} -% -% \begin{variable}{\c_@@_shell_stream_int} -% This is not needed for \LuaTeX{}: shell escape there isn't done using -% a \TeX{} interface. -% \begin{macrocode} -\sys_if_engine_luatex:F - { \int_const:Nn \c_@@_shell_stream_int { 18 } } -% \end{macrocode} -% \end{variable} -% -% \begin{macro}{\sys_shell_now:n} -% Execute commands through shell escape immediately. -% \begin{macrocode} -\sys_if_engine_luatex:TF - { - \cs_new_protected:Npn \sys_shell_now:n #1 - { - \lua_now:e - { os.execute(" \lua_escape:e { \tl_to_str:n {#1} } ") } - } - } - { - \cs_new_protected:Npn \sys_shell_now:n #1 - { \iow_now:Nn \c_@@_shell_stream_int {#1} } - } -\cs_generate_variant:Nn \sys_shell_now:n { x } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sys_shell_shipout:n} -% Execute commands through shell escape at shipout. -% \begin{macrocode} -\sys_if_engine_luatex:TF - { - \cs_new_protected:Npn \sys_shell_shipout:n #1 - { - \lua_shipout_e:n - { os.execute(" \lua_escape:e { \tl_to_str:n {#1} } ") } - } - } - { - \cs_new_protected:Npn \sys_shell_shipout:n #1 - { \iow_shipout:Nn \c_@@_shell_stream_int {#1} } - } -\cs_generate_variant:Nn \sys_shell_shipout:n { x } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3file}} % % \begin{macrocode} -%<@@=file> -% \end{macrocode} -% -% \begin{macro}[EXP]{\@@_str_cmp:nn} -% \begin{macro}[EXP]{\@@_str_escape:n} -% As we are doing a fixed-length \enquote{big} integer comparison, it -% is easiest to use the low-level behavior of string comparisons. -% \begin{macrocode} -\cs_new:Npn \@@_str_cmp:nn #1#2 { \tex_strcmp:D {#1} {#2} } -\sys_if_engine_luatex:T - { - \cs_set:Npn \@@_str_cmp:nn #1#2 - { - \lua_now:e - { - l3kernel.strcmp - ( - " \@@_str_escape:n {#1}", - " \@@_str_escape:n {#2}" - ) - } - } - \cs_new:Npn \@@_str_escape:n #1 - { - \lua_escape:e - { \__kernel_tl_to_str:w \use:e { {#1} } } - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{variable}{\l_@@_first_tl, \l_@@_second_tl} -% \begin{macrocode} -\tl_new:N \l_@@_first_tl -\tl_new:N \l_@@_second_tl -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[TF]{\file_compare_timestamp:nNn} -% \begin{macro}[EXP]{\@@_timestamp:n} -% Comparison of file date can be done by using the low-level nature of the -% string comparison functions. This could be expandable but that would -% skip any file look-up: to stay consistent we retain that at the cost of -% expansion. -% \begin{macrocode} -\prg_new_protected_conditional:Npnn \file_compare_timestamp:nNn #1#2#3 - { T , F , TF } - { - \group_begin: - \file_get_full_name:nNTF {#1} \l_@@_first_tl - { - \file_get_full_name:nNTF {#3} \l_@@_second_tl - { - \if_int_compare:w - \@@_str_cmp:nn - { \@@_timestamp:n \exp_after:wN { \l_@@_first_tl } } - { \@@_timestamp:n \exp_after:wN { \l_@@_second_tl } } - #2 0 \exp_stop_f: - \group_end: - \prg_return_true: - \else: - \group_end: - \prg_return_false: - \fi: - } - { - \group_end: - \if_charcode:w #2 > - \prg_return_true: - \else: - \prg_return_false: - \fi: - } - } - { - \group_end: - \if_charcode:w #2 < - \prg_return_true: - \else: - \prg_return_false: - \fi: - } - } -\sys_if_engine_luatex:TF - { - \cs_new:Npn \@@_timestamp:n #1 - { - \lua_now:e - { l3kernel.filemoddate ( " \lua_escape:e {#1} " ) } - } - } - { \cs_new_eq:NN \@@_timestamp:n \tex_filemoddate:D } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macrocode} %<@@=ior> % \end{macrocode} % @@ -2760,14 +1878,6 @@ %<@@=tl> % \end{macrocode} % -% \begin{macro}[EXP, documented-as=\tl_if_head_eq_catcode:nNTF] -% {\tl_if_head_eq_catcode:oNTF} -% Extra variants. -% \begin{macrocode} -\cs_generate_variant:Nn \tl_if_head_eq_catcode:nNTF { o } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[EXP]{\tl_lower_case:n, \tl_upper_case:n, \tl_mixed_case:n} % \begin{macro}[EXP]{\tl_lower_case:nn, \tl_upper_case:nn, \tl_mixed_case:nn} % The user level functions here are all wrappers around the internal @@ -4112,10 +3222,8 @@ % definition does not seem useful so we just do |#3| |#1| |{}| to % clear it locally or globally as appropriate. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_build_begin:N #1 { \@@_build_begin:NN \cs_set_nopar:Npx #1 } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_build_gbegin:N #1 { \@@_build_begin:NN \cs_gset_nopar:Npx #1 } \cs_new_protected:Npn \@@_build_begin:NN #1#2 @@ -4170,25 +3278,21 @@ % implies that the assignment does not simply set the token list to an % |x|-expansion of the second argument. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_build_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 #2 } } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_build_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 } #2 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_build_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 #2 } } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_build_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 @@ -4227,11 +3331,9 @@ % add the \meta{right} material after the \Arg{left} in the % |x|-expanding assignment. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_build_put_left:Nn #1 { \@@_build_put_left:NNn \cs_set_nopar:Npx #1 } \cs_generate_variant:Nn \tl_build_put_left:Nn { Nx } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_build_gput_left:Nn #1 { \@@_build_put_left:NNn \cs_gset_nopar:Npx #1 } \cs_generate_variant:Nn \tl_build_gput_left:Nn { Nx } diff --git a/macros/latex/contrib/l3kernel/l3clist.dtx b/macros/latex/contrib/l3kernel/l3clist.dtx index f2664fa77f..3b3b8041ab 100644 --- a/macros/latex/contrib/l3kernel/l3clist.dtx +++ b/macros/latex/contrib/l3kernel/l3clist.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3coffins.dtx b/macros/latex/contrib/l3kernel/l3coffins.dtx index 6c084d19d9..92ee217586 100644 --- a/macros/latex/contrib/l3kernel/l3coffins.dtx +++ b/macros/latex/contrib/l3kernel/l3coffins.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3color-base.dtx b/macros/latex/contrib/l3kernel/l3color-base.dtx index 93dae47797..3b58b7e280 100644 --- a/macros/latex/contrib/l3kernel/l3color-base.dtx +++ b/macros/latex/contrib/l3kernel/l3color-base.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3debug.dtx b/macros/latex/contrib/l3kernel/l3debug.dtx new file mode 100644 index 0000000000..55b16ec0e2 --- /dev/null +++ b/macros/latex/contrib/l3kernel/l3debug.dtx @@ -0,0 +1,1447 @@ +% \iffalse meta-comment +% +%% File: l3debug.dtx +% +% Copyright (C) 2019 The LaTeX3 Project +% +% It may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in the file +% +% https://www.latex-project.org/lppl.txt +% +% This file is part of the "l3kernel bundle" (The Work in LPPL) +% and all files in that bundle must be distributed together. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/latex3 +% +% for those people who are interested. +% +%<*driver> +\documentclass[full,kernel]{l3doc} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \title{^^A +% The \textsf{l3debug} package\\ Debugging support^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released 2019-09-28} +% +% \maketitle +% +% \begin{documentation} +% +% \begin{function}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N} +% \begin{syntax} +% \cs{__kernel_chk_var_local:N} \meta{var} +% \cs{__kernel_chk_var_global:N} \meta{var} +% \end{syntax} +% Applies \cs{__kernel_chk_var_exist:N} \meta{var} as well as +% \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var}, where +% \meta{scope} is |l| or~|g|. +% \end{function} +% +% \begin{function}{\__kernel_chk_var_scope:NN} +% \begin{syntax} +% \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var} +% \end{syntax} +% Checks the \meta{var} has the correct \meta{scope}, and if not +% raises a kernel-level error. This function is only created if +% debugging is enabled. The \meta{scope} is a single letter |l|, |g|, +% |c| denoting local variables, global variables, or constants. More +% precisely, if the variable name starts with a letter and an +% underscore (normal \pkg{expl3} convention) the function checks that +% this single letter matches the \meta{scope}. Otherwise the function +% cannot know the scope \meta{var} the first time: instead, it defines +% |\__debug_chk_/|\meta{var name} to store that information for the +% next call. Thus, if a given \meta{var} is subject to assignments of +% different scopes a kernel error will result. +% \end{function} +% +% \begin{function} +% { +% \__kernel_chk_cs_exist:N, +% \__kernel_chk_cs_exist:c, +% \__kernel_chk_var_exist:N +% } +% \begin{syntax} +% \cs{__kernel_chk_cs_exist:N} \meta{cs} +% \cs{__kernel_chk_var_exist:N} \meta{var} +% \end{syntax} +% These functions are only created if debugging is enabled. They +% check that their argument is defined according to the criteria for +% \cs{cs_if_exist_p:N}, +% and if not raises a kernel-level error. Error messages are +% different. +% \end{function} +% +% \begin{function}[EXP]{\__kernel_chk_flag_exist:n} +% \begin{syntax} +% \cs{__kernel_chk_flag_exist:n} \Arg{flag} +% \end{syntax} +% This function is only created if debugging is enabled. It checks +% that the \meta{flag} is defined according to the criterion for +% \cs{flag_if_exist_p:n}, and if not raises a kernel-level error. +% \end{function} +% +% \begin{function}{\__kernel_debug_log:x} +% \begin{syntax} +% \cs{__kernel_debug_log:x} \Arg{message text} +% \end{syntax} +% If the \texttt{log-functions} option is active, this function writes +% the \meta{message text} to the log file using \cs{iow_log:x}. +% Otherwise, the \meta{message text} is ignored using \cs{use_none:n}. +% This function is only created if debugging is enabled. +% \end{function} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3debug} Implementation} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=debug> +% \end{macrocode} +% +% Standard file identification. +% \begin{macrocode} +\ProvidesExplFile{l3debug.def}{2019-04-06}{}{L3 Debugging support} +% \end{macrocode} +% +% \begin{macro}{\debug_on:n, \debug_off:n, \@@_all_on:, \@@_all_off:} +% \begin{macrocode} +\cs_set_protected:Npn \debug_on:n #1 + { + \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} } + { + \cs_if_exist_use:cF { @@_ ##1 _on: } + { \__kernel_msg_error:nnn { kernel } { debug } {##1} } + } + } +\cs_set_protected:Npn \debug_off:n #1 + { + \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} } + { + \cs_if_exist_use:cF { @@_ ##1 _off: } + { \__kernel_msg_error:nnn { kernel } { debug } {##1} } + } + } +\cs_new_protected:Npn \@@_all_on: + { + \debug_on:n + { + check-declarations , + check-expressions , + deprecation , + log-functions , + } + } +\cs_new_protected:Npn \@@_all_off: + { + \debug_off:n + { + check-declarations , + check-expressions , + deprecation , + log-functions , + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\debug_suspend:, \debug_resume:} +% \begin{macro}{\@@_suspended:T} +% \begin{macro}{\l_@@_suspended_tl} +% Suspend and resume locally all debug-related errors and logging +% except deprecation errors. The \cs{debug_suspend:} and \cs{debug_resume:} +% pairs can be nested. We keep track of nesting in a token list +% containing a number of periods. At first begin with the +% \enquote{non-suspended} version of \cs{@@_suspended:T}. +% \begin{macrocode} +\tl_new:N \l_@@_suspended_tl { } +\cs_set_protected:Npn \debug_suspend: + { + \tl_put_right:Nn \l_@@_suspended_tl { . } + \cs_set_eq:NN \@@_suspended:T \use:n + } +\cs_set_protected:Npn \debug_resume: + { + \tl_set:Nx \l_@@_suspended_tl + { \tl_tail:N \l_@@_suspended_tl } + \tl_if_empty:NT \l_@@_suspended_tl + { + \cs_set_eq:NN \@@_suspended:T \use_none:n + } + } +\cs_new_eq:NN \@@_suspended:T \use_none:n +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro} +% {\@@_check-declarations_on:, \@@_check-declarations_off:} +% \begin{macro} +% { +% \__kernel_chk_var_exist:N, +% \__kernel_chk_cs_exist:N, +% \__kernel_chk_cs_exist:c +% } +% \begin{macro}[EXP]{\__kernel_chk_flag_exist:n} +% \begin{macro}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N} +% \begin{macro}{\__kernel_chk_var_scope:NN} +% When debugging is enabled these two functions set up functions that +% test their argument (when \texttt{check-declarations} is active) +% \begin{itemize} +% \item \cs{__kernel_chk_var_exist:N} and \cs{__kernel_chk_cs_exist:N}, two +% functions that test that their argument is defined; +% \item \cs{__kernel_chk_var_scope:NN} that checks that its argument |#2| +% has scope |#1|. +% \item \cs{__kernel_chk_var_local:N} and \cs{__kernel_chk_var_global:N} that +% perform both checks. +% \end{itemize} +% \begin{macrocode} +\cs_new_protected:Npn \__kernel_chk_var_exist:N #1 { } +\cs_new_protected:Npn \__kernel_chk_cs_exist:N #1 { } +\cs_generate_variant:Nn \__kernel_chk_cs_exist:N { c } +\cs_new:Npn \__kernel_chk_flag_exist:n #1 { } +\cs_new_protected:Npn \__kernel_chk_var_local:N #1 { } +\cs_new_protected:Npn \__kernel_chk_var_global:N #1 { } +\cs_new_protected:Npn \__kernel_chk_var_scope:NN #1#2 { } +\cs_new_protected:cpn { @@_check-declarations_on: } + { + \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 + { + \@@_suspended:T \use_none:nnn + \cs_if_exist:NF ##1 + { + \__kernel_msg_error:nnx { kernel } { non-declared-variable } + { \token_to_str:N ##1 } + } + } + \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 + { + \@@_suspended:T \use_none:nnn + \cs_if_exist:NF ##1 + { + \__kernel_msg_error:nnx { kernel } { command-not-defined } + { \token_to_str:N ##1 } + } + } + \cs_set:Npn \__kernel_chk_flag_exist:n ##1 + { + \@@_suspended:T \use_none:nnn + \flag_if_exist:nF {##1} + { + \__kernel_msg_expandable_error:nnn + { kernel } { bad-variable } { flag~##1~ } + } + } + \cs_set_protected:Npn \__kernel_chk_var_scope:NN + { + \@@_suspended:T \use_none:nnn + \@@_chk_var_scope_aux:NN + } + \cs_set_protected:Npn \__kernel_chk_var_local:N ##1 + { + \@@_suspended:T \use_none:nnnnn + \__kernel_chk_var_exist:N ##1 + \@@_chk_var_scope_aux:NN l ##1 + } + \cs_set_protected:Npn \__kernel_chk_var_global:N ##1 + { + \@@_suspended:T \use_none:nnnnn + \__kernel_chk_var_exist:N ##1 + \@@_chk_var_scope_aux:NN g ##1 + } + } +\cs_new_protected:cpn { @@_check-declarations_off: } + { + \cs_set_protected:Npn \__kernel_chk_var_exist:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_cs_exist:N ##1 { } + \cs_set:Npn \__kernel_chk_flag_exist:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_var_local:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_var_global:N ##1 { } + \cs_set_protected:Npn \__kernel_chk_var_scope:NN ##1##2 { } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_chk_var_scope_aux:NN} +% \begin{macro}{\@@_chk_var_scope_aux:Nn} +% \begin{macro}{\@@_chk_var_scope_aux:NNn} +% First check whether the name of the variable |#2| starts with +% \meta{letter}|_|. If it does then pass that letter, the +% \meta{scope}, and the variable name to +% \cs{@@_chk_var_scope_aux:NNn}. That function compares the two +% letters and triggers an error if they differ (the \cs{scan_stop:} +% case is not reachable here). If the second character was not |_| +% then pass the same data to the same auxiliary, except for its first +% argument which is now a control sequence. That control sequence is +% actually a token list (but to avoid triggering the checking code we +% manipulate it using \cs{cs_set_nopar:Npn}) containing a single +% letter \meta{scope} according to what the first assignment to the +% given variable was. +% \begin{macrocode} +\cs_new_protected:Npn \@@_chk_var_scope_aux:NN #1#2 + { \exp_args:NNf \@@_chk_var_scope_aux:Nn #1 { \cs_to_str:N #2 } } +\cs_new_protected:Npn \@@_chk_var_scope_aux:Nn #1#2 + { + \if:w _ \use_i:nn \use_i_delimit_by_q_stop:nw #2 ? ? \q_stop + \exp_after:wN \@@_chk_var_scope_aux:NNn + \use_i_delimit_by_q_stop:nw #2 ? \q_stop + #1 {#2} + \else: + \exp_args:Nc \@@_chk_var_scope_aux:NNn + { @@_chk_/ #2 } + #1 {#2} + \fi: + } +\cs_new_protected:Npn \@@_chk_var_scope_aux:NNn #1#2#3 + { + \if:w #1 #2 + \else: + \if:w #1 \scan_stop: + \cs_gset_nopar:Npn #1 {#2} + \else: + \__kernel_msg_error:nnxxx { kernel } { local-global } + {#1} {#2} { \iow_char:N \\ #3 } + \fi: + \fi: + } +\use:c { @@_check-declarations_off: } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_log-functions_on:, \@@_log-functions_off:} +% \begin{macro}{\__kernel_debug_log:x} +% These two functions (corresponding to the \pkg{expl3} option +% \texttt{log-functions}) control whether \cs{__kernel_debug_log:x} +% writes to the log file or not. By default, logging is off. +% \begin{macrocode} +\cs_new_protected:cpn { @@_log-functions_on: } + { + \cs_set_protected:Npn \__kernel_debug_log:x + { \@@_suspended:T \use_none:nn \iow_log:x } + } +\cs_new_protected:cpn { @@_log-functions_off: } + { \cs_set_protected:Npn \__kernel_debug_log:x { \use_none:n } } +\cs_new_protected:Npn \__kernel_debug_log:x { \use_none:n } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro} +% {\@@_check-expressions_on:, \@@_check-expressions_off:} +% \begin{macro}{\__kernel_chk_expr:nNnN} +% \begin{macro}{\@@_chk_expr_aux:nNnN} +% When debugging is enabled these two functions set +% \cs{__kernel_chk_expr:nNnN} to test or not whether the given +% expression is valid. The idea is to evaluate the expression within +% a brace group (to catch trailing \cs{use_none:nn} or similar), then +% test that the result is what we expect. This is done by turning it +% to an integer and hitting that with \cs{tex_romannumeral:D} after +% replacing the first character by |-0|. If all goes well, that +% primitive finds a non-positive integer and gives an empty output. +% If the original expression evaluation stopped early it leaves a +% trailing \cs{tex_relax:D}, which stops the second evaluation (used +% to convert to integer) before it encounters the final +% \cs{tex_relax:D}. Since \cs{tex_romannumeral:D} does not absorb +% \cs{tex_relax:D} the output will be nonempty. Note that |#3| is +% empty except for mu expressions for which it is \cs{tex_mutoglue:D} +% to avoid an \enquote{incompatible glue units} error. Note also that +% if we had omitted the first \cs{tex_relax:D} then for instance +% |1+2\relax+3| would incorrectly be accepted as a valid integer +% expression. +% \begin{macrocode} +\cs_new_protected:cpn { @@_check-expressions_on: } + { + \cs_set:Npn \__kernel_chk_expr:nNnN ##1##2 + { + \@@_suspended:T { ##1 \use_none:nnnnnnn } + \exp_after:wN \@@_chk_expr_aux:nNnN + \exp_after:wN { \tex_the:D ##2 ##1 \scan_stop: } + ##2 + } + } +\cs_new_protected:cpn { @@_check-expressions_off: } + { \cs_set:Npn \__kernel_chk_expr:nNnN ##1##2##3##4 {##1} } +\cs_new:Npn \__kernel_chk_expr:nNnN #1#2#3#4 {#1} +\cs_new:Npn \@@_chk_expr_aux:nNnN #1#2#3#4 + { + \tl_if_empty:oF + { + \tex_romannumeral:D - 0 + \exp_after:wN \use_none:n + \int_value:w #3 #2 #1 \scan_stop: + } + { + \__kernel_msg_expandable_error:nnnn + { kernel } { expr } {#4} {#1} + } + #1 + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_deprecation_on:, \@@_deprecation_off:} +% Some commands were more recently deprecated and not yet removed; +% only make these into errors if the user requests it. This relies on +% two token lists, filled up in \pkg{l3deprecation} by calls to +% \cs{__kernel_deprecation_code:nn}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_deprecation_on: + { \g_@@_deprecation_on_tl } +\cs_new_protected:Npn \@@_deprecation_off: + { \g_@@_deprecation_off_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{ +% \l_@@_internal_tl, +% \l_@@_tmpa_tl, +% \l_@@_tmpb_tl, +% } +% For patching. +% \begin{macrocode} +\tl_new:N \l_@@_internal_tl +\tl_new:N \l_@@_tmpa_tl +\tl_new:N \l_@@_tmpb_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{ +% \@@_generate_parameter_list:NNN, +% \@@_build_parm_text:n, +% \@@_build_arg_list:n, +% \@@_arg_list_from_signature:nNN, +% \@@_arg_check_invalid:N, +% \@@_parm_terminate:w, +% \@@_arg_if_braced:n, +% \@@_get_base_form:N, +% \@@_arg_return:N, +% } +% \begin{macro}[TF]{\@@_arg_if_braced:N} +% Some functions don't take the arguments their signature indicates. +% For instance, \cs{clist_concat:NNN} doesn't take (directly) any +% argument, so patching it with something that uses |#1|, |#2|, or +% |#3| results in ``Illegal parameter number in definition of +% \cs{clist_concat:NNN}''. +% +% Instead of changing \emph{the} definition of the macros, we'll +% create a copy of such macros, say, |__debug_clist_concat:NNN| which +% will be defined as +% |<debug code with #1, #2 and #3>\clist_concat:NNN#1#2#3|. For that +% we need to identify the signature of every function and build the +% appropriate parameter list. +% +% \cs{@@_generate_parameter_list:NNN} takes a function in |#1| and +% returns teo parameter lists: |#2| contains the simple |#1#2#3| as +% would be used in the \meta{parameter~text} of the definition and +% |#3| contains the same parameters but with braces where necessary. +% +% With the current implementation the resulting |#3| is, for example +% for |\some_function:NnNn|, |#1{#2}#3{#4}|. While this is correct, +% it might be unnecessary. Bracing everything will usually have the +% same outcome (unless the function was misused in the first place). +% What should be done? +% \begin{macrocode} +\cs_new_protected:Npn \@@_generate_parameter_list:NNN #1#2#3 + { + \tl_set:Nx \l_@@_internal_tl + { \exp_last_unbraced:Nf \use_ii:nnn \cs_split_function:N #1 } + \tl_set:Nx #2 + { \exp_args:NV \@@_build_parm_text:n \l_@@_internal_tl } + \tl_set:Nx #3 + { \exp_args:NV \@@_build_arg_list:n \l_@@_internal_tl } + } +\cs_new:Npn \@@_build_parm_text:n #1 + { + \@@_arg_list_from_signature:nNN { 1 } \c_false_bool #1 + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_build_arg_list:n #1 + { + \@@_arg_list_from_signature:nNN { 1 } \c_true_bool #1 + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_arg_list_from_signature:nNN #1 #2 #3 + { + \quark_if_recursion_tail_stop:N #3 + \@@_arg_check_invalid:N #3 + \bool_if:NT #2 { \@@_arg_if_braced:NT #3 { \use_none:n } } + \use:n { \c_hash_str \int_eval:n {#1} } + \exp_args:Nf \@@_arg_list_from_signature:nNN + { \int_eval:n {#1+1} } #2 + } +% \end{macrocode} +% Argument types |w|, |p|, |T|, and |F| shouldn't be included in the +% parameter lists, so we abort the loop if either is found. +% \begin{macrocode} +\cs_new:Npn \@@_arg_check_invalid:N #1 + { + \if:w w #1 \@@_parm_terminate:w \else: + \if:w p #1 \@@_parm_terminate:w \else: + \if:w T #1 \@@_parm_terminate:w \else: + \if:w F #1 \@@_parm_terminate:w \else: + \exp:w + \fi: + \fi: + \fi: + \fi: + \exp_end: + } +\cs_new:Npn \@@_parm_terminate:w + { \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \exp:w } +\prg_new_conditional:Npnn \@@_arg_if_braced:N #1 { T } + { \exp_args:Nf \@@_arg_if_braced:n { \@@_get_base_form:N #1 } } +\cs_new:Npn \@@_arg_if_braced:n #1 + { + \if:w n #1 \prg_return_true: \else: + \if:w N #1 \prg_return_false: \else: + \__kernel_msg_expandable_error:nnn + { kernel } { bad-arg-type } {#1} + \fi: + \fi: + } +\__kernel_msg_new:nnn { kernel } { bad-arg-type } + { Wrong~argument~type~#1. } +% \end{macrocode} +% The macro below is a modifiec copy of +% |\__cs_generate_variant_loop_base:N| to get the base form of an +% argument type given a variant. It serves only to differentiate +% arguments which should be braced from ones which shouldn't. If all +% were to be braced this would be unnecessary. I moved the |n| and |N| +% variants to the beginning of the test as the are much more common +% here. +% \begin{macrocode} +\cs_new:Npn \@@_get_base_form:N #1 + { + \if:w n #1 \@@_arg_return:N n \else: + \if:w N #1 \@@_arg_return:N N \else: + \if:w c #1 \@@_arg_return:N N \else: + \if:w o #1 \@@_arg_return:N n \else: + \if:w V #1 \@@_arg_return:N n \else: + \if:w v #1 \@@_arg_return:N n \else: + \if:w f #1 \@@_arg_return:N n \else: + \if:w e #1 \@@_arg_return:N n \else: + \if:w x #1 \@@_arg_return:N n \else: + \@@_arg_return:N \scan_stop: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \fi: + \exp_stop_f: + } +\cs_new:Npn \@@_arg_return:N #1 + { \exp_after:wN #1 \exp:w \exp_end_continue_f:w } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{ +% \__kernel_patch:nnn, +% \__kernel_patch_aux:nnn, +% \@@_setup_debug_code:Nnn, +% \@@_add_to_debug_code:Nnn, +% \@@_insert_debug_code:Nnn, +% \__kernel_patch_weird:nnn, +% \__kernel_patch_weird_aux:nnn, +% \@@_patch_weird:Nnn, +% } +% Simple patching by adding material at the start and end of (a +% collection of) functions is straight-forward as we know the catcode +% set up. The approach is essentially that in \pkg{etoolbox}. Notice +% the need to worry about spaces: those are otherwise lost as normally +% in \pkg{expl3} code they would be~|~|. +% +% As discussed above, some functions don't take arguments, so we can't +% patch something that uses an argument in them. For these functions +% \cs{__kernel_patch:nnn} is used. It starts by creating a copy of the +% function (say, \cs{clist_concat:NNN}) with a |__debug_| prefix in +% the name. This copy won't be changed. The code redefines the +% original function to take the exact same arguments as advertised in +% its signature (see \cs{@@_generate_parameter_list:NNN} above). +% The redefined function also contains the debug code in the proper +% position. If a function with the same name and the |__debug_| prefix +% was already defined, then the macro patches that definition by +% adding more debug code to it. +% \begin{macrocode} +\group_begin: + \cs_set_protected:Npn \__kernel_patch:nnn + { + \group_begin: + \char_set_catcode_other:N \# + \__kernel_patch_aux:nnn + } + \cs_set_protected:Npn \__kernel_patch_aux:nnn #1#2#3 + { + \char_set_catcode_parameter:N \# + \char_set_catcode_space:N \ % + \tex_endlinechar:D -1 \scan_stop: + \tl_map_inline:nn {#3} + { + \cs_if_exist:cTF { __debug_ \cs_to_str:N ##1 } + { \@@_add_to_debug_code:Nnn } + { \@@_setup_debug_code:Nnn } + ##1 {#1} {#2} + } + \group_end: + } + \cs_set_protected:Npn \@@_setup_debug_code:Nnn #1#2#3 + { + \cs_gset_eq:cN { __debug_ \cs_to_str:N #1 } #1 + \@@_generate_parameter_list:NNN #1 \l_@@_tmpa_tl \l_@@_tmpb_tl + \exp_args:Nx \tex_scantokens:D + { + \tex_global:D \cs_prefix_spec:N #1 + \tex_def:D \exp_not:N #1 + \tl_use:N \l_@@_tmpa_tl + { + \tl_to_str:n {#2} + \exp_not:c { __debug_ \cs_to_str:N #1 } + \tl_use:N \l_@@_tmpb_tl + \tl_to_str:n {#3} + } + } + } + \cs_set_protected:Npn \@@_add_to_debug_code:Nnn #1#2#3 + { + \use:x + { + \cs_set:Npn \exp_not:N \@@_tmp:w + ####1 \tl_to_str:n { macro: } + ####2 \tl_to_str:n { -> } + ####3 \c_backslash_str \tl_to_str:n { __debug_ } + \cs_to_str:N #1 + ####4 \exp_not:N \q_mark + { + \exp_not:N \exp_args:Nx \exp_not:N \tex_scantokens:D + { + \tex_global:D ####1 + \tex_def:D \exp_not:N #1 ####2 + { + ####3 \tl_to_str:n {#2} + \c_backslash_str __debug_ \cs_to_str:N #1 + ####4 \tl_to_str:n {#3} + } + } + } + } + \exp_after:wN \@@_tmp:w \cs_meaning:N #1 \q_mark + } +% \end{macrocode} +% Some functions, however, won't work with the signature reading setup +% above because their signature contains |w|eird arguments. These +% functions need to be patched using \cs{__kernel_patch_weird:nnn}, +% which won't make a copy of the function, rather it will patch the +% debug code directly into it. This means that whatever argument the +% debug code uses must be actually used by the patched function. +% \begin{macrocode} + \cs_set_protected:Npn \__kernel_patch_weird:nnn + { + \group_begin: + \char_set_catcode_other:N \# + \__kernel_patch_weird_aux:nnn + } + \cs_set_protected:Npn \__kernel_patch_weird_aux:nnn #1#2#3 + { + \char_set_catcode_parameter:N \# + \char_set_catcode_space:N \ % + \tex_endlinechar:D -1 \scan_stop: + \tl_map_inline:nn {#3} + { \@@_patch_weird:Nnn ##1 {#1} {#2} } + \group_end: + } + \cs_set_protected:Npn \@@_patch_weird:Nnn #1#2#3 + { + \use:x + { + \tex_endlinechar:D -1 \scan_stop: + \exp_not:N \tex_scantokens:D + { + \tex_global:D \cs_prefix_spec:N #1 + \tex_def:D \exp_not:N #1 + \cs_argument_spec:N #1 + { + \tl_to_str:n {#2} + \cs_replacement_spec:N #1 + \tl_to_str:n {#3} + } + } + } + } +% \end{macrocode} +% \end{macro} +% +% Patching the second argument to ensure it exists. This happens before +% we alter |#1| so the ordering is correct. For many variable types +% such as \texttt{int} a low-level error occurs when |#2| is unknown, so +% adding a check is not needed. +% \begin{macrocode} + \__kernel_patch:nnn + { \__kernel_chk_var_exist:N #2 } + { } + { + \bool_set_eq:NN + \bool_gset_eq:NN + \clist_set_eq:NN + \clist_gset_eq:NN + \fp_set_eq:NN + \fp_gset_eq:NN + \prop_set_eq:NN + \prop_gset_eq:NN + \seq_set_eq:NN + \seq_gset_eq:NN + \str_set_eq:NN + \str_gset_eq:NN + \tl_set_eq:NN + \tl_gset_eq:NN + } +% \end{macrocode} +% +% Patching both second and third arguments. +% \begin{macrocode} +% \tracingall + \__kernel_patch:nnn + { + \__kernel_chk_var_exist:N #2 + \__kernel_chk_var_exist:N #3 + } + { } + { + \clist_concat:NNN + \clist_gconcat:NNN + \seq_concat:NNN + \seq_gconcat:NNN + \str_concat:NNN + \str_gconcat:NNN + \tl_concat:NNN + \tl_gconcat:NNN + } +% \tracingnone +% \end{macrocode} +% +% Patching where the first argument to a function needs scope-checking: +% either local or global (so two lists). +% \begin{macrocode} + \__kernel_patch:nnn + { \__kernel_chk_var_local:N #1 } + { } + { + \bool_set:Nn + \bool_set_eq:NN + \bool_set_true:N + \bool_set_false:N + \box_set_eq:NN + \box_set_eq_drop:NN + \box_set_to_last:N + \clist_set_eq:NN + \dim_zero:N + \dim_set:Nn + \dim_set_eq:NN + \dim_add:Nn + \dim_sub:Nn + \fp_set_eq:NN + \int_zero:N + \int_set_eq:NN + \int_add:Nn + \int_sub:Nn + \int_incr:N + \int_decr:N + \int_set:Nn + \hbox_set:Nn + \hbox_set_to_wd:Nnn + \hbox_set:Nw + \hbox_set_to_wd:Nnw + \muskip_zero:N + \muskip_set:Nn + \muskip_add:Nn + \muskip_sub:Nn + \muskip_set_eq:NN + \seq_set_eq:NN + \skip_zero:N + \skip_set:Nn + \skip_set_eq:NN + \skip_add:Nn + \skip_sub:Nn + \tl_set:Nn + \tl_set:No + \tl_set:Nx + \tl_set_eq:NN + \tl_put_left:Nn + \tl_put_left:NV + \tl_put_left:No + \tl_put_left:Nx + \tl_put_right:Nn + \tl_put_right:NV + \tl_put_right:No + \tl_put_right:Nx + \tl_build_begin:N + \tl_build_put_right:Nn + \tl_build_put_right:Nx + \tl_build_put_left:Nn + \vbox_set:Nn + \vbox_set_top:Nn + \vbox_set_to_ht:Nnn + \vbox_set:Nw + \vbox_set_to_ht:Nnw + \vbox_set_split_to_ht:NNn + } + \__kernel_patch:nnn + { \__kernel_chk_var_global:N #1 } + { } + { + \bool_gset:Nn + \bool_gset_eq:NN + \bool_gset_true:N + \bool_gset_false:N + \box_gset_eq:NN + \box_gset_eq_drop:NN + \box_gset_to_last:N + \clist_gset_eq:NN + \dim_gset_eq:NN + \dim_gzero:N + \dim_gset:Nn + \dim_gadd:Nn + \dim_gsub:Nn + \fp_gset_eq:NN + \int_gzero:N + \int_gset_eq:NN + \int_gadd:Nn + \int_gsub:Nn + \int_gincr:N + \int_gdecr:N + \int_gset:Nn + \hbox_gset:Nn + \hbox_gset_to_wd:Nnn + \hbox_gset:Nw + \hbox_gset_to_wd:Nnw + \muskip_gzero:N + \muskip_gset:Nn + \muskip_gadd:Nn + \muskip_gsub:Nn + \muskip_gset_eq:NN + \seq_gset_eq:NN + \skip_gzero:N + \skip_gset:Nn + \skip_gset_eq:NN + \skip_gadd:Nn + \skip_gsub:Nn + \tl_gset:Nn + \tl_gset:No + \tl_gset:Nx + \tl_gset_eq:NN + \tl_gput_left:Nn + \tl_gput_left:NV + \tl_gput_left:No + \tl_gput_left:Nx + \tl_gput_right:Nn + \tl_gput_right:NV + \tl_gput_right:No + \tl_gput_right:Nx + \tl_build_gbegin:N + \tl_build_gput_right:Nn + \tl_build_gput_right:Nx + \tl_build_gput_left:Nn + \vbox_gset:Nn + \vbox_gset_top:Nn + \vbox_gset_to_ht:Nnn + \vbox_gset:Nw + \vbox_gset_to_ht:Nnw + \vbox_gset_split_to_ht:NNn + } +% \end{macrocode} +% +% Scoping for constants. +% \begin{macrocode} + \__kernel_patch:nnn + { \__kernel_chk_var_scope:NN c #1 } + { } + { + \bool_const:Nn + \dim_const:Nn + \int_const:Nn + \intarray_const_from_clist:Nn + \muskip_const:Nn + \skip_const:Nn + \tl_const:Nn + \tl_const:Nx + } +% \end{macrocode} +% +% Flag functions. +% \begin{macrocode} + \__kernel_patch:nnn + { \__kernel_chk_flag_exist:n {#1} } + { } + { + \flag_if_raised:nT + \flag_if_raised:nF + \flag_if_raised:nTF + \flag_if_raised_p:n + \flag_height:n + \flag_raise_if_clear:n + \flag_clear:n + } +% \end{macrocode} +% +% Various one-offs. +% \begin{macrocode} + \__kernel_patch:nnn + { \__kernel_chk_cs_exist:N #1 } + { } + { \cs_generate_variant:Nn } + \__kernel_patch:nnn + { \__kernel_chk_var_scope:NN g #1 } + { } + { \intarray_new:Nn } + \__kernel_patch:nnn + { \__kernel_chk_var_scope:NN q #1 } + { } + { \quark_new:N } + \__kernel_patch:nnn + { \__kernel_chk_var_scope:NN s #1 } + { } + { \scan_new:N } +% \end{macrocode} +% +% Patch various internal commands to log definitions of functions. +% First, a kernel internal. Then internals from the \pkg{cs}, +% \pkg{keys} and \pkg{msg} modules. +% \begin{macrocode} + \__kernel_patch:nnn + { } + { + \__kernel_debug_log:x + { Defining~\token_to_str:N #1~ \msg_line_context: } + } + { \__kernel_chk_if_free_cs:N } +%<@@=cs> + \__kernel_patch_weird:nnn + { + \cs_if_free:NF #4 + { + \__kernel_debug_log:x + { + Variant~\token_to_str:N #4~% + already~defined;~ not~ changing~ it~ \msg_line_context: + } + } + } + { } + { \@@_generate_variant:wwNN } +%<@@=keys> + \__kernel_patch:nnn + { + \cs_if_exist:cF { \c_@@_code_root_tl #1 } + { \__kernel_debug_log:x { Defining~key~#1~\msg_line_context: } } + } + { } + { \@@_cmd_set:nn } +%<@@=msg> + \__kernel_patch:nnn + { } + { + \__kernel_debug_log:x + { Defining~message~ #1 / #2 ~\msg_line_context: } + } + { \@@_chk_free:nn } +% \end{macrocode} +% +% \begin{macrocode} +%<@@=prg> +% \end{macrocode} +% Internal functions from \pkg{prg} module. +% \begin{macrocode} + \__kernel_patch_weird:nnn + { \__kernel_chk_cs_exist:c { #5 _p : #6 } } + { } + { \@@_set_eq_conditional_p_form:wNnnnn } + \__kernel_patch_weird:nnn + { \__kernel_chk_cs_exist:c { #5 : #6 TF } } + { } + { \@@_set_eq_conditional_TF_form:wNnnnn } + \__kernel_patch_weird:nnn + { \__kernel_chk_cs_exist:c { #5 : #6 T } } + { } + { \@@_set_eq_conditional_T_form:wNnnnn } + \__kernel_patch_weird:nnn + { \__kernel_chk_cs_exist:c { #5 : #6 F } } + { } + { \@@_set_eq_conditional_F_form:wNnnnn } +% \end{macrocode} +% +% \begin{macrocode} +%<@@=regex> +% \end{macrocode} +% Internal functions from \pkg{regex} module. +% \begin{macrocode} + \__kernel_patch:nnn + { + \@@_trace_push:nnN { regex } { 1 } \@@_escape_use:nnnn + \group_begin: + \tl_set:Nx \l_@@_internal_a_tl + { \@@_trace_pop:nnN { regex } { 1 } \@@_escape_use:nnnn } + \use_none:nnn + } + { } + { \@@_escape_use:nnn } + \__kernel_patch:nnn + { \@@_trace_push:nnN { regex } { 1 } \@@_build:N } + { + \@@_trace_states:n { 2 } + \@@_trace_pop:nnN { regex } { 1 } \@@_build:N + } + { \@@_build:N } + \__kernel_patch:nnn + { \@@_trace_push:nnN { regex } { 1 } \@@_build_for_cs:n } + { + \@@_trace_states:n { 2 } + \@@_trace_pop:nnN { regex } { 1 } \@@_build_for_cs:n + } + { \@@_build_for_cs:n } + \__kernel_patch:nnn + { + \@@_trace:nnx { regex } { 2 } + { + regex~new~state~ + L=\int_use:N \l_@@_left_state_int ~ -> ~ + R=\int_use:N \l_@@_right_state_int ~ -> ~ + M=\int_use:N \l_@@_max_state_int ~ -> ~ + \int_eval:n { \l_@@_max_state_int + 1 } + } + } + { } + { \@@_build_new_state: } + \__kernel_patch:nnn + { \@@_trace_push:nnN { regex } { 1 } \@@_group_aux:nnnnN } + { \@@_trace_pop:nnN { regex } { 1 } \@@_group_aux:nnnnN } + { \@@_group_aux:nnnnN } + \__kernel_patch:nnn + { \@@_trace_push:nnN { regex } { 1 } \@@_branch:n } + { \@@_trace_pop:nnN { regex } { 1 } \@@_branch:n } + { \@@_branch:n } + \__kernel_patch:nnn + { + \@@_trace_push:nnN { regex } { 1 } \@@_match:n + \@@_trace:nnx { regex } { 1 } { analyzing~query~token~list } + } + { \@@_trace_pop:nnN { regex } { 1 } \@@_match:n } + { \@@_match:n } + \__kernel_patch:nnn + { + \@@_trace_push:nnN { regex } { 1 } \@@_match_cs:n + \@@_trace:nnx { regex } { 1 } { analyzing~query~token~list } + } + { \@@_trace_pop:nnN { regex } { 1 } \@@_match_cs:n } + { \@@_match_cs:n } + \__kernel_patch:nnn + { \@@_trace:nnx { regex } { 1 } { initializing } } + { } + { \@@_match_init: } + \__kernel_patch:nnn + { + \@@_trace:nnx { regex } { 2 } + { state~\int_use:N \l_@@_curr_state_int } + } + { } + { \@@_use_state: } + \__kernel_patch:nnn + { \@@_trace_push:nnN { regex } { 1 } \@@_replacement:n } + { \@@_trace_pop:nnN { regex } { 1 } \@@_replacement:n } + { \@@_replacement:n } +% \end{macrocode} +% +% \begin{macrocode} +\group_end: +% \end{macrocode} +% +% \begin{macrocode} +%<@@=debug> +% \end{macrocode} +% +% Patching arguments is a bit more involved: we do these one at a time. +% The basic idea is the same, using a |#| token that is a string. +% \begin{macrocode} +\group_begin: + \cs_set_protected:Npn \__kernel_patch:Nn #1 + { + \group_begin: + \char_set_catcode_other:N \# + \__kernel_patch_aux:Nn #1 + } + \cs_set_protected:Npn \__kernel_patch_aux:Nn #1#2 + { + \char_set_catcode_parameter:N \# + \tex_endlinechar:D -1 \scan_stop: + \exp_args:Nx \tex_scantokens:D + { + \tex_global:D \cs_prefix_spec:N #1 \tex_def:D \exp_not:N #1 + \cs_argument_spec:N #1 + { \exp_args:No \tl_to_str:n { #1 #2 } } + } + \group_end: + } +% \end{macrocode} +% +% The functions here can get a bit repetitive, so we define a helper +% which can re-use the same patch code repeatedly. The main part of the +% patch is the same, so we just have to deal with the part which varies +% depending on the type of expression. +% \begin{macrocode} + \cs_set_protected:Npn \__kernel_patch_eval:nn #1#2 + { + \tl_map_inline:nn {#1} + { + \exp_args:NNx \__kernel_patch:Nn ##1 + { + { \c_hash_str 1 } + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 2 } + \exp_not:n {#2} + \exp_not:N ##1 + } + } + } + } +%<@@=dim> + \__kernel_patch_eval:nn + { + \dim_set:Nn + \dim_gset:Nn + \dim_add:Nn + \dim_gadd:Nn + \dim_sub:Nn + \dim_gsub:Nn + \dim_const:Nn + } + { \@@_eval:w { } } +%<@@=int> + \__kernel_patch_eval:nn + { + \int_set:Nn + \int_gset:Nn + \int_add:Nn + \int_gadd:Nn + \int_sub:Nn + \int_gsub:Nn + \int_const:Nn + } + { \@@_eval:w { } } + \__kernel_patch_eval:nn + { + \muskip_set:Nn + \muskip_gset:Nn + \muskip_add:Nn + \muskip_gadd:Nn + \muskip_sub:Nn + \muskip_gsub:Nn + \muskip_const:Nn + } + { \tex_muexpr:D { \tex_mutoglue:D } } + \__kernel_patch_eval:nn + { + \skip_set:Nn + \skip_gset:Nn + \skip_add:Nn + \skip_gadd:Nn + \skip_sub:Nn + \skip_gsub:Nn + \skip_const:Nn + } + { \tex_glueexpr:D { } } +% \end{macrocode} +% +% Patching expandable expressions, first the one-argument versions, +% then the two-argument ones. +% \begin{macrocode} + \cs_set_protected:Npn \__kernel_patch_eval:nn #1#2 + { + \tl_map_inline:nn {#1} + { + \exp_args:NNx \__kernel_patch:Nn ##1 + { + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 1 } + \exp_not:n {#2} + \exp_not:N ##1 + } + } + } + } +%<@@=box> + \__kernel_patch_eval:nn + { \@@_dim_eval:n } + { \@@_eval:w { } } +%<@@=dim> + \__kernel_patch_eval:nn + { + \dim_eval:n + \dim_to_decimal:n + \dim_to_decimal_in_sp:n + \dim_abs:n + \dim_sign:n + } + { \@@_eval:w { } } +%<@@=int> + \__kernel_patch_eval:nn + { + \int_eval:n + \int_abs:n + \int_sign:n + } + { \@@_eval:w { } } + \__kernel_patch_eval:nn + { + \skip_eval:n + \skip_horizontal:n + \skip_vertical:n + } + { \tex_glueexpr:D { } } + \__kernel_patch_eval:nn + { + \muskip_eval:n + } + { \tex_muexpr:D { \tex_mutoglue:D } } + \cs_set_protected:Npn \__kernel_patch_eval:nn #1#2 + { + \tl_map_inline:nn {#1} + { + \exp_args:NNx \__kernel_patch:Nn ##1 + { + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 1 } + \exp_not:n {#2} + \exp_not:N ##1 + } + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 2 } + \exp_not:n {#2} + \exp_not:N ##1 + } + } + } + } +%<@@=dim> + \__kernel_patch_eval:nn + { + \dim_max:nn + \dim_min:nn + } + { \@@_eval:w { } } +%<@@=int> + \__kernel_patch_eval:nn + { + \int_max:nn + \int_min:nn + \int_div_truncate:nn + \int_mod:nn + } + { \@@_eval:w { } } +% \end{macrocode} +% +% Conditionals: three argument ones then one argument ones +% \begin{macrocode} + \cs_set_protected:Npn \__kernel_patch_cond:nn #1#2 + { + \clist_map_inline:nn { :nNnT , :nNnF , :nNnTF , _p:nNn } + { + \exp_args:Ncx \__kernel_patch:Nn { #1 ##1 } + { + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 1 } + \exp_not:n {#2} + \exp_not:c { #1 ##1 } + } + { \c_hash_str 2 } + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 3 } + \exp_not:n {#2} + \exp_not:c { #1 ##1 } + } + } + } + } +%<@@=dim> + \__kernel_patch_cond:nn { dim_compare } { \@@_eval:w { } } +%<@@=int> + \__kernel_patch_cond:nn { int_compare } { \@@_eval:w { } } + \cs_set_protected:Npn \__kernel_patch_cond:nn #1#2 + { + \clist_map_inline:nn { :nT , :nF , :nTF , _p:n } + { + \exp_args:Ncx \__kernel_patch:Nn { #1 ##1 } + { + { + \exp_not:N \__kernel_chk_expr:nNnN { \c_hash_str 1 } + \exp_not:n {#2} + \exp_not:c { #1 ##1 } + } + } + } + } +%<@@=int> + \__kernel_patch_cond:nn { int_if_even } { \@@_eval:w { } } + \__kernel_patch_cond:nn { int_if_odd } { \@@_eval:w { } } +% \end{macrocode} +% +% Step functions. +% \begin{macrocode} +%<@@=dim> + \__kernel_patch:Nn \dim_step_function:nnnN + { + { + \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } + \dim_step_function:nnnN + } + { + \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } + \dim_step_function:nnnN + } + { + \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } + \dim_step_function:nnnN + } + } +%<@@=int> + \__kernel_patch:Nn \int_step_function:nnnN + { + { + \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } + \int_step_function:nnnN + } + { + \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } + \int_step_function:nnnN + } + { + \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } + \int_step_function:nnnN + } + } +% \end{macrocode} +% +% Odds and ends +% \begin{macrocode} + \__kernel_patch:Nn \dim_to_fp:n { { (#1) } } +% \end{macrocode} +% +% \begin{macrocode} +\group_end: +% \end{macrocode} +% +% \begin{macrocode} +%<@@=skip> +% \end{macrocode} +% This one has catcode changes so must be done by hand. +% \begin{macrocode} +\cs_set_protected:Npn \@@_tmp:w #1 + { + \prg_set_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF } + { + \exp_after:wN \@@_if_finite:wwNw + \skip_use:N \tex_glueexpr:D + \__kernel_chk_expr:nNnN + {##1} \tex_glueexpr:D { } \skip_if_finite:n + ; \prg_return_false: + #1 ; \prg_return_true: \q_stop + } + } +\exp_args:No \@@_tmp:w { \tl_to_str:n { fil } } +% \end{macrocode} +% +% \begin{macrocode} +%<@@=msg> +% \end{macrocode} +% +% Messages. +% \begin{macrocode} +\__kernel_msg_new:nnnn { kernel } { debug } + { The~debugging~option~'#1'~does~not~exist~\msg_line_context:. } + { + The~functions~'\iow_char:N\\debug_on:n'~and~ + '\iow_char:N\\debug_off:n'~only~accept~the~arguments~ + 'all',~'check-declarations',~'check-expressions',~ + 'deprecation',~'log-functions',~not~'#1'. + } +\__kernel_msg_new:nnn { kernel } { expr } { '#2'~in~#1 } +\__kernel_msg_new:nnnn { kernel } { local-global } + { Inconsistent~local/global~assignment } + { + \c_@@_coding_error_text_tl + \if:w l #2 Local + \else: + \if:w g #2 Global \else: Constant \fi: + \fi: + \ % + assignment~to~a~ + \if:w l #1 local + \else: + \if:w g #1 global \else: constant \fi: + \fi: + \ % + variable~'#3'. + } +\__kernel_msg_new:nnnn { kernel } { non-declared-variable } + { The~variable~#1~has~not~been~declared~\msg_line_context:. } + { + \c_@@_coding_error_text_tl + Checking~is~active,~and~you~have~tried~do~so~something~like: \\ + \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ + without~first~having: \\ + \ \ \tl_new:N ~ #1 \\ + \\ + LaTeX~will~create~the~variable~and~continue. + } +% \end{macrocode} +% +% \begin{macro}{\__kernel_if_debug:TF} +% Flip the switch for deprecated code. +% \begin{macrocode} +\cs_set_protected:Npn \__kernel_if_debug:TF #1#2 {#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</initex|package> +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex diff --git a/macros/latex/contrib/l3kernel/l3deprecation.dtx b/macros/latex/contrib/l3kernel/l3deprecation.dtx index 41a8bed1a2..82a770ad80 100644 --- a/macros/latex/contrib/l3kernel/l3deprecation.dtx +++ b/macros/latex/contrib/l3kernel/l3deprecation.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -90,6 +90,10 @@ % \end{macrocode} % % \begin{macrocode} +%<*kernel> +% \end{macrocode} +% +% \begin{macrocode} %<@@=deprecation> % \end{macrocode} % @@ -126,6 +130,12 @@ % \end{macrocode} % \end{macro} % +% \begin{variable}{\g__kernel_deprecation_undo_recent_bool} +% \begin{macrocode} +\bool_new:N \g__kernel_deprecation_undo_recent_bool +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\@@_not_yet_deprecated:nTF, \@@_minus_six_months:w} % Receives a deprecation \meta{date} and runs the \texttt{true} % (\texttt{false}) branch if the \pkg{expl3} date is earlier (later) @@ -149,7 +159,7 @@ } < {#1} { \bool_set_true:N \l_@@_grace_period_bool - \bool_if:NTF \l@expl@undo@recent@deprecations@bool + \bool_if:NTF \g__kernel_deprecation_undo_recent_bool } { \use_ii:nn } } @@ -242,9 +252,9 @@ { \bool_if:nTF { - \cs_if_eq_p:NN #3 \cs_new_protected:Npn && + \cs_if_eq_p:NN #3 \cs_gset_protected:Npn && \__kernel_if_debug:TF - { \c_true_bool } { \l@expl@undo@recent@deprecations@bool } + { \c_true_bool } { \g__kernel_deprecation_undo_recent_bool } } { \@@_warn_once:nnNnn {#1} {#2} #4 {#5} {#6} } { \@@_patch_aux:Nn #3 { #4 #5 {#6} } } @@ -263,7 +273,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_warn_once:nnNnn #1#2#3#4#5 { - \cs_new_protected:Npx #3 + \cs_gset_protected:Npx #3 { \__kernel_if_debug:TF { @@ -292,7 +302,7 @@ \cs_new_protected:Npn \@@_patch_aux:Nn #1#2 { #1 #2 - \cs_if_eq:NNTF #1 \cs_new_protected:Npn + \cs_if_eq:NNTF #1 \cs_gset_protected:Npn { \__kernel_deprecation_code:nn { } { \cs_set_protected:Npn #2 } } { \__kernel_deprecation_code:nn { } { \cs_set:Npn #2 } } } @@ -311,7 +321,7 @@ { \exp_not:N #4 { - \cs_if_eq:NNTF #3 \cs_new_protected:Npn + \cs_if_eq:NNTF #3 \cs_gset_protected:Npn { \exp_not:N \__kernel_msg_error:nnnnnn } { \exp_not:N \__kernel_msg_expandable_error:nnnnnn } { kernel } { deprecated-command } @@ -369,12 +379,12 @@ \cs_new_protected:Npn \@@_old_protected:Nnn #1#2#3 { \__kernel_patch_deprecation:nnNNpn {#3} {#2} - \cs_new_protected:Npn #1 { } + \cs_gset_protected:Npn #1 { } } \cs_new_protected:Npn \@@_old:Nnn #1#2#3 { \__kernel_patch_deprecation:nnNNpn {#3} {#2} - \cs_new:Npn #1 { } + \cs_gset:Npn #1 { } } \@@_old:Nnn \box_resize:Nnn { \box_resize_to_wd_and_ht_plus_dp:Nnn } { 2019-01-01 } @@ -545,6 +555,40 @@ % \end{macro} % \end{macro} % +% \subsection{Loading the patches} +% +% When loaded first, the patches are simply read here. +% +% \begin{macrocode} +\group_begin: +\cs_set_protected:Npn \ProvidesExplFile + { + \char_set_catcode_space:n { `\ } + \ProvidesExplFileAux + } +\cs_set_protected:Npx \ProvidesExplFileAux #1#2#3#4 + { + \group_end: + \cs_if_exist:NTF \ProvidesFile + { \exp_not:N \ProvidesFile {#1} [ #2~v#3~#4 ] } + { \iow_log:x { File:~#1~#2~v#3~#4 } } + } +\file_input:n { l3deprecation.def } +% \end{macrocode} +% +% \begin{macrocode} +%</kernel> +% \end{macrocode} +% +% \begin{macrocode} +%<*patches> +% \end{macrocode} +% +% Standard file identification. +% \begin{macrocode} +\ProvidesExplFile{l3deprecation.def}{2019-04-06}{}{L3 Deprecated functions} +% \end{macrocode} +% % \subsection{Deprecated \pkg{l3box} functions} % % \begin{macro}[deprecated = 2021-07-01] @@ -559,10 +603,10 @@ % } % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \box_set_eq_drop:N } -\cs_new_protected:Npn \box_set_eq_clear:NN #1#2 +\cs_gset_protected:Npn \box_set_eq_clear:NN #1#2 { \tex_setbox:D #1 \tex_box:D #2 } \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \box_gset_eq_drop:N } -\cs_new_protected:Npn \box_gset_eq_clear:NN #1#2 +\cs_gset_protected:Npn \box_gset_eq_clear:NN #1#2 { \tex_global:D \tex_setbox:D #1 \tex_box:D #2 } \cs_generate_variant:Nn \box_set_eq_clear:NN { c , Nc , cc } \cs_generate_variant:Nn \box_gset_eq_clear:NN { c , Nc , cc } @@ -573,7 +617,7 @@ % \begin{macro}[deprecated = 2021-07-01]{\hbox_unpack_clear:N, \hbox_unpack_clear:c} % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \hbox_unpack_drop:N } -\cs_new_protected:Npn \hbox_unpack_clear:N +\cs_gset_protected:Npn \hbox_unpack_clear:N { \hbox_unpack_drop:N } \cs_generate_variant:Nn \hbox_unpack_clear:N { c } % \end{macrocode} @@ -582,7 +626,7 @@ % \begin{macro}[deprecated = 2021-07-01]{\vbox_unpack_clear:N, \vbox_unpack_clear:c} % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \vbox_unpack_drop:N } -\cs_new_protected:Npn \vbox_unpack_clear:N +\cs_gset_protected:Npn \vbox_unpack_clear:N { \vbox_unpack_drop:N } \cs_generate_variant:Nn \vbox_unpack_clear:N { c } % \end{macrocode} @@ -610,7 +654,7 @@ % \cs{@@_constdef:Nw}, with an \cs{exp_not:N} construction because the % constants themselves are outer at that point. % \begin{macrocode} -\cs_new_protected:Npn \@@_deprecated_constants:nn #1#2 +\cs_gset_protected:Npn \@@_deprecated_constants:nn #1#2 { #1 \c_zero { 0 } #2 #1 \c_one { 1 } #2 @@ -636,7 +680,12 @@ #1 \c_one_thousand { 1000 } #2 #1 \c_ten_thousand { 10000 } #2 } -\@@_deprecated_constants:nn { \int_const:Nn } { } +\cs_set_protected:Npn \@@_deprecated_constants:Nn #1#2 + { + \cs_if_free:NT #1 + { \int_const:Nn #1 {#2} } + } +\@@_deprecated_constants:nn { \@@_deprecated_constants:Nn } { } \__kernel_deprecation_code:nn { \@@_deprecated_constants:nn @@ -658,7 +707,7 @@ % \begin{macro}[deprecated = 2020-07-01]{\@@_value:w} % Made public. % \begin{macrocode} -\cs_new_eq:NN \@@_value:w \int_value:w +\cs_gset_eq:NN \@@_value:w \int_value:w % \end{macrocode} % \end{macro} % @@ -672,11 +721,11 @@ % \begin{macro}[deprecated = 2020-07-01]{\lua_shipout_x:n} % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \lua_now:e } -\cs_new:Npn \lua_now_x:n #1 { \@@_now:n {#1} } +\cs_gset:Npn \lua_now_x:n #1 { \@@_now:n {#1} } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \lua_escape:e } -\cs_new:Npn \lua_escape_x:n #1 { \@@_escape:n {#1} } +\cs_gset:Npn \lua_escape_x:n #1 { \@@_escape:n {#1} } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \lua_shipout_e:n } -\cs_new_protected:Npn \lua_shipout_x:n #1 { \@@_shipout:n {#1} } +\cs_gset_protected:Npn \lua_shipout_x:n #1 { \@@_shipout:n {#1} } % \end{macrocode} % \end{macro} % \end{macro} @@ -690,14 +739,14 @@ % \begin{macro}[deprecated = 2020-07-01]{\msg_log:n, \msg_term:n} % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \iow_log:n } -\cs_new_protected:Npn \msg_log:n #1 +\cs_gset_protected:Npn \msg_log:n #1 { \iow_log:n { ................................................. } \iow_wrap:nnnN { . ~ #1} { . ~ } { } \iow_log:n \iow_log:n { ................................................. } } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \iow_term:n } -\cs_new_protected:Npn \msg_term:n #1 +\cs_gset_protected:Npn \msg_term:n #1 { \iow_term:n { ************************************************* } \iow_wrap:nnnN { * ~ #1} { * ~ } { } \iow_term:n @@ -709,7 +758,7 @@ % \begin{macro}[deprecated = 2020-07-01]{\msg_interrupt:nnn} % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { [Defined~error~message] } -\cs_new_protected:Npn \msg_interrupt:nnn #1#2#3 +\cs_gset_protected:Npn \msg_interrupt:nnn #1#2#3 { \tl_if_empty:nTF {#3} { @@ -721,12 +770,12 @@ {#1 \\\\ #2 \\\\ \c_@@_help_text_tl } } } -\cs_new_protected:Npn \@@_old_interrupt_wrap:nn #1#2 +\cs_gset_protected:Npn \@@_old_interrupt_wrap:nn #1#2 { \iow_wrap:nnnN {#1} { | ~ } { } \@@_old_interrupt_more_text:n \iow_wrap:nnnN {#2} { ! ~ } { } \@@_old_interrupt_text:n } -\cs_new_protected:Npn \@@_old_interrupt_more_text:n #1 +\cs_gset_protected:Npn \@@_old_interrupt_more_text:n #1 { \exp_args:Nx \tex_errhelp:D { @@ -743,7 +792,7 @@ \tex_lowercase:D { \group_end: - \cs_new_protected:Npn \@@_old_interrupt_text:n #1 + \cs_gset_protected:Npn \@@_old_interrupt_text:n #1 { \iow_term:x { @@ -807,16 +856,16 @@ % definition has not yet been restored. % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \prg_break_point:Nn } -\cs_new:Npn \@@_break_point:Nn { \prg_break_point:Nn } +\cs_gset:Npn \@@_break_point:Nn { \prg_break_point:Nn } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \prg_break_point: } -\cs_new:Npn \@@_break_point: { \prg_break_point: } +\cs_gset:Npn \@@_break_point: { \prg_break_point: } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \prg_map_break:Nn } -\cs_new:Npn \@@_map_break:Nn #1 \@@_break_point:Nn +\cs_gset:Npn \@@_map_break:Nn #1 \@@_break_point:Nn { \prg_map_break:Nn #1 \prg_break_point:Nn } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \prg_break: } -\cs_new:Npn \@@_break: #1 \@@_break_point: { } +\cs_gset:Npn \@@_break: #1 \@@_break_point: { } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \prg_break:n } -\cs_new:Npn \@@_break:n #1#2 \@@_break_point: {#1} +\cs_gset:Npn \@@_break:n #1#2 \@@_break_point: {#1} % \end{macrocode} % \end{macro} % @@ -826,21 +875,21 @@ % \begin{macro}[EXP, deprecated = 2020-07-01, pTF]{\str_if_eq_x:nn} % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_case_e:nn } -\cs_new:Npn \str_case_x:nn { \str_case_e:nn } +\cs_gset:Npn \str_case_x:nn { \str_case_e:nn } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_case_e:nnT } -\cs_new:Npn \str_case_x:nnT { \str_case_e:nnT } +\cs_gset:Npn \str_case_x:nnT { \str_case_e:nnT } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_case_e:nnF } -\cs_new:Npn \str_case_x:nnF { \str_case_e:nnF } +\cs_gset:Npn \str_case_x:nnF { \str_case_e:nnF } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_case_e:nnTF } -\cs_new:Npn \str_case_x:nnTF { \str_case_e:nnTF } +\cs_gset:Npn \str_case_x:nnTF { \str_case_e:nnTF } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_if_eq_p:ee } -\cs_new:Npn \str_if_eq_x_p:nn { \str_if_eq_p:ee } +\cs_gset:Npn \str_if_eq_x_p:nn { \str_if_eq_p:ee } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_if_eq:eeT } -\cs_new:Npn \str_if_eq_x:nnT { \str_if_eq:eeT } +\cs_gset:Npn \str_if_eq_x:nnT { \str_if_eq:eeT } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_if_eq:eeF } -\cs_new:Npn \str_if_eq_x:nnF { \str_if_eq:eeF } +\cs_gset:Npn \str_if_eq_x:nnF { \str_if_eq:eeF } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \str_if_eq:eeTF } -\cs_new:Npn \str_if_eq_x:nnTF { \str_if_eq:eeTF } +\cs_gset:Npn \str_if_eq_x:nnTF { \str_if_eq:eeTF } % \end{macrocode} % \end{macro} % \end{macro} @@ -860,11 +909,11 @@ % } % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \file_get:nnN } -\cs_new_protected:Npn \tl_set_from_file:Nnn #1#2#3 +\cs_gset_protected:Npn \tl_set_from_file:Nnn #1#2#3 { \file_get:nnN {#3} {#2} #1 } \cs_generate_variant:Nn \tl_set_from_file:Nnn { c } \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \file_get:nnN } -\cs_new_protected:Npn \tl_gset_from_file:Nnn #1#2#3 +\cs_gset_protected:Npn \tl_gset_from_file:Nnn #1#2#3 { \group_begin: \file_get:nnN {#3} {#2} \l_@@_internal_a_tl @@ -873,7 +922,7 @@ } \cs_generate_variant:Nn \tl_gset_from_file:Nnn { c } \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \file_get:nnN } -\cs_new_protected:Npn \tl_set_from_file_x:Nnn #1#2#3 +\cs_gset_protected:Npn \tl_set_from_file_x:Nnn #1#2#3 { \group_begin: \file_get:nnN {#3} {#2} \l_@@_internal_a_tl @@ -884,7 +933,7 @@ } \cs_generate_variant:Nn \tl_set_from_file_x:Nnn { c } \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \file_get:nnN } -\cs_new_protected:Npn \tl_gset_from_file_x:Nnn #1#2#3 +\cs_gset_protected:Npn \tl_gset_from_file_x:Nnn #1#2#3 { \group_begin: \file_get:nnN {#3} {#2} \l_@@_internal_a_tl @@ -903,9 +952,9 @@ % Simple renames. % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \tl_analysis_show:N } -\cs_new_protected:Npn \tl_show_analysis:N { \tl_analysis_show:N } +\cs_gset_protected:Npn \tl_show_analysis:N { \tl_analysis_show:N } \__kernel_patch_deprecation:nnNNpn { 2020-01-01 } { \tl_analysis_show:n } -\cs_new_protected:Npn \tl_show_analysis:n { \tl_analysis_show:n } +\cs_gset_protected:Npn \tl_show_analysis:n { \tl_analysis_show:n } % \end{macrocode} % \end{macro} % @@ -919,11 +968,11 @@ % } % \begin{macrocode} \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \cs_prefix_spec:N } -\cs_new:Npn \token_get_prefix_spec:N { \cs_prefix_spec:N } +\cs_gset:Npn \token_get_prefix_spec:N { \cs_prefix_spec:N } \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \cs_argument_spec:N } -\cs_new:Npn \token_get_arg_spec:N { \cs_argument_spec:N } +\cs_gset:Npn \token_get_arg_spec:N { \cs_argument_spec:N } \__kernel_patch_deprecation:nnNNpn { 2021-01-01 } { \cs_replacement_spec:N } -\cs_new:Npn \token_get_replacement_spec:N { \cs_replacement_spec:N } +\cs_gset:Npn \token_get_replacement_spec:N { \cs_replacement_spec:N } % \end{macrocode} % \end{macro} % @@ -937,6 +986,10 @@ % \end{macro} % % \begin{macrocode} +%</patches> +% \end{macrocode} +% +% \begin{macrocode} %</initex|package> % \end{macrocode} % diff --git a/macros/latex/contrib/l3kernel/l3doc.dtx b/macros/latex/contrib/l3kernel/l3doc.dtx index 30270adf8a..6932483f93 100644 --- a/macros/latex/contrib/l3kernel/l3doc.dtx +++ b/macros/latex/contrib/l3kernel/l3doc.dtx @@ -79,7 +79,7 @@ and all files in that bundle must be distributed together. % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % \maketitle % \tableofcontents % diff --git a/macros/latex/contrib/l3kernel/l3docstrip.dtx b/macros/latex/contrib/l3kernel/l3docstrip.dtx index fbb65b543d..0c0980060e 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.dtx +++ b/macros/latex/contrib/l3kernel/l3docstrip.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3docstrip.pdf b/macros/latex/contrib/l3kernel/l3docstrip.pdf Binary files differindex e63fb201c9..53f2a49d0d 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.pdf +++ b/macros/latex/contrib/l3kernel/l3docstrip.pdf diff --git a/macros/latex/contrib/l3kernel/l3expan.dtx b/macros/latex/contrib/l3kernel/l3expan.dtx index ab6ec3271b..ab72686865 100644 --- a/macros/latex/contrib/l3kernel/l3expan.dtx +++ b/macros/latex/contrib/l3kernel/l3expan.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -1128,7 +1128,7 @@ \exp_after:wN { \exp:w \@@_eval_register:N #3 } {#1} {#2} } -\cs_new:Npn \::v # 1\::: #2#3 +\cs_new:Npn \::v #1 \::: #2#3 { \exp_after:wN \@@_arg_next:nnn \exp_after:wN { \exp:w \@@_eval_register:c {#3} } @@ -1400,99 +1400,13 @@ % \end{macrocode} % \end{macro} % -% \subsection{Definitions with the automated technique} -% \label{sec:l3expan:gendef} -% -% Some of these could be done more efficiently, but the complexity of -% coding then becomes an issue. Notice that the auto-generated functions -% actually take no arguments themselves. -% % \begin{macro}{\exp_args:Nx} % \begin{macrocode} -\cs_new_protected:Npn \exp_args:Nx { \::x \::: } +\cs_new_protected:Npn \exp_args:Nx #1#2 + { \use:x { \exp_not:N #1 {#2} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP] -% { -% \exp_args:Nnc, \exp_args:Nno, \exp_args:NnV, \exp_args:Nnv, \exp_args:Nne, \exp_args:Nnf, -% \exp_args:Noc, \exp_args:Noo, \exp_args:Nof, -% \exp_args:NVo, \exp_args:Nfo, \exp_args:Nff, -% } -% \begin{macro} -% { -% \exp_args:NNx, \exp_args:Ncx, \exp_args:Nnx, -% \exp_args:Nox, \exp_args:Nxo, \exp_args:Nxx, -% } -% Here are the actual function definitions, using the helper functions -% above. -% \begin{macrocode} -\cs_new:Npn \exp_args:Nnc { \::n \::c \::: } -\cs_new:Npn \exp_args:Nno { \::n \::o \::: } -\cs_new:Npn \exp_args:NnV { \::n \::V \::: } -\cs_new:Npn \exp_args:Nnv { \::n \::v \::: } -\cs_new:Npn \exp_args:Nne { \::n \::e \::: } -\cs_new:Npn \exp_args:Nnf { \::n \::f \::: } -\cs_new:Npn \exp_args:Noc { \::o \::c \::: } -\cs_new:Npn \exp_args:Noo { \::o \::o \::: } -\cs_new:Npn \exp_args:Nof { \::o \::f \::: } -\cs_new:Npn \exp_args:NVo { \::V \::o \::: } -\cs_new:Npn \exp_args:Nfo { \::f \::o \::: } -\cs_new:Npn \exp_args:Nff { \::f \::f \::: } -\cs_new_protected:Npn \exp_args:NNx { \::N \::x \::: } -\cs_new_protected:Npn \exp_args:Ncx { \::c \::x \::: } -\cs_new_protected:Npn \exp_args:Nnx { \::n \::x \::: } -\cs_new_protected:Npn \exp_args:Nox { \::o \::x \::: } -\cs_new_protected:Npn \exp_args:Nxo { \::x \::o \::: } -\cs_new_protected:Npn \exp_args:Nxx { \::x \::x \::: } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[EXP] -% { -% \exp_args:NNNv, \exp_args:NNcf, -% \exp_args:NNno, \exp_args:NNnV, \exp_args:NNoo, \exp_args:NNVV, -% \exp_args:Ncno, \exp_args:NcnV, \exp_args:Ncoo, \exp_args:NcVV, -% \exp_args:Nnnc, \exp_args:Nnno, \exp_args:Nnnf, \exp_args:Nnff, -% \exp_args:Nooo, \exp_args:Noof, \exp_args:Nffo, -% } -% \begin{macro} -% { -% \exp_args:NNNx, \exp_args:NNnx, \exp_args:NNox, -% \exp_args:Nccx, \exp_args:Ncnx, -% \exp_args:Nnnx, \exp_args:Nnox, \exp_args:Noox, -% } -% \begin{macrocode} -\cs_new:Npn \exp_args:NNNv { \::N \::N \::v \::: } -\cs_new:Npn \exp_args:NNcf { \::N \::c \::f \::: } -\cs_new:Npn \exp_args:NNno { \::N \::n \::o \::: } -\cs_new:Npn \exp_args:NNnV { \::N \::n \::V \::: } -\cs_new:Npn \exp_args:NNoo { \::N \::o \::o \::: } -\cs_new:Npn \exp_args:NNVV { \::N \::V \::V \::: } -\cs_new:Npn \exp_args:Ncno { \::c \::n \::o \::: } -\cs_new:Npn \exp_args:NcnV { \::c \::n \::V \::: } -\cs_new:Npn \exp_args:Ncoo { \::c \::o \::o \::: } -\cs_new:Npn \exp_args:NcVV { \::c \::V \::V \::: } -\cs_new:Npn \exp_args:Nnnc { \::n \::n \::c \::: } -\cs_new:Npn \exp_args:Nnno { \::n \::n \::o \::: } -\cs_new:Npn \exp_args:Nnnf { \::n \::n \::f \::: } -\cs_new:Npn \exp_args:Nnff { \::n \::f \::f \::: } -\cs_new:Npn \exp_args:Nooo { \::o \::o \::o \::: } -\cs_new:Npn \exp_args:Noof { \::o \::o \::f \::: } -\cs_new:Npn \exp_args:Nffo { \::f \::f \::o \::: } -\cs_new_protected:Npn \exp_args:NNNx { \::N \::N \::x \::: } -\cs_new_protected:Npn \exp_args:NNnx { \::N \::n \::x \::: } -\cs_new_protected:Npn \exp_args:NNox { \::N \::o \::x \::: } -\cs_new_protected:Npn \exp_args:Nnnx { \::n \::n \::x \::: } -\cs_new_protected:Npn \exp_args:Nnox { \::n \::o \::x \::: } -\cs_new_protected:Npn \exp_args:Nccx { \::c \::c \::x \::: } -\cs_new_protected:Npn \exp_args:Ncnx { \::c \::n \::x \::: } -\cs_new_protected:Npn \exp_args:Noox { \::o \::o \::x \::: } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Last-unbraced versions} % % \begin{macro}[EXP]{\@@_arg_last_unbraced:nn} @@ -2263,7 +2177,6 @@ % iterate through the comma list of variant argument specifiers, which % we first convert to a string: the reason is explained later. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_cs_exist:N #1 } { } \cs_new_protected:Npn \cs_generate_variant:Nn #1#2 { \@@_generate_variant:N #1 @@ -2598,9 +2511,9 @@ % \begin{macrocode} \cs_new:Npn \@@_generate_variant_same:N #1 { - \if:w N #1 N \else: - \if:w p #1 p \else: - n + \if:w N #1 #1 \else: + \if:w p #1 #1 \else: + \token_to_str:N n \if:w n #1 \else: \@@_generate_variant_loop_special:NNwNNnn #1#1 \fi: @@ -2618,18 +2531,6 @@ % \cs{cs_new_protected:Npx}. Then define the variant by % combining the |\exp_args:N #3| variant and the base function. % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \cs_if_free:NF #4 - { - \__kernel_debug_log:x - { - Variant~\token_to_str:N #4~% - already~defined;~ not~ changing~ it~ \msg_line_context: - } - } - } - { } \cs_new_protected:Npn \@@_generate_variant:wwNN #1 \q_mark #2 \q_stop #3#4 { @@ -2646,38 +2547,129 @@ % \end{macro} % % \begin{macro}{\@@_generate_internal_variant:n} -% \begin{macro}{\@@_generate_internal_variant:wwnw} % \begin{macro}[rEXP]{\@@_generate_internal_variant_loop:n} -% Test if |\exp_args:N #1| is already defined and if not define it via -% the |\::| commands using the chars in |#1|. If |#1| contains an |x| -% (this is the place where having converted the original comma-list -% argument to a string is very important), the result should be -% protected, and the next variant to be defined using that internal -% variant should be protected. +% First test for the presence of |x| (this is where working with +% strings makes our lives easier), as the result should be protected, +% and the next variant to be defined using that internal variant +% should be protected (done by setting \cs{@@_tmp:w}). Then call +% \cs{@@_generate_internal_variant:NNn} with arguments +% \cs{cs_new_protected:cpn} \cs{use:x} (for protected) or +% \cs{cs_new:cpn} \cs{tex_expanded:D} (expandable) and the signature. If |p| +% appears in the signature, or if the function to be defined is +% expandable and the primitive \tn{expanded} is not available, call +% some fall-back code that just puts the appropriate |\::| commands. +% Otherwise, call \cs{@@_generate_internal_one_go:NNn} to construct +% the \cs[no-index]{exp_args:N\dots} function as a macro taking up to +% $9$~arguments and expanding them using \cs{use:x} or \cs{tex_expanded:D}. % \begin{macrocode} \cs_new_protected:Npx \@@_generate_internal_variant:n #1 { - \exp_not:N \@@_generate_internal_variant:wwnNwnn + \exp_not:N \@@_generate_internal_variant:wwnNwn #1 \exp_not:N \q_mark { \cs_set_eq:NN \exp_not:N \@@_tmp:w \cs_new_protected:Npx } - \cs_new_protected:cpx + \cs_new_protected:cpn + \use:x \token_to_str:N x \exp_not:N \q_mark { } - \cs_new:cpx + \cs_new:cpn + \exp_not:N \tex_expanded:D \exp_not:N \q_stop - { exp_args:N #1 } - { - \exp_not:N \@@_generate_internal_variant_loop:n #1 - { : \exp_not:N \use_i:nn } - } + {#1} } \exp_last_unbraced:NNNNo - \cs_new_protected:Npn \@@_generate_internal_variant:wwnNwnn #1 - { \token_to_str:N x } #2 \q_mark #3#4#5 \q_stop #6#7 + \cs_new_protected:Npn \@@_generate_internal_variant:wwnNwn #1 + { \token_to_str:N x } #2 \q_mark #3#4#5#6 \q_stop #7 { #3 - \cs_if_free:cT {#6} { #4 {#6} {#7} } + \cs_if_free:cT { exp_args:N #7 } + { \@@_generate_internal_variant:NNn #4 #5 {#7} } } +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new_protected:Npn \@@_generate_internal_variant:NNn ##1##2##3 + { + \@@_generate_internal_test:Nw ##2 ##3 + \q_mark + { + \use:x + { + ##1 { exp_args:N ##3 } + { \@@_generate_internal_variant_loop:n ##3 { : \use_i:nn } } + } + } + #1 + \q_mark + { \exp_not:n { \@@_generate_internal_one_go:NNn ##1 ##2 {##3} } } + \q_stop + } + \cs_new_protected:Npn \@@_generate_internal_test_aux:w + ##1 #1 ##2 \q_mark ##3 ##4 \q_stop {##3} + \cs_if_exist:NTF \tex_expanded:D + { + \cs_new_eq:NN \@@_generate_internal_test:Nw + \@@_generate_internal_test_aux:w + } + { + \cs_new_protected:Npn \@@_generate_internal_test:Nw ##1 + { + \if_meaning:w \tex_expanded:D ##1 + \exp_after:wN \@@_generate_internal_test_aux:w + \exp_after:wN #1 + \else: + \exp_after:wN \@@_generate_internal_test_aux:w + \fi: + } + } + } +\exp_args:No \@@_tmp:w { \token_to_str:N p } +\cs_new_protected:Npn \@@_generate_internal_one_go:NNn #1#2#3 + { + \@@_generate_internal_loop:nwnnw + { \exp_not:N ##1 } 1 . { } { } + #3 { ? \@@_generate_internal_end:w } X ; + 23456789 { ? \@@_generate_internal_long:w } ; + #1 #2 {#3} + } +\cs_new_protected:Npn \@@_generate_internal_loop:nwnnw #1#2 . #3#4#5#6 ; #7 + { + \use_none:n #5 + \use_none:n #7 + \cs_if_exist_use:cF { @@_generate_internal_#5:NN } + { \@@_generate_internal_other:NN } + #5 #7 + #7 . + { #3 #1 } { #4 ## #2 } + #6 ; + } +\cs_new_protected:Npn \@@_generate_internal_N:NN #1#2 + { \@@_generate_internal_loop:nwnnw { \exp_not:N ###2 } } +\cs_new_protected:Npn \@@_generate_internal_c:NN #1#2 + { \exp_args:No \@@_generate_internal_loop:nwnnw { \exp_not:c {###2} } } +\cs_new_protected:Npn \@@_generate_internal_n:NN #1#2 + { \@@_generate_internal_loop:nwnnw { { \exp_not:n {###2} } } } +\cs_new_protected:Npn \@@_generate_internal_x:NN #1#2 + { \@@_generate_internal_loop:nwnnw { {###2} } } +\cs_new_protected:Npn \@@_generate_internal_other:NN #1#2 + { + \exp_args:No \@@_generate_internal_loop:nwnnw + { + \exp_after:wN + { + \exp:w \exp_args:NNc \exp_after:wN \exp_end: + { exp_not:#1 } {###2} + } + } + } +\cs_new_protected:Npn \@@_generate_internal_end:w #1 . #2#3#4 ; #5 ; #6#7#8 + { #6 { exp_args:N #8 } #3 { #7 {#2} } } +\cs_new_protected:Npn \@@_generate_internal_long:w #1 N #2#3 . #4#5#6# + { + \exp_args:Nx \@@_generate_internal_long:nnnNNn + { \@@_generate_internal_variant_loop:n #2 #6 { : \use_i:nn } } + {#4} {#5} + } +\cs_new:Npn \@@_generate_internal_long:nnnNNn #1#2#3#4 ; ; #5#6#7 + { #5 { exp_args:N #7 } #3 { #6 { \exp_not:n {#1} {#2} } } } % \end{macrocode} % This command grabs char by char outputting |\::#1| (not expanded % further). We avoid tests by putting a trailing |: \use_i:nn|, which @@ -2693,7 +2685,6 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro} % { @@ -2756,15 +2747,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\exp_args_generate:n, \@@_args_generate:Nn} -% \begin{macro}[EXP]{\@@_args_generate:n} +% \begin{macro}{\exp_args_generate:n} % This function is not used in the kernel hence we can use functions % that are defined in later modules. It also does not need to be fast % so use inline mappings. For each requested variant we check that % there are no characters besides |NnpcofVvx|, in particular that -% there are no spaces. Then we loop through the variant specifier and -% convert each letter to \cs[no-index]{::\meta{variant letter}}, with a -% trailing \cs{:::}. +% there are no spaces. Then we just call the internal function. % \begin{macrocode} \cs_new_protected:Npn \exp_args_generate:n #1 { @@ -2776,21 +2764,105 @@ { \__kernel_msg_error:nnnn { kernel } { invalid-exp-args } {####1} {##1} - \str_map_break:n { \use_none:nnnn } + \str_map_break:n { \use_none:nn } } } - \exp_args:Nc \@@_args_generate:Nn { exp_args:N ##1 } {##1} + \@@_generate_internal_variant:n {##1} } } -\cs_new_protected:Npn \@@_args_generate:Nn #1#2 - { - \cs_if_exist:NF #1 - { - \str_if_in:nnTF {#2} { x } { \cs_new_protected:Npx } { \cs_new:Npx } - #1 { \tl_map_function:nN { #2 : } \@@_args_generate:n } - } - } -\cs_new:Npn \@@_args_generate:n #1 { \exp_not:c { :: #1 } } +% \end{macrocode} +% \end{macro} +% +% \subsection{Definitions with the automated technique} +% \label{sec:l3expan:gendef} +% +% Some of these could be done more efficiently, but the complexity of +% coding then becomes an issue. Notice that the auto-generated functions +% actually take no arguments themselves. +% +% \begin{macro}[EXP] +% { +% \exp_args:Nnc, \exp_args:Nno, \exp_args:NnV, \exp_args:Nnv, \exp_args:Nne, \exp_args:Nnf, +% \exp_args:Noc, \exp_args:Noo, \exp_args:Nof, +% \exp_args:NVo, \exp_args:Nfo, \exp_args:Nff, +% } +% \begin{macro} +% { +% \exp_args:NNx, \exp_args:Ncx, \exp_args:Nnx, +% \exp_args:Nox, \exp_args:Nxo, \exp_args:Nxx, +% } +% Here are the actual function definitions, using the helper +% functions above. The group is used because +% \cs{@@_generate_internal_variant:n} redefines \cs{@@_tmp:w} locally. +% \begin{macrocode} +\cs_set_protected:Npn \@@_tmp:w #1 + { + \group_begin: + \exp_args:No \@@_generate_internal_variant:n + { \tl_to_str:n {#1} } + \group_end: + } +\@@_tmp:w { nc } +\@@_tmp:w { no } +\@@_tmp:w { nV } +\@@_tmp:w { nv } +\@@_tmp:w { ne } +\@@_tmp:w { nf } +\@@_tmp:w { oc } +\@@_tmp:w { oo } +\@@_tmp:w { of } +\@@_tmp:w { Vo } +\@@_tmp:w { fo } +\@@_tmp:w { ff } +\@@_tmp:w { Nx } +\@@_tmp:w { cx } +\@@_tmp:w { nx } +\@@_tmp:w { ox } +\@@_tmp:w { xo } +\@@_tmp:w { xx } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP] +% { +% \exp_args:NNcf, +% \exp_args:NNno, \exp_args:NNnV, \exp_args:NNoo, \exp_args:NNVV, +% \exp_args:Ncno, \exp_args:NcnV, \exp_args:Ncoo, \exp_args:NcVV, +% \exp_args:Nnnc, \exp_args:Nnno, \exp_args:Nnnf, \exp_args:Nnff, +% \exp_args:Nooo, \exp_args:Noof, \exp_args:Nffo, +% } +% \begin{macro} +% { +% \exp_args:NNNx, \exp_args:NNnx, \exp_args:NNox, +% \exp_args:Nccx, \exp_args:Ncnx, +% \exp_args:Nnnx, \exp_args:Nnox, \exp_args:Noox, +% } +% \begin{macrocode} +\@@_tmp:w { Ncf } +\@@_tmp:w { Nno } +\@@_tmp:w { NnV } +\@@_tmp:w { Noo } +\@@_tmp:w { NVV } +\@@_tmp:w { cno } +\@@_tmp:w { cnV } +\@@_tmp:w { coo } +\@@_tmp:w { cVV } +\@@_tmp:w { nnc } +\@@_tmp:w { nno } +\@@_tmp:w { nnf } +\@@_tmp:w { nff } +\@@_tmp:w { ooo } +\@@_tmp:w { oof } +\@@_tmp:w { ffo } +\@@_tmp:w { NNx } +\@@_tmp:w { Nnx } +\@@_tmp:w { Nox } +\@@_tmp:w { nnx } +\@@_tmp:w { nox } +\@@_tmp:w { ccx } +\@@_tmp:w { cnx } +\@@_tmp:w { oox } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/macros/latex/contrib/l3kernel/l3file.dtx b/macros/latex/contrib/l3kernel/l3file.dtx index c40f61acbd..cea19957df 100644 --- a/macros/latex/contrib/l3kernel/l3file.dtx +++ b/macros/latex/contrib/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -271,6 +271,40 @@ % ignores any trailing new-line marker from the file it reads. % \end{function} % +% \begin{function}[added = 2019-01-13]{\ior_map_variable:NNn} +% \begin{syntax} +% \cs{ior_map_variable:NNn} \meta{stream} \meta{tl~var} \Arg{code} +% \end{syntax} +% For each set of \meta{lines} obtained by calling \cs{ior_get:NN} +% until reaching the end of the file, stores the \meta{lines} in the +% \meta{tl~var} then applies the \meta{code}. The \meta{code} will +% usually make use of the \meta{variable}, but this is not enforced. +% The assignments to the \meta{variable} are local. +% Its value after the loop is the last set of \meta{lines}, or its +% original value if the \meta{stream} is empty. \TeX{} ignores +% any trailing new-line marker from the file it reads. +% This function is typically faster than \cs{ior_map_inline:Nn}. +% \end{function} +% +% \begin{function}[added = 2019-01-13]{\ior_str_map_variable:NNn} +% \begin{syntax} +% \cs{ior_str_map_variable:NNn} \meta{stream} \meta{variable} \Arg{code} +% \end{syntax} +% For each \meta{line} in the \meta{stream}, stores the \meta{line} in +% the \meta{variable} then applies the \meta{code}. The material is +% read from the \meta{stream} as a series of tokens with category code +% $12$ (other), with the exception of space characters which are given +% category code $10$ (space). The \meta{code} will usually make use +% of the \meta{variable}, but this is not enforced. The assignments +% to the \meta{variable} are local. Its value after the loop is the +% last \meta{line}, or its original value if the \meta{stream} is +% empty. Note that \TeX{} removes trailing +% space and tab characters (character codes 32 and 9) from every line +% upon input. \TeX{} also ignores any trailing new-line marker from +% the file it reads. +% This function is typically faster than \cs{ior_str_map_inline:Nn}. +% \end{function} +% % \begin{function}[added = 2012-06-29]{\ior_map_break:} % \begin{syntax} % \cs{ior_map_break:} @@ -735,6 +769,28 @@ % This is not available in older versions of \XeTeX{}. % \end{function} % +% \begin{function}[added = 2019-05-13, updated = 2019-09-20, pTF, EXP] +% {\file_compare_timestamp:nNn} +% \begin{syntax} +% \cs{file_compare_timestamp:nNn} \Arg{file-1} \meta{comparator} \Arg{file-2} \Arg{true code} \Arg{false code} +% \end{syntax} +% Compares the file stamps on the two \meta{files} as indicated by +% the \meta{comparator}, and inserts either the \meta{true code} +% or \meta{false case} as required. A file which is not found +% is treated as older than any file which is found. This allows for +% example the construct +% \begin{verbatim} +% \file_compare_timestamp:nNnT { source-file } > { derived-file } +% { +% % Code to regenerate derived file +% } +% \end{verbatim} +% to work when the derived file is entirely absent. The timestamp +% of two absent files is regarded as different. +% This is not available in older versions of \XeTeX{}. +% \end{function} +% +% % \begin{function}[updated = 2017-06-26]{\file_input:n} % \begin{syntax} % \cs{file_input:n} \Arg{file name} @@ -2815,6 +2871,106 @@ % \end{macro} % \end{macro} % +% \begin{macro}[EXP]{\@@_str_cmp:nn} +% \begin{macro}[EXP]{\@@_str_escape:n} +% As we are doing a fixed-length \enquote{big} integer comparison, it +% is easiest to use the low-level behavior of string comparisons. +% \begin{macrocode} +\cs_new:Npn \@@_str_cmp:nn #1#2 { \tex_strcmp:D {#1} {#2} } +\sys_if_engine_luatex:T + { + \cs_set:Npn \@@_str_cmp:nn #1#2 + { + \lua_now:e + { + l3kernel.strcmp + ( + " \@@_str_escape:n {#1}", + " \@@_str_escape:n {#2}" + ) + } + } + \cs_new:Npn \@@_str_escape:n #1 + { + \lua_escape:e + { \__kernel_tl_to_str:w \use:e { {#1} } } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP, pTF]{\file_compare_timestamp:nNn} +% \begin{macro}[EXP]{\@@_compare_timestamp:nnN} +% \begin{macro}[EXP]{\@@_timestamp:n} +% Comparison of file date can be done by using the low-level nature of the +% string comparison functions. +% \begin{macrocode} +\prg_new_conditional:Npnn \file_compare_timestamp:nNn #1#2#3 + { p , T , F , TF } + { + \exp_args:Nee \@@_compare_timestamp:nnN + { \file_full_name:n {#1} } + { \file_full_name:n {#3} } + #2 + } +\cs_new:Npn \@@_compare_timestamp:nnN #1#2#3 + { + \tl_if_blank:nTF {#1} + { + \if_charcode:w #3 < + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + { + \tl_if_blank:nTF {#2} + { + \if_charcode:w #3 > + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + { + \if_int_compare:w + \@@_str_cmp:nn + { \@@_timestamp:n {#1} } + { \@@_timestamp:n {#2} } + #3 0 \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + } + } +\sys_if_engine_luatex:TF + { + \cs_new:Npn \@@_timestamp:n #1 + { + \lua_now:e + { l3kernel.filemoddate ( " \lua_escape:e {#1} " ) } + } + } + { \cs_new_eq:NN \@@_timestamp:n \tex_filemoddate:D } +\cs_if_exist:NF \tex_filemoddate:D + { + \prg_set_conditional:Npnn \file_compare_timestamp:nNn #1#2#3 + { p , T , F , TF } + { + \__kernel_msg_expandable_error:nnn + { kernel } { primitive-not-available } + { \(pdf)filemoddate } + \prg_return_false: + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}[TF]{\file_if_exist:n} % The test for the existence of a file is a wrapper around the function to % add a path to a file. If the file was found, the path contains @@ -3164,6 +3320,50 @@ } % \end{macrocode} % +% \subsection{Functions delayed from earlier modules} +% +%<@@=sys> +% +% \begin{variable}{\c_sys_platform_str} +% Detecting the platform on \LuaTeX{} is easy: for other engines, we use +% the fact that the two common cases have special null files. It is possible +% to probe further (see package \pkg{platform}), but that requires shell +% escape and seems unlikely to be useful. This is set up here as it requires +% file searching. +% \begin{macrocode} +\sys_if_engine_luatex:TF + { + \str_const:Nx \c_sys_platform_str + { \tex_directlua:D { tex.print(os.type) } } + } + { + \file_if_exist:nTF { nul: } + { + \file_if_exist:nF { /dev/null } + { \str_const:Nn \c_sys_platform_str { windows } } + } + { + \file_if_exist:nT { /dev/null } + { \str_const:Nn \c_sys_platform_str { unix } } + } + } +\cs_if_exist:NF \c_sys_platform_str + { \str_const:Nn \c_sys_platform_str { unknown } } +% \end{macrocode} +% \end{variable} +% \begin{macro}[pTF]{\sys_if_platform_unix:} +% \begin{macro}[pTF]{\sys_if_platform_windows:} +% We can now set up the tests. +% \begin{macrocode} +\clist_map_inline:nn { unix , windows } + { + \@@_const:nn { sys_if_platform_ #1 } + { \str_if_eq_p:Vn \c_sys_platform_str { #1 } } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3final.dtx b/macros/latex/contrib/l3kernel/l3final.dtx index 4519a4639b..21534789e3 100644 --- a/macros/latex/contrib/l3kernel/l3final.dtx +++ b/macros/latex/contrib/l3kernel/l3final.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3flag.dtx b/macros/latex/contrib/l3kernel/l3flag.dtx index 90e5a012bc..6f86d193c1 100644 --- a/macros/latex/contrib/l3kernel/l3flag.dtx +++ b/macros/latex/contrib/l3kernel/l3flag.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -198,8 +198,6 @@ % When the option \texttt{check-declarations} is used, check for the % function defined by \cs{flag_new:n}. % \begin{macrocode} -\__kernel_patch:nnNNpn - { \exp_args:Nc \__kernel_chk_var_exist:N { flag~#1 } } { } \cs_new_protected:Npn \flag_clear:n #1 { \@@_clear:wn 0 ; {#1} } \cs_new_protected:Npn \@@_clear:wn #1 ; #2 { @@ -244,29 +242,6 @@ % % \subsection{Expandable flag commands} % -% \begin{macro}[EXP]{\@@_chk_exist:n} -% Analogue of \cs{__kernel_chk_var_exist:N} for flags, and with an -% expandable error. We need to add checks by hand because flags are -% not implemented in terms of other variables. Not all functions need -% to be patched since some are defined in terms of others. -% \begin{macrocode} -%<*package> -\__kernel_if_debug:TF - { - \cs_new:Npn \@@_chk_exist:n #1 - { - \flag_if_exist:nF {#1} - { - \__kernel_msg_expandable_error:nnn - { kernel } { bad-variable } { flag~#1~ } - } - } - } - { } -%</package> -% \end{macrocode} -% \end{macro} -% % \begin{macro}[EXP, pTF]{\flag_if_exist:n} % A flag exist if the corresponding trap \cs[no-index]{flag \meta{flag % name}:n} is defined. @@ -282,7 +257,6 @@ % \begin{macro}[EXP, pTF]{\flag_if_raised:n} % Test if the flag has a non-zero height, by checking the |0| control sequence. % \begin{macrocode} -\__kernel_patch_conditional:nNNpnn { \@@_chk_exist:n {#1} } \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } { \if_cs_exist:w flag~#1~0 \cs_end: @@ -299,7 +273,6 @@ % Extract the value of the flag by going through all of the % control sequences starting from |0|. % \begin{macrocode} -\__kernel_patch:nnNNpn { \@@_chk_exist:n {#1} } { } \cs_new:Npn \flag_height:n #1 { \@@_height_loop:wn 0; {#1} } \cs_new:Npn \@@_height_loop:wn #1 ; #2 { diff --git a/macros/latex/contrib/l3kernel/l3format.ins b/macros/latex/contrib/l3kernel/l3format.ins index 35279ca592..bdc5516701 100644 --- a/macros/latex/contrib/l3kernel/l3format.ins +++ b/macros/latex/contrib/l3kernel/l3format.ins @@ -105,7 +105,7 @@ and all files in that bundle must be distributed together. \from{l3luatex.dtx} {initex,tex} \from{l3unicode.dtx} {initex} \from{l3candidates.dtx} {initex} - \from{l3deprecation.dtx}{initex} + \from{l3deprecation.dtx}{initex,kernel} % ======== FORMAT ONLY ========= \from{l3final.dtx} {initex} % ============================== @@ -131,6 +131,9 @@ and all files in that bundle must be distributed together. \file{l3str-enc-iso885916.def} {\from{l3str-convert.dtx}{iso885916}}% } +\generate{\file{l3debug.def}{\from{l3debug.dtx}{initex}}} +\generate{\file{l3deprecation.def}{\from{l3deprecation.dtx}{initex,patches}}} + \generate{\file{l3docstrip.tex}{\from{l3docstrip.dtx}{program}}} % Lua code (currently identical to the package-mode version) diff --git a/macros/latex/contrib/l3kernel/l3fp-assign.dtx b/macros/latex/contrib/l3kernel/l3fp-assign.dtx index 93ea9dedc8..6f65566c3e 100644 --- a/macros/latex/contrib/l3kernel/l3fp-assign.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-assign.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % \maketitle % % \begin{documentation} diff --git a/macros/latex/contrib/l3kernel/l3fp-aux.dtx b/macros/latex/contrib/l3kernel/l3fp-aux.dtx index 3402c4ed9b..a7cc9a2e95 100644 --- a/macros/latex/contrib/l3kernel/l3fp-aux.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-aux.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-basics.dtx b/macros/latex/contrib/l3kernel/l3fp-basics.dtx index 1d88df6736..03d127cc24 100644 --- a/macros/latex/contrib/l3kernel/l3fp-basics.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-basics.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-convert.dtx b/macros/latex/contrib/l3kernel/l3fp-convert.dtx index dfd052b843..cdf2868c81 100644 --- a/macros/latex/contrib/l3kernel/l3fp-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-convert.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -499,7 +499,6 @@ % performed by \cs{@@_mul_npos_o:Nww}, and cancelled by % \cs{prg_do_nothing:} here. % \begin{macrocode} -\__kernel_patch_args:nNNpn { { (#1) } } \cs_new:Npn \dim_to_fp:n #1 { \exp_after:wN \@@_from_dim_test:ww @@ -550,6 +549,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\fp_sign:n} +% Trivial but useful. See the implementation of \cs{fp_add:Nn} for an +% explanation of why to use \cs{@@_parse:n}, namely, for better error +% reporting. +% \begin{macrocode} +\cs_new:Npn \fp_sign:n #1 + { \fp_to_decimal:n { sign \@@_parse:n {#1} } } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[EXP]{\fp_abs:n} % Trivial but useful. See the implementation of \cs{fp_add:Nn} for an % explanation of why to use \cs{@@_parse:n}, namely, for better error diff --git a/macros/latex/contrib/l3kernel/l3fp-expo.dtx b/macros/latex/contrib/l3kernel/l3fp-expo.dtx index 81bb592dc0..eb764de3b8 100644 --- a/macros/latex/contrib/l3kernel/l3fp-expo.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-expo.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-extended.dtx b/macros/latex/contrib/l3kernel/l3fp-extended.dtx index a8e2dffa12..b716765b48 100644 --- a/macros/latex/contrib/l3kernel/l3fp-extended.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-extended.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-logic.dtx b/macros/latex/contrib/l3kernel/l3fp-logic.dtx index 9b63aec53b..7414c7d31c 100644 --- a/macros/latex/contrib/l3kernel/l3fp-logic.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-logic.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-parse.dtx b/macros/latex/contrib/l3kernel/l3fp-parse.dtx index aed0a3ada2..71258ad48c 100644 --- a/macros/latex/contrib/l3kernel/l3fp-parse.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-parse.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-random.dtx b/macros/latex/contrib/l3kernel/l3fp-random.dtx index 069b0cf360..64dc995c04 100644 --- a/macros/latex/contrib/l3kernel/l3fp-random.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-random.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-round.dtx b/macros/latex/contrib/l3kernel/l3fp-round.dtx index 9437f8e399..1ef386ad6e 100644 --- a/macros/latex/contrib/l3kernel/l3fp-round.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-round.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-traps.dtx b/macros/latex/contrib/l3kernel/l3fp-traps.dtx index 91b645d0ae..7e0cf605ee 100644 --- a/macros/latex/contrib/l3kernel/l3fp-traps.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-traps.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % \maketitle % % \begin{documentation} diff --git a/macros/latex/contrib/l3kernel/l3fp-trig.dtx b/macros/latex/contrib/l3kernel/l3fp-trig.dtx index 8927ab8978..f490649563 100644 --- a/macros/latex/contrib/l3kernel/l3fp-trig.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-trig.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp.dtx b/macros/latex/contrib/l3kernel/l3fp.dtx index fe50141119..4c0451d726 100644 --- a/macros/latex/contrib/l3kernel/l3fp.dtx +++ b/macros/latex/contrib/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -72,7 +72,7 @@ % negation $\mathop{!}x$, conjunction % $x\mathop{\&\&}y$, disjunction $x\mathop{\vert\vert}y$, ternary % operator $x\mathop{?}y\mathop{:}z$. -% \item Exponentials: $\exp x$, $\ln x$, $x^y$. +% \item Exponentials: $\exp x$, $\ln x$, $x^y$, $\operatorname{logb} x$. % \item Integer factorial: $\operatorname{fact} x$. % \item Trigonometry: $\sin x$, $\cos x$, $\tan x$, $\cot x$, $\sec % x$, $\csc x$ expecting their arguments in radians, and @@ -260,6 +260,18 @@ % This function is identical to \cs{fp_to_decimal:n}. % \end{function} % +% \begin{function}[EXP, added = 2018-11-03]{\fp_sign:n} +% \begin{syntax} +% \cs{fp_sign:n} \Arg{fpexpr} +% \end{syntax} +% Evaluates the \meta{fpexpr} and leaves its sign in the input stream +% using \cs{fp_eval:n} |{sign(|\meta{result}|)}|: $+1$ for positive +% numbers and for $+\infty$, $-1$ for negative numbers and for +% $-\infty$, $\pm 0$ for $\pm 0$. If the operand is a tuple or is +% \nan{}, then \enquote{invalid operation} occurs and the result +% is~$0$. +% \end{function} +% % \begin{function}[EXP, added = 2012-05-08, updated = 2012-07-08] % {\fp_to_decimal:N, \fp_to_decimal:c, \fp_to_decimal:n} % \begin{syntax} @@ -1065,6 +1077,19 @@ % operation} occurs. % \end{function} % +% \begin{function}[EXP, added = 2018-11-03]{logb} +% \begin{syntax} +% \cs{fp_eval:n} \{ |logb(| \meta{fpexpr} |)| \} +% \end{syntax} +% Determines the exponent of the \meta{fpexpr}, namely the floor of +% the base-$10$ logarithm of its absolute value. \enquote{Division by +% zero} occurs when evaluating $\operatorname{logb}(\pm 0) = -\infty$. +% Other special values are $\operatorname{logb}(\pm\infty)=+\infty$ +% and $\operatorname{logb}(\nan{})=\nan{}$. If the operand is a tuple +% or is \nan{}, then \enquote{invalid operation} occurs and the result +% is \nan{}. +% \end{function} +% % \begin{function}[tested = m3fp-logic002]{max, min} % \begin{syntax} % \cs{fp_eval:n} \{ |max(| \meta{fpexpr_1} |,| \meta{fpexpr_2} |,| \ldots{} |)| \} diff --git a/macros/latex/contrib/l3kernel/l3fparray.dtx b/macros/latex/contrib/l3kernel/l3fparray.dtx index 6238ad6ddd..4dcf58decf 100644 --- a/macros/latex/contrib/l3kernel/l3fparray.dtx +++ b/macros/latex/contrib/l3kernel/l3fparray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -58,8 +58,55 @@ % close to that of \pkg{l3intarray}. The size of the array is fixed and % must be given at point of initialisation % -% Currently \emph{all} functions in this module are candidates. Their -% documentation can be found in \pkg{l3candidates}. +% \begin{function}[added = 2018-05-05]{\fparray_new:Nn} +% \begin{syntax} +% \cs{fparray_new:Nn} \meta{fparray~var} \Arg{size} +% \end{syntax} +% Evaluates the integer expression \meta{size} and allocates an +% \meta{floating point array variable} with that number of (zero) +% entries. The variable name should start with |\g_| because +% assignments are always global. +% \end{function} +% +% \begin{function}[EXP, added = 2018-05-05]{\fparray_count:N} +% \begin{syntax} +% \cs{fparray_count:N} \meta{fparray~var} +% \end{syntax} +% Expands to the number of entries in the \meta{floating point array +% variable}. This is performed in constant time. +% \end{function} +% +% \begin{function}[added = 2018-05-05]{\fparray_gset:Nnn} +% \begin{syntax} +% \cs{fparray_gset:Nnn} \meta{fparray~var} \Arg{position} \Arg{value} +% \end{syntax} +% Stores the result of evaluating the floating point expression +% \meta{value} into the \meta{floating point array variable} at the +% (integer expression) \meta{position}. If the \meta{position} is not +% between $1$ and the \cs{fparray_count:N}, an error occurs. +% Assignments are always global. +% \end{function} +% +% \begin{function}[added = 2018-05-05]{\fparray_gzero:N} +% \begin{syntax} +% \cs{fparray_gzero:N} \meta{fparray~var} +% \end{syntax} +% Sets all entries of the \meta{floating point array variable} to +% $+0$. Assignments are always global. +% \end{function} +% +% \begin{function}[EXP, added = 2018-05-05] +% {\fparray_item:Nn, \fparray_item_to_tl:Nn} +% \begin{syntax} +% \cs{fparray_item:Nn} \meta{fparray~var} \Arg{position} +% \end{syntax} +% Applies \cs{fp_use:N} or \cs{fp_to_tl:N} (respectively) to the +% floating point entry stored at the (integer expression) +% \meta{position} in the \meta{floating point array variable}. If the +% \meta{position} is not between $1$ and the \cs{fparray_count:N}, an +% error occurs. +% \end{function} + % % \end{documentation} % @@ -102,7 +149,8 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\fparray_new:Nn, \@@_array_new:nNNN} +% \begin{macro}{\fparray_new:Nn, \fparray_new:cn} +% \begin{macro}{\@@_array_new:nNNN} % Build a three token token list, then define all three tokens to be % integer arrays of the same size. No need to initialize the data: % the integer arrays start with zeros, and three zeros denote @@ -120,6 +168,7 @@ \exp_last_unbraced:Nfo \@@_array_new:nNNNN { \int_eval:n {#2} } #1 #1 } +\cs_generate_variant:Nn \fparray_new:Nn { c } \cs_new_protected:Npn \@@_array_new:nNNNN #1#2#3#4#5 { \int_compare:nNnTF {#1} < 0 @@ -136,8 +185,9 @@ } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}[EXP]{\fparray_count:N} +% \begin{macro}[EXP]{\fparray_count:N, \fparray_count:c} % Size of any of the intarrays, here we pick the third. % \begin{macrocode} \cs_new:Npn \fparray_count:N #1 @@ -145,6 +195,7 @@ \exp_after:wN \use_i:nnn \exp_after:wN \intarray_count:N #1 } +\cs_generate_variant:Nn \fparray_count:N { c } % \end{macrocode} % \end{macro} % @@ -178,9 +229,10 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\fparray_gset:Nnn, \fparray_gset:cnn} % \begin{macro} % { -% \fparray_gset:Nnn, \@@_array_gset:NNNNww, \@@_array_gset:w, +% \@@_array_gset:NNNNww, \@@_array_gset:w, % \@@_array_gset_recover:Nw, \@@_array_gset_special:nnNNN, % \@@_array_gset_normal:w % } @@ -196,6 +248,7 @@ \int_value:w \int_eval:n {#2} \exp_after:wN ; \exp:w \exp_end_continue_f:w \@@_parse:n {#3} } +\cs_generate_variant:Nn \fparray_gset:Nnn { c } \cs_new_protected:Npn \@@_array_gset:NNNNww #1#2#3#4#5 ; #6 ; { \@@_array_bounds:NNnTF \__kernel_msg_error:nnxxx #4 {#5} @@ -239,8 +292,9 @@ } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\fparray_gzero:N} +% \begin{macro}{\fparray_gzero:N, \fparray_gzero:c} % \begin{macrocode} \cs_new_protected:Npn \fparray_gzero:N #1 { @@ -254,13 +308,19 @@ #1 } } +\cs_generate_variant:Nn \fparray_gzero:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP] % { % \fparray_item:Nn, +% \fparray_item:cn, % \fparray_item_to_tl:Nn, +% \fparray_item_to_tl:cn, +% } +% \begin{macro}[EXP] +% { % \@@_array_item:NwN, % \@@_array_item:NNNnN, % \@@_array_item:N, @@ -276,6 +336,7 @@ \int_value:w \int_eval:n {#2} ; \@@_to_decimal:w } +\cs_generate_variant:Nn \fparray_item:Nn { c } \cs_new:Npn \fparray_item_to_tl:Nn #1#2 { \exp_after:wN \@@_array_item:NwN @@ -283,6 +344,7 @@ \int_value:w \int_eval:n {#2} ; \@@_to_tl:w } +\cs_generate_variant:Nn \fparray_item_to_tl:Nn { c } \cs_new:Npn \@@_array_item:NwN #1#2 ; #3 { \@@_array_bounds:NNnTF \__kernel_msg_expandable_error:nnfff #1 {#2} @@ -323,6 +385,7 @@ { #9 \s_@@ \@@_chk:w 1 #1 {#8} #7 {#2#3#4#5} {#6} ; } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macrocode} %</initex|package> diff --git a/macros/latex/contrib/l3kernel/l3int.dtx b/macros/latex/contrib/l3kernel/l3int.dtx index 1cd7e62c93..042f4d656c 100644 --- a/macros/latex/contrib/l3kernel/l3int.dtx +++ b/macros/latex/contrib/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -134,6 +134,14 @@ % since the digit~\texttt{9} is not part of the expression. % \end{function} % +% \begin{function}[EXP, added = 2018-11-03]{\int_sign:n} +% \begin{syntax} +% \cs{int_sign:n} \Arg{intexpr} +% \end{syntax} +% Evaluates the \meta{integer expression} then leaves $1$ or $0$ or +% $-1$ in the input stream according to the sign of the result. +% \end{function} +% % \begin{function}[EXP, updated = 2012-09-26]{\int_abs:n} % \begin{syntax} % \cs{int_abs:n} \Arg{integer expression} @@ -1053,8 +1061,6 @@ % or directly in the input stream. % When debugging, use parentheses to catch early termination. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_eval:n } } \cs_new:Npn \int_eval:n #1 { \int_value:w \@@_eval:w #1 \@@_eval_end: } \cs_new:Npn \int_eval:w { \int_value:w \@@_eval:w } @@ -1062,6 +1068,31 @@ % \end{macro} % \end{macro} % +% \begin{macro}[EXP]{\int_sign:n, \@@_sign:Nw} +% See \cs{int_abs:n}. Evaluate the expression once (and when +% debugging is enabled, check that the expression is well-formed), +% then test the first character to determine the sign. This is +% wrapped in \cs{int_value:w} \ldots{} \cs{exp_stop_f:} to ensure a +% fixed number of expansions and to avoid dealing with closing the +% conditionals. +% \begin{macrocode} +\cs_new:Npn \int_sign:n #1 + { + \int_value:w \exp_after:wN \@@_sign:Nw + \int_value:w \@@_eval:w #1 \@@_eval_end: ; + \exp_stop_f: + } +\cs_new:Npn \@@_sign:Nw #1#2 ; + { + \if_meaning:w 0 #1 + 0 + \else: + \if_meaning:w - #1 - \fi: 1 + \fi: + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[EXP]{\int_abs:n} % \begin{macro}[EXP]{\@@_abs:N} % \UnitTested @@ -1074,8 +1105,6 @@ % evaluation. The absolute value is obtained by removing a leading % sign if any. All three functions expand in two steps. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_abs:n } } \cs_new:Npn \int_abs:n #1 { \int_value:w \exp_after:wN \@@_abs:N @@ -1084,11 +1113,6 @@ } \cs_new:Npn \@@_abs:N #1 { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } -\__kernel_patch_args:nNNpn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_max:nn } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \int_max:nn } - } \cs_set:Npn \int_max:nn #1#2 { \int_value:w \exp_after:wN \@@_maxmin:wwN @@ -1097,11 +1121,6 @@ > \exp_stop_f: } -\__kernel_patch_args:nNNpn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_min:nn } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \int_min:nn } - } \cs_set:Npn \int_min:nn #1#2 { \int_value:w \exp_after:wN \@@_maxmin:wwN @@ -1146,11 +1165,6 @@ % truncating behaviour that we want. The details are thanks to Heiko % Oberdiek: getting things right in all cases is not so easy. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_div_truncate:nn } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \int_div_truncate:nn } - } \cs_new:Npn \int_div_truncate:nn #1#2 { \int_value:w \@@_eval:w @@ -1180,11 +1194,6 @@ % \end{macrocode} % Finally there's the modulus operation. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_mod:nn } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \int_mod:nn } - } \cs_new:Npn \int_mod:nn #1#2 { \int_value:w \@@_eval:w \exp_after:wN \@@_mod:ww @@ -1254,10 +1263,6 @@ % We cannot use \cs{int_gset:Nn} because (when |check-declarations| is % enabled) this runs some checks that constants would fail. % \begin{macrocode} -\__kernel_patch_args:nnnNNpn - { \__kernel_chk_var_scope:NN c #1 } - { } - { {#1} { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \int_const:Nn } } \cs_new_protected:Npn \int_const:Nn #1#2 { \int_compare:nNnTF {#2} < \c_zero_int @@ -1303,9 +1308,7 @@ % \UnitTested % Functions that reset an \meta{integer} register to zero. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \int_zero:N #1 { #1 = \c_zero_int } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \int_gzero:N #1 { \tex_global:D #1 = \c_zero_int } \cs_generate_variant:Nn \int_zero:N { c } \cs_generate_variant:Nn \int_gzero:N { c } @@ -1335,10 +1338,8 @@ % another. Check that assigned integer is local/global. No need to % check that the other one is defined as \TeX{} does it for us. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \int_set_eq:NN #1#2 { #1 = #2 } \cs_generate_variant:Nn \int_set_eq:NN { c , Nc , cc } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \int_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \int_gset_eq:NN { c , Nc , cc } % \end{macrocode} @@ -1357,22 +1358,6 @@ % % \subsection{Setting and incrementing integers} % -% Several functions here have a signature |:Nn| and are such that when -% debugging, the first argument should be checked to be a local/global -% variable and the second should be wrapped in code for an expression. -% The temporary function \cs{@@_tmp:w} finds the name |#3| of the -% function being redefined and writes the appropriate patch. -% \begin{macrocode} -\cs_set_protected:Npn \@@_tmp:w #1#2#3 - { - \__kernel_patch_args:nnnNNpn - { #1 ##1 } - { } - { {##1} { \__kernel_chk_expr:nNnN {##2} \@@_eval:w { } #3 } } - #2 #3 - } -% \end{macrocode} -% % \begin{macro}{\int_add:Nn, \int_add:cn} % \UnitTested % \begin{macro}{\int_gadd:Nn, \int_gadd:cn} @@ -1381,21 +1366,14 @@ % \UnitTested % \begin{macro}{\int_gsub:Nn, \int_gsub:cn} % \UnitTested -% Adding and subtracting to and from a counter. For each function, -% the debugging code produced by \cs{@@_tmp:w} checks that the -% assigned variable is correctly local/global and wraps the -% expression in some checking code. +% Adding and subtracting to and from a counter. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \int_add:Nn #1#2 { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \int_sub:Nn #1#2 { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \int_gadd:Nn #1#2 { \tex_global:D \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \int_gsub:Nn #1#2 { \tex_global:D \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } \cs_generate_variant:Nn \int_add:Nn { c } @@ -1419,16 +1397,12 @@ % Incrementing and decrementing of integer registers is done with % the following functions. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \int_incr:N #1 { \tex_advance:D #1 \c_one_int } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \int_decr:N #1 { \tex_advance:D #1 - \c_one_int } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \int_gincr:N #1 { \tex_global:D \tex_advance:D #1 \c_one_int } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \int_gdecr:N #1 { \tex_global:D \tex_advance:D #1 - \c_one_int } \cs_generate_variant:Nn \int_incr:N { c } @@ -1446,14 +1420,10 @@ % \begin{macro}{\int_gset:Nn, \int_gset:cn} % \UnitTested % As integers are register-based \TeX{} issues an error -% if they are not defined. Thus there is no need to check their -% existence as for token list variables. However, the code that -% checks whether the assignment is local or global is still needed. +% if they are not defined. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \int_set:Nn #1#2 { #1 ~ \@@_eval:w #2 \@@_eval_end: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \int_gset:Nn #1#2 { \tex_global:D #1 ~ \@@_eval:w #2 \@@_eval_end: } \cs_generate_variant:Nn \int_set:Nn { c } @@ -1657,12 +1627,6 @@ % \UnitTested % More efficient but less natural in typing. % \begin{macrocode} -\__kernel_patch_conditional_args:nNNpnn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_compare:nNn } - { \@@_eval_end: #2 } - { \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } \int_compare:nNn } - } \prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF } { \if_int_compare:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end: @@ -1722,8 +1686,6 @@ % \UnitTested % A predicate function. % \begin{macrocode} -\__kernel_patch_conditional_args:nNNpnn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_if_odd:n } } \prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF} { \if_int_odd:w \@@_eval:w #1 \@@_eval_end: @@ -1732,8 +1694,6 @@ \prg_return_false: \fi: } -\__kernel_patch_conditional_args:nNNpnn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \int_if_even:n } } \prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF} { \reverse_if:N \if_int_odd:w \@@_eval:w #1 \@@_eval_end: @@ -1851,21 +1811,6 @@ % step size of zero before checking the sign, but we optimize for the % most frequent case (positive step). % \begin{macrocode} -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } - \int_step_function:nnnN - } - { - \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } - \int_step_function:nnnN - } - { - \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } - \int_step_function:nnnN - } - } \cs_new:Npn \int_step_function:nnnN #1#2#3 { \exp_after:wN \@@_step:wwwN @@ -2594,6 +2539,17 @@ % \end{variable} % \end{variable} % +% \subsection{Integers for earlier modules} +% +%<@@=seq> +% +% \begin{variable}{\l_@@_internal_a_int, \l_@@_internal_b_int} +% \begin{macrocode} +\int_new:N \l_@@_internal_a_int +\int_new:N \l_@@_internal_b_int +% \end{macrocode} +% \end{variable} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3intarray.dtx b/macros/latex/contrib/l3kernel/l3intarray.dtx index 7365c9e0b8..8b998f6e0e 100644 --- a/macros/latex/contrib/l3kernel/l3intarray.dtx +++ b/macros/latex/contrib/l3kernel/l3intarray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -66,7 +66,7 @@ % The use of \texttt{intarray} data is therefore recommended for cases where % the need for fast access is of paramount importance. % -% \begin{function}[added = 2018-03-29]{\intarray_new:Nn} +% \begin{function}[added = 2018-03-29]{\intarray_new:Nn, \intarray_new:cn} % \begin{syntax} % \cs{intarray_new:Nn} \meta{intarray~var} \Arg{size} % \end{syntax} @@ -76,7 +76,7 @@ % always global. % \end{function} % -% \begin{function}[EXP, added = 2018-03-29]{\intarray_count:N} +% \begin{function}[EXP, added = 2018-03-29]{\intarray_count:N, \intarray_count:c} % \begin{syntax} % \cs{intarray_count:N} \meta{intarray~var} % \end{syntax} @@ -84,7 +84,7 @@ % Contrarily to \cs{seq_count:N} this is performed in constant time. % \end{function} % -% \begin{function}[added = 2018-03-29]{\intarray_gset:Nnn} +% \begin{function}[added = 2018-03-29]{\intarray_gset:Nnn, \intarray_gset:cnn} % \begin{syntax} % \cs{intarray_gset:Nnn} \meta{intarray~var} \Arg{position} \Arg{value} % \end{syntax} @@ -96,7 +96,18 @@ % global. % \end{function} % -% \begin{function}[added = 2018-05-04]{\intarray_gzero:N} +% \begin{function}[added = 2018-05-04] +% {\intarray_const_from_clist:Nn, \intarray_const_from_clist:cn} +% \begin{syntax} +% \cs{intarray_const_from_clist:Nn} \meta{intarray~var} \meta{intexpr clist} +% \end{syntax} +% Creates a new constant \meta{integer array variable} or raises an +% error if the name is already taken. The \meta{integer array +% variable} is set (globally) to contain as its items the results of +% evaluating each \meta{integer expression} in the \meta{comma list}. +% \end{function} +% +% \begin{function}[added = 2018-05-04]{\intarray_gzero:N, \intarray_gzero:c} % \begin{syntax} % \cs{intarray_gzero:N} \meta{intarray~var} % \end{syntax} @@ -104,7 +115,7 @@ % Assignments are always global. % \end{function} % -% \begin{function}[EXP, added = 2018-03-29]{\intarray_item:Nn} +% \begin{function}[EXP, added = 2018-03-29]{\intarray_item:Nn, \intarray_item:cn} % \begin{syntax} % \cs{intarray_item:Nn} \meta{intarray~var} \Arg{position} % \end{syntax} @@ -114,7 +125,8 @@ % error occurs. % \end{function} % -% \begin{function}[EXP, added = 2018-05-05]{\intarray_rand_item:N} +% \begin{function}[EXP, added = 2018-05-05] +% {\intarray_rand_item:N, \intarray_rand_item:c} % \begin{syntax} % \cs{intarray_rand_item:N} \meta{intarray~var} % \end{syntax} @@ -122,6 +134,16 @@ % \meta{integer array} is empty, produce an error. % \end{function} % +% \begin{function}[added = 2018-05-04] +% {\intarray_show:N, \intarray_show:c, \intarray_log:N, \intarray_log:c} +% \begin{syntax} +% \cs{intarray_show:N} \meta{intarray~var} +% \cs{intarray_log:N} \meta{intarray~var} +% \end{syntax} +% Displays the items in the \meta{integer array variable} in the +% terminal or writes them in the log file. +% \end{function} +% % \subsection{Implementation notes} % % It is a wrapper around the \tn{fontdimen} primitive, used to store @@ -187,7 +209,8 @@ { Size~of~array~may~not~be~negative:~#1 } % \end{macrocode} % -% \begin{macro}{\intarray_new:Nn, \@@_new:N} +% \begin{macro}{\intarray_new:Nn, \intarray_new:cn} +% \begin{macro}{\@@_new:N} % Declare |#1| to be a font (arbitrarily |cmr10| at a never-used % size). Store the array's size as the \tn{hyphenchar} of that font % and make sure enough \tn{fontdimen} are allocated, by setting the @@ -207,7 +230,6 @@ \int_step_inline:nn { 8 } { \__kernel_intarray_gset:Nnn #1 {##1} \c_zero_int } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN g #1 } { } \cs_new_protected:Npn \intarray_new:Nn #1#2 { \@@_new:N #1 @@ -220,13 +242,16 @@ \int_compare:nNnT { \intarray_count:N #1 } > 0 { \__kernel_intarray_gset:Nnn #1 { \intarray_count:N #1 } { 0 } } } +\cs_generate_variant:Nn \intarray_new:Nn { c } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}[EXP]{\intarray_count:N} +% \begin{macro}[EXP]{\intarray_count:N, \intarray_count:c} % Size of an array. % \begin{macrocode} \cs_new:Npn \intarray_count:N #1 { \int_value:w \@@_count:w #1 } +\cs_generate_variant:Nn \intarray_count:N { c } % \end{macrocode} % \end{macro} % @@ -268,7 +293,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\intarray_gset:Nnn, \__kernel_intarray_gset:Nnn} +% \begin{macro}{\intarray_gset:Nnn, \intarray_gset:cnn, \__kernel_intarray_gset:Nnn} % \begin{macro}{\@@_gset:Nnn, \@@_gset_overflow:Nnn} % Set the appropriate \tn{fontdimen}. The % \cs{__kernel_intarray_gset:Nnn} function does not use @@ -285,6 +310,7 @@ \int_value:w \int_eval:n {#2} \exp_after:wN ; \int_value:w \int_eval:n {#3} ; } +\cs_generate_variant:Nn \intarray_gset:Nnn { c } \cs_new_protected:Npn \@@_gset:Nww #1#2 ; #3 ; { \@@_bounds:NNnTF \__kernel_msg_error:nnxxx #1 {#2} @@ -321,7 +347,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\intarray_gzero:N} +% \begin{macro}{\intarray_gzero:N, \intarray_gzero:c} % Set the appropriate \tn{fontdimen} to zero. No bound checking % needed. The \cs{prg_replicate:nn} possibly uses quite a lot of % memory, but this is somewhat comparable to the size of the array, @@ -336,10 +362,11 @@ \@@_entry:w \l_@@_loop_int #1 \c_zero_dim } } +\cs_generate_variant:Nn \intarray_gzero:N { c } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\intarray_item:Nn, \__kernel_intarray_item:Nn} +% \begin{macro}[EXP]{\intarray_item:Nn, \intarray_item:cn, \__kernel_intarray_item:Nn} % \begin{macro}{\@@_item:Nn} % Get the appropriate \tn{fontdimen} and perform bound checks. The % \cs{__kernel_intarray_item:Nn} function omits bound checks and omits @@ -354,6 +381,7 @@ \exp_after:wN #1 \int_value:w \int_eval:n {#2} ; } +\cs_generate_variant:Nn \intarray_item:Nn { c } \cs_new:Npn \@@_item:Nw #1#2 ; { \@@_bounds:NNnTF \__kernel_msg_expandable_error:nnfff #1 {#2} @@ -364,21 +392,19 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\intarray_rand_item:N} +% \begin{macro}{\intarray_rand_item:N, \intarray_rand_item:c} % Importantly, \cs{intarray_item:Nn} only evaluates its argument once. % \begin{macrocode} \cs_new:Npn \intarray_rand_item:N #1 { \intarray_item:Nn #1 { \int_rand:n { \intarray_count:N #1 } } } +\cs_generate_variant:Nn \intarray_rand_item:N { c } % \end{macrocode} % \end{macro} % % \subsection{Working with contents of integer arrays} % -% At the time of writing these are candidates, but we need at least -% \cs{intarray_const_from_clist:Nn} in \pkg{l3fp} so before -% \pkg{l3candidates}. -% -% \begin{macro}{\intarray_const_from_clist:Nn, \@@_const_from_clist:nN} +% \begin{macro}{\intarray_const_from_clist:Nn, \intarray_const_from_clist:cn} +% \begin{macro}{\@@_const_from_clist:nN} % Similar to \cs{intarray_new:Nn} (which we don't use because when % debugging is enabled that function checks the variable name starts % with |g_|). We make use of the fact that \TeX{} allows allocation @@ -388,7 +414,6 @@ % big, namely \cs{@@_gset_overflow_test:nw}, but not the code that % checks bounds. At the end, set the size of the intarray. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } \cs_new_protected:Npn \intarray_const_from_clist:Nn #1#2 { \@@_new:N #1 @@ -397,6 +422,7 @@ { \exp_args:Nf \@@_const_from_clist:nN { \int_eval:n {##1} } #1 } \@@_count:w #1 \l_@@_loop_int } +\cs_generate_variant:Nn \intarray_const_from_clist:Nn { c } \cs_new_protected:Npn \@@_const_from_clist:nN #1#2 { \int_incr:N \l_@@_loop_int @@ -405,13 +431,16 @@ } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}[rEXP]{\intarray_to_clist:N, \@@_to_clist:Nn, \@@_to_clist:w} +% \begin{macro}[rEXP]{\intarray_to_clist:N, \intarray_to_clist:c} +% \begin{macro}[rEXP]{\@@_to_clist:Nn, \@@_to_clist:w} % Loop through the array, putting a comma before each item. Remove % the leading comma with |f|-expansion. We also use the auxiliary in % \cs{intarray_show:N} with argument comma, space. % \begin{macrocode} \cs_new:Npn \intarray_to_clist:N #1 { \@@_to_clist:Nn #1 { , } } +\cs_generate_variant:Nn \intarray_to_clist:N { c } \cs_new:Npn \@@_to_clist:Nn #1#2 { \int_compare:nNnF { \intarray_count:N #1 } = \c_zero_int @@ -431,8 +460,9 @@ } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\intarray_show:N, \intarray_log:N} +% \begin{macro}{\intarray_show:N, \intarray_show:c, \intarray_log:c, \intarray_log:N} % Convert the list to a comma list (with spaces after each comma) % \begin{macrocode} \cs_new_protected:Npn \intarray_show:N { \@@_show:NN \msg_show:nnxxxx } @@ -455,10 +485,10 @@ % % \subsection{Random arrays} % +% \begin{macro}{\intarray_gset_rand:Nn, \intarray_gset_rand:cn} +% \begin{macro}{\intarray_gset_rand:Nnn, \intarray_gset_rand:cnn} % \begin{macro} % { -% \intarray_gset_rand:Nn, -% \intarray_gset_rand:Nnn, % \@@_gset_rand:Nnn, % \@@_gset_rand:Nff, % \@@_gset_rand_auxi:Nnnn, @@ -479,6 +509,7 @@ % \begin{macrocode} \cs_new_protected:Npn \intarray_gset_rand:Nn #1 { \intarray_gset_rand:Nnn #1 { 1 } } +\cs_generate_variant:Nn \intarray_gset_rand:Nn { c } \sys_if_rand_exist:TF { \cs_new_protected:Npn \intarray_gset_rand:Nnn #1#2#3 @@ -542,8 +573,11 @@ { \intarray_gset_rand:Nnn #1 {#2} {#3} } } } +\cs_generate_variant:Nn \intarray_gset_rand:Nnn { c } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macrocode} %</initex|package> diff --git a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx index 507546fa2d..e5b0ce80cd 100644 --- a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx +++ b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -90,43 +90,6 @@ % purposes. % \end{function} % -% \begin{function}{\__kernel_chk_var_exist:N} -% \begin{syntax} -% \cs{__kernel_chk_var_exist:N} \meta{var} -% \end{syntax} -% This function is only created if debugging is enabled. It checks -% that \meta{var} is defined according to the criteria for -% \cs{cs_if_exist_p:N}, and if not raises a kernel-level error. -% \end{function} -% -% \begin{function}{\__kernel_chk_var_scope:NN} -% \begin{syntax} -% \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var} -% \end{syntax} -% Checks the \meta{var} has the correct \meta{scope}, and if not -% raises a kernel-level error. This function is only created if -% debugging is enabled. The \meta{scope} is a single letter |l|, |g|, -% |c| denoting local variables, global variables, or constants. More -% precisely, if the variable name starts with a letter and an -% underscore (normal \pkg{expl3} convention) the function checks that -% this single letter matches the \meta{scope}. Otherwise the function -% cannot know the scope \meta{var} the first time: instead, it defines -% |\__debug_chk_/|\meta{var name} to store that information for the -% next call. Thus, if a given \meta{var} is subject to assignments of -% different scopes a kernel error will result. -% \end{function} -% -% \begin{function}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N} -% \begin{syntax} -% \cs{__kernel_chk_var_local:N} \meta{var} -% \cs{__kernel_chk_var_global:N} \meta{var} -% \end{syntax} -% Applies \cs{__kernel_chk_var_exist:N} \meta{var}, and assuming that is -% true applies -% \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var}, where -% \meta{scope} is |l| or~|g|. -% \end{function} -% % \begin{function}{\__kernel_cs_parm_from_arg_count:nnF} % \begin{syntax} % \cs{__kernel_cs_parm_from_arg_count:nnF} \Arg{follow-on} \Arg{args} \Arg{false code} @@ -146,28 +109,6 @@ % such that they can be exchanged by \cs{debug_on:} and \cs{debug_off:}. % \end{function} % -% \begin{function}{\__kernel_if_debug:TF} -% \begin{syntax} -% \cs{__kernel_if_debug:TF} \Arg{true code} \Arg{false code} -% \end{syntax} -% Runs the \meta{true code} if debugging is enabled, namely only in -% \LaTeXe{} package mode with one of the options -% \texttt{check-declarations}, \texttt{enable-debug}, or -% \texttt{log-functions}. Otherwise runs the \meta{false code}. The -% |T| and |F| variants are not provided for this low-level -% conditional. -% \end{function} -% -% \begin{function}{\__kernel_debug_log:x} -% \begin{syntax} -% \cs{__kernel_debug_log:x} \Arg{message text} -% \end{syntax} -% If the \texttt{log-functions} option is active, this function writes -% the \meta{message text} to the log file using \cs{iow_log:x}. -% Otherwise, the \meta{message text} is ignored using \cs{use_none:n}. -% This function is only created if debugging is enabled. -% \end{function} -% % \begin{function}[EXP]{\__kernel_exp_not:w} % \begin{syntax} % \cs{__kernel_exp_not:w} \meta{expandable tokens} \Arg{content} @@ -378,69 +319,6 @@ % be much shorter than a line, otherwise it is cropped. % \end{function} % -% \begin{function}{\__kernel_patch:nnNNpn} -% \begin{syntax} -% \cs{__kernel_patch:nnNNpn} \Arg{before} \Arg{after} -% \meta{definition} \meta{function} \meta{parameters} \Arg{code} -% \end{syntax} -% If debugging is not enabled, this function ignores the \meta{before} -% and \meta{after} code and performs the \meta{definition} with no -% patching. Otherwise it replaces \meta{code} by \meta{before} -% \meta{code} \meta{after} (which can involve |#1| and so on) in the -% \meta{definition} that follows. The \meta{definition} must start -% with \cs{cs_new:Npn} or \cs{cs_set:Npn} or \cs{cs_gset:Npn} or their -% \texttt{_protected} counterparts. Other cases can be added as -% needed. -% \end{function} -% -% \begin{function}{\__kernel_patch_conditional:nNNpnn} -% \begin{syntax} -% \cs{__kernel_patch_conditional:nNNpnn} \Arg{before} -% \meta{definition} \meta{conditional} \meta{parameters} \Arg{type} \Arg{code} -% \end{syntax} -% Similar to \cs{__kernel_patch:nnNNpn} for conditionals, namely -% \meta{definition} must be \cs{prg_new_conditional:Npnn} or its -% \texttt{_protected} counterpart. There is no \meta{after} code -% because that would interfere with the action of the conditional. -% \end{function} -% -% \begin{function} -% {\__kernel_patch_args:nNNpn, \__kernel_patch_conditional_args:nNNpnn} -% \begin{syntax} -% \cs{__kernel_patch_args:nNNpn} \Arg{arguments} -% \meta{definition} \meta{function} \meta{parameters} \Arg{code} -% \end{syntax} -% Like \cs{__kernel_patch:nnNNpn}, this tweaks the following -% definition, but from the \enquote{inside out} (and if debugging is -% not enabled, the \meta{arguments} are ignored). It replaces |#1|, -% |#2| and so on in the \meta{code} of the definition as indicated by -% the \meta{arguments}. More precisely, a temporary function is -% defined using the \meta{definition} with the \meta{parameters} and -% \meta{code}, then the result of expanding that function once in -% front of the \meta{arguments} is used instead of the \meta{code} -% when defining the actual function. For instance, -% \begin{quote} -% \cs{__kernel_patch_args:nNNpn} |{ { (#1) } }| \\ -% \cs{cs_new:Npn} \cs{int_eval:n} |#1| \\ -% ~~|{ \int_value:w \__int_eval:w #1 \__int_eval_end: }| -% \end{quote} -% would replace |#1| by |(#1)| in the definition of \cs{int_eval:n} when -% debugging is enabled. This fails if the \meta{code} contains~|##|. -% The \cs{__kernel_patch_conditional_args:nNNpnn} function is for use -% before \cs{prg_new_conditional:Npnn} or its \texttt{_protected} -% counterpart. -% \end{function} -% -% \begin{function} -% {\__kernel_patch_args:nnnNNpn, \__kernel_patch_conditional_args:nnnNNpnn} -% \begin{syntax} -% \cs{__kernel_patch_args:nnnNNpn} \Arg{before} \Arg{after} \Arg{arguments} -% \meta{definition} \meta{function} \meta{parameters} \Arg{code} -% \end{syntax} -% A combination of \cs{__kernel_patch:nnNNpn} and -% \cs{__kernel_patch_args:nNNpn}. -% \end{function} -% % \begin{variable}{\g__kernel_prg_map_int} % This integer is used by non-expandable mapping functions to track % the level of nesting in force. The functions diff --git a/macros/latex/contrib/l3kernel/l3keys.dtx b/macros/latex/contrib/l3kernel/l3keys.dtx index f2ddc9f2c1..a7097c3d5b 100644 --- a/macros/latex/contrib/l3kernel/l3keys.dtx +++ b/macros/latex/contrib/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -1569,12 +1569,6 @@ % Setting the code for a key first logs if appropriate that we are % defining a new key, then saves the code. % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \cs_if_exist:cF { \c_@@_code_root_tl #1 } - { \__kernel_debug_log:x { Defining~key~#1~\msg_line_context: } } - } - { } \cs_new_protected:Npn \@@_cmd_set:nn #1#2 { \cs_set_protected:cpn { \c_@@_code_root_tl #1 } ##1 {#2} } \cs_generate_variant:Nn \@@_cmd_set:nn { nx , Vn , Vo } @@ -1642,7 +1636,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_initialise:n #1 { - \cs_if_exist_use:cT { \c_@@_code_root_tl \l_keys_path_tl } { {#1} } + \cs_if_exist:cTF + { \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl } + { \@@_execute_inherit: } + { + \tl_clear:N \l_@@_inherit_tl + \cs_if_exist_use:cT { \c_@@_code_root_tl \l_keys_path_tl } { {#1} } + } } % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/l3kernel/l3legacy.dtx b/macros/latex/contrib/l3kernel/l3legacy.dtx index 417723048a..87695c7601 100644 --- a/macros/latex/contrib/l3kernel/l3legacy.dtx +++ b/macros/latex/contrib/l3kernel/l3legacy.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3luatex.dtx b/macros/latex/contrib/l3kernel/l3luatex.dtx index b7f098649c..f499317f98 100644 --- a/macros/latex/contrib/l3kernel/l3luatex.dtx +++ b/macros/latex/contrib/l3kernel/l3luatex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3msg.dtx b/macros/latex/contrib/l3kernel/l3msg.dtx index bbb003888b..717002aaca 100644 --- a/macros/latex/contrib/l3kernel/l3msg.dtx +++ b/macros/latex/contrib/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -555,11 +555,6 @@ % This auxiliary is similar to \cs{__kernel_chk_if_free_cs:N}, and is used when % defining messages with \cs{msg_new:nnnn}. % \begin{macrocode} -\__kernel_patch:nnNNpn { } - { - \__kernel_debug_log:x - { Defining~message~ #1 / #2 ~\msg_line_context: } - } \cs_new_protected:Npn \@@_chk_free:nn #1#2 { \msg_if_exist:nnT {#1} {#2} @@ -1800,6 +1795,9 @@ LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } +\__kernel_msg_new:nnnn { kernel } { quote-in-shell } + { Quotes~in~shell~command~'#1'. } + { Shell~commands~cannot~contain~quotes~("). } \__kernel_msg_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { @@ -1807,6 +1805,14 @@ LaTeX~has~been~asked~to~create~a~new~scan~mark~'#1'~ but~this~name~has~already~been~used~for~a~scan~mark. } +\__kernel_msg_new:nnnn { kernel } { shuffle-too-large } + { The~sequence~#1~is~too~long~to~be~shuffled~by~TeX. } + { + TeX~has~ \int_eval:n { \c_max_register_int + 1 } ~ + toks~registers:~this~only~allows~to~shuffle~up~to~ + \int_use:N \c_max_register_int \ items.~ + The~list~will~not~be~shuffled. + } \__kernel_msg_new:nnnn { kernel } { variable-not-defined } { Variable~#1~undefined. } { @@ -1857,55 +1863,14 @@ % In format mode the error is somewhat different. % \begin{macrocode} %<*package> -\__kernel_if_debug:TF - { - \__kernel_msg_new:nnnn { kernel } { debug } - { The~debugging~option~'#1'~does~not~exist~\msg_line_context:. } - { - The~functions~'\iow_char:N\\debug_on:n'~and~ - '\iow_char:N\\debug_off:n'~only~accept~the~arguments~ - 'check-declarations',~'deprecation',~'log-functions',~not~'#1'. - } - \__kernel_msg_new:nnn { kernel } { expr } { '#2'~in~#1 } - \__kernel_msg_new:nnnn { kernel } { local-global } - { Inconsistent~local/global~assignment } - { - \c_@@_coding_error_text_tl - \if:w l #2 Local - \else: - \if:w g #2 Global \else: Constant \fi: - \fi: - \ % - assignment~to~a~ - \if:w l #1 local - \else: - \if:w g #1 global \else: constant \fi: - \fi: - \ % - variable~'#3'. - } - \__kernel_msg_new:nnnn { kernel } { non-declared-variable } - { The~variable~#1~has~not~been~declared~\msg_line_context:. } - { - \c_@@_coding_error_text_tl - Checking~is~active,~and~you~have~tried~do~so~something~like: \\ - \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ - without~first~having: \\ - \ \ \tl_new:N ~ #1 \\ - \\ - LaTeX~will~create~the~variable~and~continue. - } - } +\__kernel_msg_new:nnnn { kernel } { enable-debug } + { To~use~'#1'~load~expl3~with~the~'enable-debug'~option. } { - \__kernel_msg_new:nnnn { kernel } { enable-debug } - { To~use~'#1'~load~expl3~with~the~'enable-debug'~option. } - { - The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ - some~internal~functions~in~expl3~have~been~appropriately~ - defined.~This~only~happens~if~one~of~the~options~ - 'enable-debug',~'check-declarations'~or~'log-functions'~was~ - given~when~loading~expl3. - } + The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ + some~internal~functions~in~expl3~have~been~appropriately~ + defined.~This~only~happens~if~one~of~the~options~ + 'enable-debug',~'check-declarations'~or~'log-functions'~was~ + given~when~loading~expl3. } %</package> %<*initex> @@ -1985,6 +1950,22 @@ } % \end{macrocode} % +% System layer messages +% \begin{macrocode} +\__kernel_msg_new:nnnn { sys } { backend-set } + { Backend~configuration~already~set. } + { + Run-time~backend~selection~may~only~be~carried~out~once~during~a~run.~ + This~second~attempt~to~set~them~will~be~ignored. + } +\__kernel_msg_new:nnnn { sys } { wrong-backend } + { Backend~request~inconsistent~with~engine:~using~'#2'~backend. } + { + You~have~requested~backend~'#1',~but~this~is~not~suitable~for~use~with~the~ + active~engine.~LaTeX3~will~use~the~'#2'~backend~instead. + } +% \end{macrocode} +% % \subsection{Expandable errors} % % \begin{macro}{\@@_expandable_error:n} diff --git a/macros/latex/contrib/l3kernel/l3names.dtx b/macros/latex/contrib/l3kernel/l3names.dtx index 3167e104a5..674f69815e 100644 --- a/macros/latex/contrib/l3kernel/l3names.dtx +++ b/macros/latex/contrib/l3kernel/l3names.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3prefixes.csv b/macros/latex/contrib/l3kernel/l3prefixes.csv index 479d4adc5f..0054b22ed2 100644 --- a/macros/latex/contrib/l3kernel/l3prefixes.csv +++ b/macros/latex/contrib/l3kernel/l3prefixes.csv @@ -123,6 +123,7 @@ peek,l3kernel,The LaTeX3 Project,https://www.latex-project.org/latex3.html,https percent,l3kernel,The LaTeX3 Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2018-05-12,2018-05-12, pi,l3kernel,The LaTeX3 Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2018-05-12,2018-05-12, pkgploader,pkgploader,Michiel Helvensteijn,,,,2014-02-05,2014-02-05, +polyglossia,polyglossia,Arthur Reutenauer,https://www.polyglossia.org/,https://github.com/reutenauer/polyglossia,https://github.com/reutenauer/polyglossia/issues,2019-09-03,, prg,l3kernel,The LaTeX3 Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2012-09-27,2012-09-27, primargs,morewrites,Bruno Le Floch,https://github.com/blefloch/latex-morewrites,https://github.com/blefloch/latex-morewrites.git,https://github.com/blefloch/latex-morewrites/issues,2013-03-16,2015-09-22, prop,l3kernel,The LaTeX3 Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2012-09-27,2012-09-27, diff --git a/macros/latex/contrib/l3kernel/l3prefixes.pdf b/macros/latex/contrib/l3kernel/l3prefixes.pdf Binary files differindex b5187e36c9..79f0770ee6 100644 --- a/macros/latex/contrib/l3kernel/l3prefixes.pdf +++ b/macros/latex/contrib/l3kernel/l3prefixes.pdf diff --git a/macros/latex/contrib/l3kernel/l3prg.dtx b/macros/latex/contrib/l3kernel/l3prg.dtx index 29e41e5aa0..14a9a789b6 100644 --- a/macros/latex/contrib/l3kernel/l3prg.dtx +++ b/macros/latex/contrib/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -252,6 +252,15 @@ % \meta{boolean} is initially \texttt{false}. % \end{function} % +% \begin{function}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn} +% \begin{syntax} +% \cs{bool_const:Nn} \meta{boolean} \Arg{boolexpr} +% \end{syntax} +% Creates a new constant \meta{boolean} or raises an error if the name +% is already taken. The value of the \meta{boolean} is set globally to +% the result of evaluating the \meta{boolexpr}. +% \end{function} +% % \begin{function} % { % \bool_set_false:N , \bool_set_false:c , @@ -823,6 +832,18 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn} +% A merger between \cs{tl_const:Nn} and \cs{bool_set:Nn}. +% \begin{macrocode} +\cs_new_protected:Npn \bool_const:Nn #1#2 + { + \__kernel_chk_if_free_cs:N #1 + \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} + } +\cs_generate_variant:Nn \bool_const:Nn { c } +% \end{macrocode} +% \end{macro} +% % \begin{macro} % { % \bool_set_true:N, \bool_set_true:c, @@ -836,16 +857,12 @@ % make sure the boolean exists. This is needed because booleans are % not based on token lists nor on \TeX{} registers. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_set_true:N { c } @@ -883,13 +900,11 @@ % primitive sets the left-hand side to \cs{scan_stop:} before looking % for the right-hand side. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \bool_set:Nn #1#2 { \exp_last_unbraced:NNNf \tex_chardef:D #1 = { \bool_if_p:n {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \bool_gset:Nn #1#2 { \exp_last_unbraced:NNNNf diff --git a/macros/latex/contrib/l3kernel/l3prop.dtx b/macros/latex/contrib/l3kernel/l3prop.dtx index 44fd4a82ce..a49e006089 100644 --- a/macros/latex/contrib/l3kernel/l3prop.dtx +++ b/macros/latex/contrib/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -110,6 +110,37 @@ % \meta{property list_2}. % \end{function} % +% \begin{function}[added = 2017-11-28, updated = 2019-08-25] +% { +% \prop_set_from_keyval:Nn, \prop_set_from_keyval:cn, +% \prop_gset_from_keyval:Nn, \prop_gset_from_keyval:cn, +% } +% \begin{syntax} +% \cs{prop_set_from_keyval:Nn} \meta{prop~var} +% \{ +% \meta{key1} |=| \meta{value1} |,| +% \meta{key2} |=| \meta{value2} |,| \ldots{} +% \} +% \end{syntax} +% Sets \meta{prop~var} to contain key--value pairs given in the second +% argument. If duplicate keys appear only one of the values is kept. +% \end{function} +% +% \begin{function}[added = 2017-11-28, updated = 2019-08-25] +% {\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn} +% \begin{syntax} +% \cs{prop_const_from_keyval:Nn} \meta{prop~var} +% \{ +% \meta{key1} |=| \meta{value1} |,| +% \meta{key2} |=| \meta{value2} |,| \ldots{} +% \} +% \end{syntax} +% Creates a new constant \meta{prop~var} or raises an error if the +% name is already taken. The \meta{prop~var} is set globally to +% contain key--value pairs given in the second argument. +% If duplicate keys appear only one of the values is kept. +% \end{function} +% % \section{Adding entries to property lists} % % \begin{function}[updated = 2012-07-09] diff --git a/macros/latex/contrib/l3kernel/l3quark.dtx b/macros/latex/contrib/l3kernel/l3quark.dtx index dda51fd74f..bbeac9461b 100644 --- a/macros/latex/contrib/l3kernel/l3quark.dtx +++ b/macros/latex/contrib/l3kernel/l3quark.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -367,7 +367,6 @@ % \UnitTested % Allocate a new quark. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN q #1 } { } \cs_new_protected:Npn \quark_new:N #1 { \__kernel_chk_if_free_cs:N #1 @@ -594,7 +593,6 @@ % Check whether the variable is already a scan mark, % then declare it to be equal to \cs{scan_stop:} globally. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN s #1 } { } \cs_new_protected:Npn \scan_new:N #1 { \tl_if_in:NnTF \g_@@_marks_tl { #1 } diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx index 88c06cf660..13faf8fc86 100644 --- a/macros/latex/contrib/l3kernel/l3regex.dtx +++ b/macros/latex/contrib/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -1472,15 +1472,6 @@ % |#2|, or |#3| as relevant to each character (after de-escaping % it). % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \@@_trace_push:nnN { regex } { 1 } \@@_escape_use:nnnn - \group_begin: - \tl_set:Nx \l_@@_internal_a_tl - { \@@_trace_pop:nnN { regex } { 1 } \@@_escape_use:nnnn } - \use_none:nnn - } - { } \cs_new_protected:Npn \@@_escape_use:nnnn #1#2#3#4 { \group_begin: @@ -3779,12 +3770,6 @@ \@@_compile:n {#1} \@@_build:N \l_@@_internal_regex } -\__kernel_patch:nnNNpn - { \@@_trace_push:nnN { regex } { 1 } \@@_build:N } - { - \@@_trace_states:n { 2 } - \@@_trace_pop:nnN { regex } { 1 } \@@_build:N - } \cs_new_protected:Npn \@@_build:N #1 { \@@_standard_escapechar: @@ -3825,12 +3810,6 @@ % work properly at the outer level, we need to put the appropriate % \texttt{left} and \texttt{right} states in their sequence. % \begin{macrocode} -\__kernel_patch:nnNNpn - { \@@_trace_push:nnN { regex } { 1 } \@@_build_for_cs:n } - { - \@@_trace_states:n { 2 } - \@@_trace_pop:nnN { regex } { 1 } \@@_build_for_cs:n - } \cs_new_protected:Npn \@@_build_for_cs:n #1 { \int_set_eq:NN \l_@@_min_state_int \l_@@_max_active_int @@ -3898,18 +3877,6 @@ % \texttt{right} state is the new empty state, and the \texttt{left} % state points to the previously \enquote{current} state. % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \@@_trace:nnx { regex } { 2 } - { - regex~new~state~ - L=\int_use:N \l_@@_left_state_int ~ -> ~ - R=\int_use:N \l_@@_right_state_int ~ -> ~ - M=\int_use:N \l_@@_max_state_int ~ -> ~ - \int_eval:n { \l_@@_max_state_int + 1 } - } - } - { } \cs_new_protected:Npn \@@_build_new_state: { \@@_toks_clear:N \l_@@_max_state_int @@ -4064,9 +4031,6 @@ % auxiliaries expects \texttt{left_state} and \texttt{right_state} to % be set properly. % \begin{macrocode} -\__kernel_patch:nnNNpn - { \@@_trace_push:nnN { regex } { 1 } \@@_group_aux:nnnnN } - { \@@_trace_pop:nnN { regex } { 1 } \@@_group_aux:nnnnN } \cs_new_protected:Npn \@@_group_aux:nnnnN #1#2#3#4#5 { \if_int_compare:w #3 = 0 \exp_stop_f: @@ -4147,9 +4111,6 @@ % the group. The left and right states of the group are extracted from % the relevant sequences. % \begin{macrocode} -\__kernel_patch:nnNNpn - { \@@_trace_push:nnN { regex } { 1 } \@@_branch:n } - { \@@_trace_pop:nnN { regex } { 1 } \@@_branch:n } \cs_new_protected:Npn \@@_branch:n #1 { \@@_build_new_state: @@ -4648,12 +4609,6 @@ % smothering an empty match at the start). Once all this is set up, we % are ready for the ride. Find the first match. % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \@@_trace_push:nnN { regex } { 1 } \@@_match:n - \@@_trace:nnx { regex } { 1 } { analyzing~query~token~list } - } - { \@@_trace_pop:nnN { regex } { 1 } \@@_match:n } \cs_new_protected:Npn \@@_match:n #1 { \int_zero:N \l_@@_balance_int @@ -4667,12 +4622,6 @@ \@@_match_init: \@@_match_once: } -\__kernel_patch:nnNNpn - { - \@@_trace_push:nnN { regex } { 1 } \@@_match_cs:n - \@@_trace:nnx { regex } { 1 } { analyzing~query~token~list } - } - { \@@_trace_pop:nnN { regex } { 1 } \@@_match_cs:n } \cs_new_protected:Npn \@@_match_cs:n #1 { \int_zero:N \l_@@_balance_int @@ -4695,9 +4644,6 @@ \@@_match_init: \@@_match_once: } -\__kernel_patch:nnNNpn - { \@@_trace:nnx { regex } { 1 } { initializing } } - { } \cs_new_protected:Npn \@@_match_init: { \bool_gset_false:N \g_@@_success_bool @@ -4885,12 +4831,6 @@ % state is marked as $\texttt{step}+1$: any thread hitting it at that % point will be terminated. % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \@@_trace:nnx { regex } { 2 } - { state~\int_use:N \l_@@_curr_state_int } - } - { } \cs_new_protected:Npn \@@_use_state: { \__kernel_intarray_gset:Nnn \g_@@_state_active_intarray @@ -5267,9 +5207,6 @@ % parsed, make sure that there is no open csname. Finally, define the % \texttt{balance_one_match} and \texttt{do_one_match} functions. % \begin{macrocode} -\__kernel_patch:nnNNpn - { \@@_trace_push:nnN { regex } { 1 } \@@_replacement:n } - { \@@_trace_pop:nnN { regex } { 1 } \@@_replacement:n } \cs_new_protected:Npn \@@_replacement:n #1 { \group_begin: @@ -6704,20 +6641,16 @@ % typically~1. If the module's current tracing level is less than % |#2| show nothing, otherwise write |#3| to the terminal. % \begin{macrocode} -\__kernel_if_debug:TF +\cs_new_protected:Npn \@@_trace_push:nnN #1#2#3 + { \@@_trace:nnx {#1} {#2} { entering~ \token_to_str:N #3 } } +\cs_new_protected:Npn \@@_trace_pop:nnN #1#2#3 + { \@@_trace:nnx {#1} {#2} { leaving~ \token_to_str:N #3 } } +\cs_new_protected:Npn \@@_trace:nnx #1#2#3 { - \cs_new_protected:Npn \@@_trace_push:nnN #1#2#3 - { \@@_trace:nnx {#1} {#2} { entering~ \token_to_str:N #3 } } - \cs_new_protected:Npn \@@_trace_pop:nnN #1#2#3 - { \@@_trace:nnx {#1} {#2} { leaving~ \token_to_str:N #3 } } - \cs_new_protected:Npn \@@_trace:nnx #1#2#3 - { - \int_compare:nNnF - { \int_use:c { g_@@_trace_#1_int } } < {#2} - { \iow_term:x { Trace:~#3 } } - } + \int_compare:nNnF + { \int_use:c { g_@@_trace_#1_int } } < {#2} + { \iow_term:x { Trace:~#3 } } } - { } % \end{macrocode} % \end{macro} % @@ -6733,20 +6666,16 @@ % stored in \tn{toks} from $0$ to \cs{l_@@_max_state_int} % (excluded). % \begin{macrocode} -\__kernel_if_debug:TF +\cs_new_protected:Npn \@@_trace_states:n #1 { - \cs_new_protected:Npn \@@_trace_states:n #1 + \int_step_inline:nnn + \l_@@_min_state_int + { \l_@@_max_state_int - 1 } { - \int_step_inline:nnn - \l_@@_min_state_int - { \l_@@_max_state_int - 1 } - { - \@@_trace:nnx { regex } {#1} - { \iow_char:N \\toks ##1 = { \@@_toks_use:w ##1 } } - } + \@@_trace:nnx { regex } {#1} + { \iow_char:N \\toks ##1 = { \@@_toks_use:w ##1 } } } } - { } % \end{macrocode} % \end{macro} % diff --git a/macros/latex/contrib/l3kernel/l3seq.dtx b/macros/latex/contrib/l3kernel/l3seq.dtx index 82c5b81ded..7dfd5d3ba6 100644 --- a/macros/latex/contrib/l3kernel/l3seq.dtx +++ b/macros/latex/contrib/l3kernel/l3seq.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -114,6 +114,16 @@ % the original \meta{comma list} is unchanged. % \end{function} % +% \begin{function}[added = 2017-11-28] +% {\seq_const_from_clist:Nn, \seq_const_from_clist:cn} +% \begin{syntax} +% \cs{seq_const_from_clist:Nn} \meta{seq~var} \Arg{comma-list} +% \end{syntax} +% Creates a new constant \meta{seq~var} or raises an error if the name +% is already taken. The \meta{seq~var} is set globally to contain the +% items in the \meta{comma list}. +% \end{function} +% % \begin{function}[added = 2011-08-15, updated = 2012-07-02] % { % \seq_set_split:Nnn , \seq_set_split:NnV , @@ -463,6 +473,24 @@ % described in Section~\ref{sec:l3sort:mech}. % \end{function} % +% \begin{function}[added = 2018-04-29] +% {\seq_shuffle:N, \seq_shuffle:c, \seq_gshuffle:N, \seq_gshuffle:c} +% \begin{syntax} +% \cs{seq_shuffle:N} \meta{seq~var} +% \end{syntax} +% Sets the \meta{seq~var} to the result of placing the items of the +% \meta{seq~var} in a random order. Each item is (roughly) as likely +% to end up in any given position. +% \begin{texnote} +% For sequences with more than $13$ items or so, only a small +% proportion of all possible permutations can be reached, because +% the random seed \cs{sys_rand_seed:} only has $28$-bits. The use +% of \tn{toks} internally means that sequences with more than +% $32767$ or $65535$ items (depending on the engine) cannot be +% shuffled. +% \end{texnote} +% \end{function} +% % \section{Sequence conditionals} % % \begin{function}[EXP,pTF]{\seq_if_empty:N, \seq_if_empty:c} @@ -1103,6 +1131,18 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\seq_const_from_clist:Nn, \seq_const_from_clist:cn} +% Almost identical to \cs{seq_set_from_clist:Nn}. +% \begin{macrocode} +\cs_new_protected:Npn \seq_const_from_clist:Nn #1#2 + { + \tl_const:Nx #1 + { \s_@@ \clist_map_function:nN {#2} \@@_wrap_item:n } + } +\cs_generate_variant:Nn \seq_const_from_clist:Nn { c } +% \end{macrocode} +% \end{macro} +% % \begin{macro} % { % \seq_set_split:Nnn , \seq_set_split:NnV , @@ -1458,6 +1498,70 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\seq_shuffle:N, \seq_shuffle:c, \seq_gshuffle:N, \seq_gshuffle:c} +% \begin{macro}{\@@_shuffle:NN} +% \begin{macro}{\@@_shuffle_item:n} +% \begin{variable}{\g_@@_internal_seq} +% We apply the Fisher--Yates shuffle, storing items in \tn{toks} +% registers. We use the primitive \cs{tex_uniformdeviate:D} for +% speed reasons. Its non-uniformity is of order its argument divided +% by $2^{28}$, not too bad for small lists. For sequences with more +% than $13$ elements there are more possible permutations than +% possible seeds ($13!>2^{28}$) so the question of uniformity is +% somewhat moot. The integer variables are declared in \pkg{l3int}: +% load-order issues. +% \begin{macrocode} +\cs_if_exist:NTF \tex_uniformdeviate:D + { + \seq_new:N \g_@@_internal_seq + \cs_new_protected:Npn \seq_shuffle:N { \@@_shuffle:NN \seq_set_eq:NN } + \cs_new_protected:Npn \seq_gshuffle:N { \@@_shuffle:NN \seq_gset_eq:NN } + \cs_new_protected:Npn \@@_shuffle:NN #1#2 + { + \int_compare:nNnTF { \seq_count:N #2 } > \c_max_register_int + { + \__kernel_msg_error:nnx { kernel } { shuffle-too-large } + { \token_to_str:N #2 } + } + { + \group_begin: + \cs_set_eq:NN \@@_item:n \@@_shuffle_item:n + \int_zero:N \l_@@_internal_a_int + #2 + \seq_gset_from_inline_x:Nnn \g_@@_internal_seq + { \int_step_function:nN { \l_@@_internal_a_int } } + { \tex_the:D \tex_toks:D ##1 } + \group_end: + #1 #2 \g_@@_internal_seq + \seq_gclear:N \g_@@_internal_seq + } + } + \cs_new_protected:Npn \@@_shuffle_item:n + { + \int_incr:N \l_@@_internal_a_int + \int_set:Nn \l_@@_internal_b_int + { 1 + \tex_uniformdeviate:D \l_@@_internal_a_int } + \tex_toks:D \l_@@_internal_a_int + = \tex_toks:D \l_@@_internal_b_int + \tex_toks:D \l_@@_internal_b_int + } + } + { + \cs_new_protected:Npn \seq_shuffle:N #1 + { + \__kernel_msg_error:nnn { kernel } { fp-no-random } + { \seq_shuffle:N #1 } + } + \cs_new_eq:NN \seq_gshuffle:N \seq_shuffle:N + } +\cs_generate_variant:Nn \seq_shuffle:N { c } +\cs_generate_variant:Nn \seq_gshuffle:N { c } +% \end{macrocode} +% \end{variable} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}[TF] % { % \seq_if_in:Nn, \seq_if_in:NV, \seq_if_in:Nv, \seq_if_in:No, \seq_if_in:Nx, diff --git a/macros/latex/contrib/l3kernel/l3skip.dtx b/macros/latex/contrib/l3kernel/l3skip.dtx index 108a54eb12..da8a06f38b 100644 --- a/macros/latex/contrib/l3kernel/l3skip.dtx +++ b/macros/latex/contrib/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -457,6 +457,14 @@ % an \meta{internal dimension}. % \end{function} % +% \begin{function}[EXP, added = 2018-11-03]{\dim_sign:n} +% \begin{syntax} +% \cs{dim_sign:n} \Arg{dimexpr} +% \end{syntax} +% Evaluates the \meta{dimexpr} then leaves $1$ or $0$ or $-1$ in the +% input stream according to the sign of the result. +% \end{function} +% % \begin{function}[EXP]{\dim_use:N, \dim_use:c} % \begin{syntax} % \cs{dim_use:N} \meta{dimension} @@ -1103,7 +1111,6 @@ % \cs{dim_eval:n} to avoid needing a debugging patch that wraps the % expression in checking code. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } \cs_new_protected:Npn \dim_const:Nn #1#2 { \dim_new:N #1 @@ -1119,9 +1126,7 @@ % case where the variable passed is incorrectly a skip (for example a % \LaTeXe{} length). % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_skip } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \dim_gzero:N #1 { \tex_global:D #1 \c_zero_skip } \cs_generate_variant:Nn \dim_zero:N { c } @@ -1155,22 +1160,6 @@ % % \subsection{Setting \texttt{dim} variables} % -% Several functions here have a signature |:Nn| and are such that when -% debugging, the first argument should be checked to be a local/global -% variable and the second should be wrapped in code for an expression. -% The temporary function \cs{@@_tmp:w} finds the name |#3| of the -% function being redefined and writes the appropriate patch. -% \begin{macrocode} -\cs_set_protected:Npn \@@_tmp:w #1#2#3 - { - \__kernel_patch_args:nnnNNpn - { #1 ##1 } - { } - { {##1} { \__kernel_chk_expr:nNnN {##2} \@@_eval:w { } #3 } } - #2 #3 - } -% \end{macrocode} -% % \begin{macro}{\dim_set:Nn, \dim_set:cn} % \begin{macro}{\dim_gset:Nn, \dim_gset:cn} % Setting dimensions is easy enough but when debugging we want both to @@ -1179,10 +1168,8 @@ % where the variable passed is a skip (for example a \LaTeXe{} % length). % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \dim_set:Nn #1#2 { #1 ~ \@@_eval:w #2 \@@_eval_end: \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \dim_gset:Nn #1#2 { \tex_global:D #1 ~ \@@_eval:w #2 \@@_eval_end: \scan_stop: } \cs_generate_variant:Nn \dim_set:Nn { c } @@ -1197,11 +1184,9 @@ % All straightforward, with a \cs{scan_stop:} to deal with the case % where |#1| is (incorrectly) a skip. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \dim_set_eq:NN #1#2 { #1 = #2 \scan_stop: } \cs_generate_variant:Nn \dim_set_eq:NN { c , Nc , cc } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \dim_gset_eq:NN #1#2 { \tex_global:D #1 = #2 \scan_stop: } \cs_generate_variant:Nn \dim_gset_eq:NN { c , Nc , cc } @@ -1220,10 +1205,8 @@ % the local versions. The debugging code is inserted by % \cs{@@_tmp:w}. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \dim_add:Nn #1#2 { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \dim_gadd:Nn #1#2 { \tex_global:D \tex_advance:D #1 by @@ -1231,10 +1214,8 @@ } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \dim_sub:Nn #1#2 { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \dim_gsub:Nn #1#2 { \tex_global:D \tex_advance:D #1 by @@ -1261,8 +1242,6 @@ % Functions for $\min$, $\max$, and absolute value with only one evaluation. % The absolute value is evaluated by removing a leading~|-| if present. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_abs:n } } \cs_new:Npn \dim_abs:n #1 { \exp_after:wN \@@_abs:N @@ -1270,11 +1249,6 @@ } \cs_new:Npn \@@_abs:N #1 { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } -\__kernel_patch_args:nNNpn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_max:nn } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \dim_max:nn } - } \cs_new:Npn \dim_max:nn #1#2 { \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN @@ -1283,11 +1257,6 @@ > \@@_eval_end: } -\__kernel_patch_args:nNNpn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_min:nn } - { \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } \dim_min:nn } - } \cs_new:Npn \dim_min:nn #1#2 { \dim_use:N \@@_eval:w \exp_after:wN \@@_maxmin:wwN @@ -1331,12 +1300,6 @@ % \begin{macro}[pTF, EXP]{\dim_compare:nNn} % Simple comparison. % \begin{macrocode} -\__kernel_patch_conditional_args:nNNpnn - { - { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_compare:nNn } - { \@@_eval_end: #2 } - { \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } \dim_compare:nNn } - } \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } { \if_dim:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end: @@ -1549,21 +1512,6 @@ % step size of zero before checking the sign, but we optimize for the % most frequent case (positive step). % \begin{macrocode} -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } - \dim_step_function:nnnN - } - { - \__kernel_chk_expr:nNnN {#2} \@@_eval:w { } - \dim_step_function:nnnN - } - { - \__kernel_chk_expr:nNnN {#3} \@@_eval:w { } - \dim_step_function:nnnN - } - } \cs_new:Npn \dim_step_function:nnnN #1#2#3 { \exp_after:wN \@@_step:wwwN @@ -1645,13 +1593,39 @@ % \begin{macro}{\dim_eval:n} % Evaluating a dimension expression expandably. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_eval:n } } \cs_new:Npn \dim_eval:n #1 { \dim_use:N \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\dim_sign:n, \@@_sign:Nw} +% See \cs{dim_abs:n}. Contrarily to \cs{int_sign:n} the case of a +% zero dimension cannot be distinguished from a positive dimension by +% looking only at the first character, since |0.2pt| and |0pt| start +% the same way. We need explicit comparisons. We start by +% distinguishing the most common case of a positive dimension. +% \begin{macrocode} +\cs_new:Npn \dim_sign:n #1 + { + \int_value:w \exp_after:wN \@@_sign:Nw + \dim_use:N \@@_eval:w #1 \@@_eval_end: ; + \exp_stop_f: + } +\cs_new:Npn \@@_sign:Nw #1#2 ; + { + \if_dim:w #1#2 > \c_zero_dim + 1 + \else: + \if_meaning:w - #1 + -1 + \else: + 0 + \fi: + \fi: + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\dim_use:N, \dim_use:c} % Accessing a \meta{dim}. % \begin{macrocode} @@ -1673,8 +1647,6 @@ % terminating early and leaving extra tokens lying around. This is % used a lot by low-level manipulations. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } \dim_to_decimal:n } } \cs_new:Npn \dim_to_decimal:n #1 { \exp_after:wN @@ -1709,13 +1681,6 @@ % Another hard-coded conversion: this one is necessary to avoid things going % off-scale. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} \@@_eval:w { } - \dim_to_decimal_in_sp:n - } - } \cs_new:Npn \dim_to_decimal_in_sp:n #1 { \int_value:w \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} @@ -1820,7 +1785,6 @@ % even for constants. See \cs{dim_const:Nn} for why we cannot use % \cs{skip_gset:Nn}. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } \cs_new_protected:Npn \skip_const:Nn #1#2 { \skip_new:N #1 @@ -1834,9 +1798,7 @@ % \begin{macro}{\skip_gzero:N, \skip_gzero:c} % Reset the register to zero. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \skip_zero:N #1 { #1 \c_zero_skip } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \skip_gzero:N #1 { \tex_global:D #1 \c_zero_skip } \cs_generate_variant:Nn \skip_zero:N { c } \cs_generate_variant:Nn \skip_gzero:N { c } @@ -1869,29 +1831,12 @@ % % \subsection{Setting \texttt{skip} variables} % -% Much as for \texttt{dim} variables, \cs{@@_tmp:w} prepares a patch -% for |:Nn| function definitions in which the first argument should be -% checked to be a local/global variable and the second should be wrapped -% in code for an expression. -% \begin{macrocode} -\cs_set_protected:Npn \@@_tmp:w #1#2#3 - { - \__kernel_patch_args:nnnNNpn - { #1 ##1 } - { } - { {##1} { \__kernel_chk_expr:nNnN {##2} \tex_glueexpr:D { } #3 } } - #2 #3 - } -% \end{macrocode} -% % \begin{macro}{\skip_set:Nn, \skip_set:cn} % \begin{macro}{\skip_gset:Nn, \skip_gset:cn} % Much the same as for dimensions. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \skip_set:Nn #1#2 { #1 ~ \tex_glueexpr:D #2 \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \skip_gset:Nn #1#2 { \tex_global:D #1 ~ \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_set:Nn { c } @@ -1920,18 +1865,14 @@ % \begin{macro}{\skip_gsub:Nn, \skip_gsub:cn} % Using |by| here deals with the (incorrect) case |\skip123|. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \skip_add:Nn #1#2 { \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \skip_gadd:Nn #1#2 { \tex_global:D \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_add:Nn { c } \cs_generate_variant:Nn \skip_gadd:Nn { c } -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \skip_sub:Nn #1#2 { \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \skip_gsub:Nn #1#2 { \tex_global:D \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \skip_sub:Nn { c } @@ -1969,13 +1910,6 @@ % \begin{macrocode} \cs_set_protected:Npn \@@_tmp:w #1 { - \__kernel_patch_conditional_args:nNNpnn - { - { - \__kernel_chk_expr:nNnN - {##1} \tex_glueexpr:D { } \skip_if_finite:n - } - } \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF } { \exp_after:wN \@@_if_finite:wwNw @@ -1994,8 +1928,6 @@ % \begin{macro}{\skip_eval:n} % Evaluating a skip expression expandably. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { { \__kernel_chk_expr:nNnN {#1} \tex_glueexpr:D { } \skip_eval:n } } \cs_new:Npn \skip_eval:n #1 { \skip_use:N \tex_glueexpr:D #1 \scan_stop: } % \end{macrocode} @@ -2017,23 +1949,9 @@ % Inserting skips. % \begin{macrocode} \cs_new_eq:NN \skip_horizontal:N \tex_hskip:D -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} \tex_glueexpr:D { } - \skip_horizontal:n - } - } \cs_new:Npn \skip_horizontal:n #1 { \skip_horizontal:N \tex_glueexpr:D #1 \scan_stop: } \cs_new_eq:NN \skip_vertical:N \tex_vskip:D -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} \tex_glueexpr:D { } - \skip_vertical:n - } - } \cs_new:Npn \skip_vertical:n #1 { \skip_vertical:N \tex_glueexpr:D #1 \scan_stop: } \cs_generate_variant:Nn \skip_horizontal:N { c } @@ -2116,7 +2034,6 @@ % \begin{macro}{\muskip_const:Nn, \muskip_const:cn} % See \cs{skip_const:Nn}. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } \cs_new_protected:Npn \muskip_const:Nn #1#2 { \muskip_new:N #1 @@ -2130,10 +2047,8 @@ % \begin{macro}{\muskip_gzero:N, \muskip_gzero:c} % Reset the register to zero. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \muskip_zero:N #1 { #1 \c_zero_muskip } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \muskip_gzero:N #1 { \tex_global:D #1 \c_zero_muskip } \cs_generate_variant:Nn \muskip_zero:N { c } @@ -2170,32 +2085,12 @@ % % \subsection{Setting \texttt{muskip} variables} % -% See \texttt{skip} case. -% \begin{macrocode} -\cs_set_protected:Npn \@@_tmp:w #1#2#3 - { - \__kernel_patch_args:nnnNNpn - { #1 ##1 } - { } - { - {##1} - { - \__kernel_chk_expr:nNnN {##2} - \tex_muexpr:D { \tex_mutoglue:D } #3 - } - } - #2 #3 - } -% \end{macrocode} -% % \begin{macro}{\muskip_set:Nn, \muskip_set:cn} % \begin{macro}{\muskip_gset:Nn, \muskip_gset:cn} % This should be pretty familiar. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \muskip_set:Nn #1#2 { #1 ~ \tex_muexpr:D #2 \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \muskip_gset:Nn #1#2 { \tex_global:D #1 ~ \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_set:Nn { c } @@ -2216,10 +2111,8 @@ % } % All straightforward. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \muskip_set_eq:NN #1#2 { #1 = #2 } \cs_generate_variant:Nn \muskip_set_eq:NN { c , Nc , cc } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \muskip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \muskip_gset_eq:NN { c , Nc , cc } % \end{macrocode} @@ -2232,18 +2125,14 @@ % \begin{macro}{\muskip_gsub:Nn, \muskip_gsub:cn} % Using |by| here deals with the (incorrect) case |\muskip123|. % \begin{macrocode} -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \muskip_add:Nn #1#2 { \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \muskip_gadd:Nn #1#2 { \tex_global:D \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_add:Nn { c } \cs_generate_variant:Nn \muskip_gadd:Nn { c } -\@@_tmp:w \__kernel_chk_var_local:N \cs_new_protected:Npn \muskip_sub:Nn #1#2 { \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: } -\@@_tmp:w \__kernel_chk_var_global:N \cs_new_protected:Npn \muskip_gsub:Nn #1#2 { \tex_global:D \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \muskip_sub:Nn { c } @@ -2259,13 +2148,6 @@ % \begin{macro}{\muskip_eval:n} % Evaluating a muskip expression expandably. % \begin{macrocode} -\__kernel_patch_args:nNNpn - { - { - \__kernel_chk_expr:nNnN {#1} \tex_muexpr:D - { \tex_mutoglue:D } \muskip_eval:n - } - } \cs_new:Npn \muskip_eval:n #1 { \muskip_use:N \tex_muexpr:D #1 \scan_stop: } % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3sort.dtx b/macros/latex/contrib/l3kernel/l3sort.dtx index 9d166d50ff..826117c512 100644 --- a/macros/latex/contrib/l3kernel/l3sort.dtx +++ b/macros/latex/contrib/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str-convert.dtx b/macros/latex/contrib/l3kernel/l3str-convert.dtx index af66ad469e..289f57f144 100644 --- a/macros/latex/contrib/l3kernel/l3str-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3str-convert.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str.dtx b/macros/latex/contrib/l3kernel/l3str.dtx index 3832fbeff6..7754289843 100644 --- a/macros/latex/contrib/l3kernel/l3str.dtx +++ b/macros/latex/contrib/l3kernel/l3str.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -347,7 +347,7 @@ % \end{function} % % \begin{function}[added = 2013-07-24, updated = 2015-02-28, EXP, noTF] -% {\str_case:nn, \str_case:on, \str_case:nV, \str_case:nv} +% {\str_case:nn, \str_case:Vn, \str_case:on, \str_case:nV, \str_case:nv} % \begin{syntax} % \cs{str_case:nnTF} \Arg{test string} \\ % ~~|{| \\ @@ -1186,7 +1186,7 @@ % \end{macro} % % \begin{macro}[EXP, noTF] -% {\str_case:nn, \str_case:on, \str_case:nV, \str_case:nv, \str_case_e:nn} +% {\str_case:nn, \str_case:Vn, \str_case:on, \str_case:nV, \str_case:nv, \str_case_e:nn} % \begin{macro}[EXP]{\@@_case:nnTF, \@@_case_e:nnTF} % \begin{macro}[EXP] % {\@@_case:nw, \@@_case_e:nw, \@@_case_end:nw} @@ -1215,9 +1215,9 @@ } \cs_new:Npn \@@_case:nnTF #1#2#3#4 { \@@_case:nw {#1} #2 {#1} { } \q_mark {#3} \q_mark {#4} \q_stop } -\cs_generate_variant:Nn \str_case:nn { o , nV , nv } +\cs_generate_variant:Nn \str_case:nn { V , o , nV , nv } \prg_generate_conditional_variant:Nnn \str_case:nn - { o , nV , nv } { T , F , TF } + { V , o , nV , nv } { T , F , TF } \cs_new:Npn \@@_case:nw #1#2#3 { \str_if_eq:nnTF {#1} {#2} diff --git a/macros/latex/contrib/l3kernel/l3styleguide.pdf b/macros/latex/contrib/l3kernel/l3styleguide.pdf Binary files differindex e17b3a34d3..ad8f8ab034 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.pdf +++ b/macros/latex/contrib/l3kernel/l3styleguide.pdf diff --git a/macros/latex/contrib/l3kernel/l3styleguide.tex b/macros/latex/contrib/l3kernel/l3styleguide.tex index 19850affd8..42093dd42f 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.tex +++ b/macros/latex/contrib/l3kernel/l3styleguide.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2019-09-19} +\date{Released 2019-09-28} \begin{document} diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf Binary files differindex b8e85d1642..26eb195778 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.tex b/macros/latex/contrib/l3kernel/l3syntax-changes.tex index bc45fdad01..2742ef5ee9 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.tex +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2019-09-19} +\date{Released 2019-09-28} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3sys.dtx b/macros/latex/contrib/l3kernel/l3sys.dtx index 2d79142577..73d4e787f7 100644 --- a/macros/latex/contrib/l3kernel/l3sys.dtx +++ b/macros/latex/contrib/l3kernel/l3sys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -126,6 +126,156 @@ % |dvi| or |pdf|. % \end{variable} % +% \section{Platform} +% +% \begin{function}[added = 2018-07-27, EXP, pTF] +% { +% \sys_if_platform_unix:, +% \sys_if_platform_windows: +% } +% \begin{syntax} +% \cs{sys_if_platform_unix:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Conditionals which allow platform-specific code to be used. The names +% follow the \Lua{} |os.type()| function, \emph{i.e.}~all Unix-like systems +% are |unix| (including Linux and MacOS). +% \end{function} +% +% \begin{variable}[added = 2018-07-27]{\c_sys_platform_str} +% The current platform given as a lower case string: one of +% |unix|, |windows| or |unknown|. +% \end{variable} +% +% \section{Random numbers} +% +% \begin{function}[added = 2017-05-27, EXP]{\sys_rand_seed:} +% \begin{syntax} +% \cs{sys_rand_seed:} +% \end{syntax} +% Expands to the current value of the engine's random seed, a +% non-negative integer. In engines without random number support this +% expands to $0$. +% \end{function} +% +% \begin{function}[added = 2017-05-27]{\sys_gset_rand_seed:n} +% \begin{syntax} +% \cs{sys_gset_rand_seed:n} \Arg{intexpr} +% \end{syntax} +% Globally sets the seed for the engine's pseudo-random number +% generator to the \meta{integer expression}. This random seed +% affects all \cs[no-index]{\ldots{}_rand} functions (such as +% \cs{int_rand:nn} or \cs{clist_rand_item:n}) as well as other +% packages relying on the engine's random number generator. In +% engines without random number support this produces an error. +% \begin{texnote} +% While a $32$-bit (signed) integer can be given as a seed, only the +% absolute value is used and any number beyond $2^{28}$ is divided +% by an appropriate power of~$2$. We recommend using an integer in +% $[0,2^{28}-1]$. +% \end{texnote} +% \end{function} +% +% \section{Access to the shell} +% +% \begin{function}[noTF, added = 2019-09-20] +% {\sys_get_shell:nnN} +% \begin{syntax} +% \cs{sys_get_shell:nnN} \Arg{shell~command} \Arg{setup} \meta{tl~var} +% \cs{sys_get_shell:nnNTF} \Arg{shell~command} \Arg{setup} \meta{tl~var} \Arg{true code} \Arg{false code} +% \end{syntax} +% Defines \meta{tl} to the text returned by the \meta{shell command}. +% The \meta{shell command} is converted to a string using +% \cs{tl_to_str:n}. Category codes may need to be set appropriately +% via the \meta{setup} argument, which is run just before running the +% \meta{shell command} (in a group). +% If shell escape is disabled, the \meta{tl~var} will be set to +% \cs{q_no_value} in the non-branching version. +% Note that quote characters (|"|) \emph{cannot} be used inside the +% \meta{shell command}. The \cs{sys_get_shell:nnNTF} conditional +% returns \texttt{true} if the shell is available and no quote is +% detected, and \texttt{false} otherwise. +% \end{function} +% +% \begin{variable}[added = 2017-05-27]{\c_sys_shell_escape_int} +% This variable exposes the internal triple of the shell escape +% status. The possible values are +% \begin{description} +% \item[0] Shell escape is disabled +% \item[1] Unrestricted shell escape is enabled +% \item[2] Restricted shell escape is enabled +% \end{description} +% \end{variable} +% +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell:} +% \begin{syntax} +% \cs{sys_if_shell_p:} +% \cs{sys_if_shell:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Performs a check for whether shell escape is enabled. This +% returns true if either of restricted or unrestricted shell escape +% is enabled. +% \end{function} +% +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_unrestricted:} +% \begin{syntax} +% \cs{sys_if_shell_unrestricted_p:} +% \cs{sys_if_shell_unrestricted:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Performs a check for whether \emph{unrestricted} shell escape is +% enabled. +% \end{function} +% +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_restricted:} +% \begin{syntax} +% \cs{sys_if_shell_restricted_p:} +% \cs{sys_if_shell_restricted:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Performs a check for whether \emph{restricted} shell escape is +% enabled. This returns false if unrestricted shell escape is +% enabled. Unrestricted shell escape is not considered a superset +% of restricted shell escape in this case. To find whether any +% shell escape is enabled use \cs{sys_if_shell:}. +% \end{function} +% +% \begin{function}[added = 2017-05-27]{\sys_shell_now:n, \sys_shell_now:x} +% \begin{syntax} +% \cs{sys_shell_now:n} \Arg{tokens} +% \end{syntax} +% Execute \meta{tokens} through shell escape immediately. +% \end{function} +% +% \begin{function}[added = 2017-05-27]{\sys_shell_shipout:n, \sys_shell_shipout:x} +% \begin{syntax} +% \cs{sys_shell_shipout:n} \Arg{tokens} +% \end{syntax} +% Execute \meta{tokens} through shell escape at shipout. +% \end{function} +% +% \subsection{Loading configuration data} +% +% \begin{function}[added = 2019-09-12]{\sys_load_backend:n} +% \begin{syntax} +% \cs{sys_load_backend:n} \Arg{backend} +% \end{syntax} +% Loads the additional configuration file needed for backend support. +% If the \meta{backend} is empty, the standard backend for the engine in +% use will be loaded. This command may only be used once. +% \end{function} +% +% \begin{variable}{\c_sys_backend_str} +% Set to the name of the backend in use by \cs{sys_load_backend:n} when +% issued. +% \end{variable} +% +% \begin{function}[added = 2019-09-12]{\sys_load_debug:, \sys_load_deprecation:} +% \begin{syntax} +% \cs{sys_load_debug:} +% \cs{sys_load_deprecation:} +% \end{syntax} +% Load the additional configuration files for debugging support and rolling +% back deprecations, respectively. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -318,6 +468,308 @@ % \end{macrocode} % \end{macro} % +% \subsection{Platform} +% +% \begin{macro}[pTF]{\sys_if_platform_unix:, \sys_if_platform_windows:} +% \begin{variable}{\c_sys_platform_str} +% Setting these up requires the file module (file lookup), so is actually +% implemented there. +% \end{variable} +% \end{macro} +% +% \subsection{Random numbers} +% +% \begin{macro}[EXP]{\sys_rand_seed:} +% Unpack the primitive. When random numbers are not available, we +% return zero after an error (and incidentally make sure the number of +% expansions needed is the same as with random numbers available). +% \begin{macrocode} +\sys_if_rand_exist:TF + { \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D } } + { + \cs_new:Npn \sys_rand_seed: + { + \int_value:w + \__kernel_msg_expandable_error:nnn { kernel } { fp-no-random } + { \sys_rand_seed: } + \c_zero_int + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sys_gset_rand_seed:n} +% The primitive always assigns the seed globally. +% \begin{macrocode} +\sys_if_rand_exist:TF + { + \cs_new_protected:Npn \sys_gset_rand_seed:n #1 + { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: } + } + { + \cs_new_protected:Npn \sys_gset_rand_seed:n #1 + { + \__kernel_msg_error:nnn { kernel } { fp-no-random } + { \sys_gset_rand_seed:n {#1} } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Access to the shell} +% +% \begin{variable}{\c_sys_shell_escape_int} +% Expose the engine's shell escape status to the user. +% \begin{macrocode} +\int_const:Nn \c_sys_shell_escape_int + { + \sys_if_engine_luatex:TF + { + \tex_directlua:D + { tex.sprint(status.shell_escape~or~os.execute()) } + } + { + \tex_shellescape:D + } + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_internal_tl} +% \begin{macrocode} +\tl_new:N \l_@@_internal_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_marker_tl} +% The same idea as the marker for rescanning token lists. +% \begin{macrocode} +\tl_const:Nx \c_@@_marker_tl { : \token_to_str:N : } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[TF]{\sys_get_shell:nnN} +% \begin{macro}{\sys_get_shell:nnN,\@@_get:nnN,\@@_get_do:Nw} +% Setting using a shell is at this level just a slightly specialised file +% operation, with an additional check for quotes, as these are not supported. +% \begin{macrocode} +\cs_new_protected:Npn \sys_get_shell:nnN #1#2#3 + { + \sys_get_shell:nnNF {#1} {#2} #3 + { \tl_set:Nn #3 { \q_no_value } } + } +\prg_new_protected_conditional:Npnn \sys_get_shell:nnN #1#2#3 { T , F , TF } + { + \sys_if_shell:TF + { \exp_args:No \@@_get:nnN { \tl_to_str:n {#1} } {#2} #3 } + { \prg_return_false: } + } +\cs_new_protected:Npn \@@_get:nnN #1#2#3 + { + \tl_if_in:nnTF {#1} { " } + { + \__kernel_msg_error:nnx + { kernel } { quote-in-shell } {#1} + \prg_return_false: + } + { + \group_begin: + \if_false: { \fi: + \int_set_eq:NN \tex_tracingnesting:D \c_zero_int + \exp_args:No \tex_everyeof:D { \c_@@_marker_tl } + #2 \scan_stop: + \exp_after:wN \@@_get_do:Nw + \exp_after:wN #3 + \exp_after:wN \prg_do_nothing: + \tex_input:D | "#1" \scan_stop: + \if_false: } \fi: + \prg_return_true: + } + } +\exp_args:Nno \use:nn + { \cs_new_protected:Npn \@@_get_do:Nw #1#2 } + { \c_@@_marker_tl } + { + \group_end: + \tl_set:No #1 {#2} + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP, pTF]{\sys_if_shell:, \sys_if_shell_unrestricted:, \sys_if_shell_restricted:} +% Performs a check for whether shell escape is enabled. The first set +% of functions returns true if either of restricted or unrestricted +% shell escape is enabled, while the other two sets of functions +% return true in only one of these two cases. +% \begin{macrocode} +\@@_const:nn { sys_if_shell } + { \int_compare_p:nNn \c_sys_shell_escape_int > 0 } +\@@_const:nn { sys_if_shell_unrestricted } + { \int_compare_p:nNn \c_sys_shell_escape_int = 1 } +\@@_const:nn { sys_if_shell_restricted } + { \int_compare_p:nNn \c_sys_shell_escape_int = 2 } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\c_@@_shell_stream_int} +% This is not needed for \LuaTeX{}: shell escape there isn't done using +% a \TeX{} interface. +% \begin{macrocode} +\sys_if_engine_luatex:F + { \int_const:Nn \c_@@_shell_stream_int { 18 } } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\sys_shell_now:n} +% Execute commands through shell escape immediately. +% \begin{macrocode} +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npn \sys_shell_now:n #1 + { + \lua_now:e + { os.execute(" \lua_escape:e { \tl_to_str:n {#1} } ") } + } + } + { + \cs_new_protected:Npn \sys_shell_now:n #1 + { \iow_now:Nn \c_@@_shell_stream_int {#1} } + } +\cs_generate_variant:Nn \sys_shell_now:n { x } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sys_shell_shipout:n} +% Execute commands through shell escape at shipout. +% \begin{macrocode} +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npn \sys_shell_shipout:n #1 + { + \lua_shipout_e:n + { os.execute(" \lua_escape:e { \tl_to_str:n {#1} } ") } + } + } + { + \cs_new_protected:Npn \sys_shell_shipout:n #1 + { \iow_shipout:Nn \c_@@_shell_stream_int {#1} } + } +\cs_generate_variant:Nn \sys_shell_shipout:n { x } +% \end{macrocode} +% \end{macro} +% +% \subsection{Configurations} +% +% \begin{variable}{\g_@@_backend_tl} +% As the backend has to be checked and possibly adjusted, the approach here +% is to create a variable and use that in a one-shot to set a constant. +% \begin{macrocode} +\tl_new:N \g_@@_backend_tl +\tl_gset:Nx \g_@@_backend_tl + { + \sys_if_engine_xetex:TF + { xdvipdfmx } + { + \sys_if_output_pdf:TF + { pdfmode } + { + \bool_lazy_or:nnTF + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } + { dvipdfmx } + { dvips } + } + } + } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\sys_load_backend:n} +% \begin{macro}{\@@_load_backend_check:N} +% \begin{variable}{\c_sys_backend_str} +% Loading the backend code is pretty simply: check that the backend is valid, +% then load it up. +% \begin{macrocode} +\cs_new_protected:Npn \sys_load_backend:n #1 + { + \str_if_exist:NTF \c_sys_backend_str + { \__kernel_msg_error:nnxx { sys } { backend-set } } + { + \tl_if_blank:nF {#1} + { \tl_set:Nn \g_@@_backend_tl {#1} } + \@@_load_backend_check:N \g_@@_backend_tl + \str_const:Nx \c_sys_backend_str { \g_@@_backend_tl } + \__kernel_sys_configuration_load:n + { l3backend- \c_sys_backend_str } + } + } +\cs_new_protected:Npn \@@_load_backend_check:N #1 + { + \sys_if_engine_xetex:TF + { + \str_if_eq:VnF #1 { xdvipdfmx } + { + \__kernel_msg_error:nnxx { sys } { wrong-backend } + #1 { xdvipdfmx } + \tl_gset:Nn #1 { xdvipdfmx } + } + } + { + \sys_if_output_pdf:TF + { + \str_if_eq:VnF #1 { pdfmode } + { + \__kernel_msg_error:nnxx { sys } { wrong-backend } + #1 { pdfmode } + \tl_gset:Nn #1 { pdfmode } + } + } + { + \str_case:VnF #1 + { + { dvipdfmx } { } + { dvips } { } + { dvisvgm } { } + } + { + \__kernel_msg_error:nnxx { sys } { wrong-backend } + #1 { dvips } + \tl_gset:Nn #1 { dvips } + } + } + } + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% \end{macro} +% +% \begin{variable}{\g_@@_debug_bool, \g_@@_deprecation_bool} +% \begin{macrocode} +\bool_new:N \g_@@_debug_bool +\bool_new:N \g_@@_deprecation_bool +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\sys_load_debug:, \sys_load_deprecation:} +% Simple. +% \begin{macrocode} +\cs_new_protected:Npn \sys_load_debug: + { + \bool_if:NF \g_@@_debug_bool + { \__kernel_sys_configuration_load:n { l3debug } } + \bool_gset_true:N \g_@@_debug_bool + } +\cs_new_protected:Npn \sys_load_deprecation: + { + \bool_if:NF \g_@@_deprecation_bool + { \__kernel_sys_configuration_load:n { l3deprecation } } + \bool_gset_true:N \g_@@_deprecation_bool + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.pdf b/macros/latex/contrib/l3kernel/l3term-glossary.pdf Binary files differindex 952cdcdb53..cc7ce4b0be 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.pdf +++ b/macros/latex/contrib/l3kernel/l3term-glossary.pdf diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.tex b/macros/latex/contrib/l3kernel/l3term-glossary.tex index 9745b13285..a499c943fb 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.tex +++ b/macros/latex/contrib/l3kernel/l3term-glossary.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2019-09-19} +\date{Released 2019-09-28} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx index f522435876..07ed2c8f57 100644 --- a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx +++ b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3tl.dtx b/macros/latex/contrib/l3kernel/l3tl.dtx index 96cfc1dfcf..c7728a33f2 100644 --- a/macros/latex/contrib/l3kernel/l3tl.dtx +++ b/macros/latex/contrib/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % @@ -957,7 +957,8 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2012-07-09, EXP, pTF]{\tl_if_head_eq_catcode:nN} +% \begin{function}[updated = 2012-07-09, EXP, pTF] +% {\tl_if_head_eq_catcode:nN, \tl_if_head_eq_catcode:oN} % \begin{syntax} % \cs{tl_if_head_eq_catcode_p:nN} \Arg{token list} \meta{test token} % \cs{tl_if_head_eq_catcode:nNTF} \Arg{token list} \meta{test token} @@ -1267,13 +1268,11 @@ % \begin{macro}{\tl_const:Nn, \tl_const:Nx, \tl_const:cn, \tl_const:cx} % Constants are also easy to generate. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } \cs_new_protected:Npn \tl_const:Nn #1#2 { \__kernel_chk_if_free_cs:N #1 \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_scope:NN c #1 } { } \cs_new_protected:Npn \tl_const:Nx #1#2 { \__kernel_chk_if_free_cs:N #1 @@ -1316,28 +1315,11 @@ % % \begin{macro}{\tl_set_eq:NN, \tl_set_eq:Nc, \tl_set_eq:cN, \tl_set_eq:cc} % \begin{macro}{\tl_gset_eq:NN, \tl_gset_eq:Nc, \tl_gset_eq:cN, \tl_gset_eq:cc} -% For setting token list variables equal to each other. When checking -% is turned on, make sure both variables exist. +% For setting token list variables equal to each other. To allow for +% patching, the arguments have to be explicit. % \begin{macrocode} -\__kernel_if_debug:TF - { - \cs_new_protected:Npn \tl_set_eq:NN #1#2 - { - \__kernel_chk_var_local:N #1 - \__kernel_chk_var_exist:N #2 - \cs_set_eq:NN #1 #2 - } - \cs_new_protected:Npn \tl_gset_eq:NN #1#2 - { - \__kernel_chk_var_global:N #1 - \__kernel_chk_var_exist:N #2 - \cs_gset_eq:NN #1 #2 - } - } - { - \cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN - \cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN - } +\cs_new_protected:Npn \tl_set_eq:NN #1#2 { \cs_set_eq:NN #1 #2 } +\cs_new_protected:Npn \tl_gset_eq:NN #1#2 { \cs_gset_eq:NN #1 #2 } \cs_generate_variant:Nn \tl_set_eq:NN { cN, Nc, cc } \cs_generate_variant:Nn \tl_gset_eq:NN { cN, Nc, cc } % \end{macrocode} @@ -1350,20 +1332,8 @@ % three arguments must be checked: a token list |#2| or |#3| equal to % \cs{scan_stop:} would lead to problems later on. % \begin{macrocode} -\__kernel_patch:nnNNpn - { - \__kernel_chk_var_exist:N #2 - \__kernel_chk_var_exist:N #3 - } - { } \cs_new_protected:Npn \tl_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } -\__kernel_patch:nnNNpn - { - \__kernel_chk_var_exist:N #2 - \__kernel_chk_var_exist:N #3 - } - { } \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } \cs_generate_variant:Nn \tl_concat:NNN { ccc } @@ -1429,26 +1399,18 @@ % By using \cs{exp_not:n} token list variables can contain |#| tokens, % which makes the token list registers provided by \TeX{} % more or less redundant. The \cs{tl_set:No} version is done -% \enquote{by hand} as it is used quite a lot. Each definition is -% prefixed by a call to \cs{__kernel_patch:nnNNpn} which adds an -% existence check to the definition. +% \enquote{by hand} as it is used quite a lot. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_set:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_set:Nx #1#2 { \cs_set_nopar:Npx #1 {#2} } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gset:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gset:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gset:Nx #1#2 { \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } @@ -1473,28 +1435,20 @@ % } % Adding to the left is done directly to gain a little performance. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_left:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_left:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nx #1#2 { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_left:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nx #1#2 { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } @@ -1523,28 +1477,20 @@ % } % The same on the right. % \begin{macrocode} -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_right:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_right:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_local:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_right:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } -\__kernel_patch:nnNNpn { \__kernel_chk_var_global:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } @@ -3016,6 +2962,8 @@ \prg_return_false: \fi: } +\prg_generate_conditional_variant:Nnn \tl_if_head_eq_catcode:nN + { o } { p , TF , T , F } % \end{macrocode} % For \cs{tl_if_head_eq_meaning:nN}, again, detect special cases. In % the normal case, use \cs{tl_head:w}, with no \cs{exp_not:N} this diff --git a/macros/latex/contrib/l3kernel/l3token.dtx b/macros/latex/contrib/l3kernel/l3token.dtx index bc32b8813d..df41d89943 100644 --- a/macros/latex/contrib/l3kernel/l3token.dtx +++ b/macros/latex/contrib/l3kernel/l3token.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3unicode.dtx b/macros/latex/contrib/l3kernel/l3unicode.dtx index 7795efd6a8..c7e465576a 100644 --- a/macros/latex/contrib/l3kernel/l3unicode.dtx +++ b/macros/latex/contrib/l3kernel/l3unicode.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-09-19} +% \date{Released 2019-09-28} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/source3.pdf b/macros/latex/contrib/l3kernel/source3.pdf Binary files differindex d8e2eb9683..5243735d86 100644 --- a/macros/latex/contrib/l3kernel/source3.pdf +++ b/macros/latex/contrib/l3kernel/source3.pdf diff --git a/macros/latex/contrib/l3kernel/source3.tex b/macros/latex/contrib/l3kernel/source3.tex index 09f6851315..c4662a7770 100644 --- a/macros/latex/contrib/l3kernel/source3.tex +++ b/macros/latex/contrib/l3kernel/source3.tex @@ -53,7 +53,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2019-09-19} +\date{Released 2019-09-28} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/skdoc/README b/macros/latex/contrib/skdoc/README index ffa816f402..8385ac97aa 100644 --- a/macros/latex/contrib/skdoc/README +++ b/macros/latex/contrib/skdoc/README @@ -1,6 +1,6 @@ %% skdoc documentation class %% -%% Copyright (C) 2012-2018 by Simon Sigurdhsson <sigurdhsson@gmail.com> +%% Copyright (C) 2012-2019 by Simon Sigurdhsson <sigurdhsson@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -17,7 +17,7 @@ %% This work consists of the files skdoc.dtx %% and the derived filebase skdoc.cls. -This is version 1.5a of the skdoc document class. It is designed to +This is version 1.5b of the skdoc document class. It is designed to generate both documentation and derivative files using only LaTeX, i.e. without using docstrip and ins/dtx files. diff --git a/macros/latex/contrib/skdoc/skdoc.dtx b/macros/latex/contrib/skdoc/skdoc.dtx index d0eff7eea0..a7bfdc10d8 100644 --- a/macros/latex/contrib/skdoc/skdoc.dtx +++ b/macros/latex/contrib/skdoc/skdoc.dtx @@ -1,7 +1,7 @@ % \iffalse %% skdoc documentation class %% -%% Copyright (C) 2012-2018 by Simon Sigurdhsson <sigurdhsson@gmail.com> +%% Copyright (C) 2012-2019 by Simon Sigurdhsson <sigurdhsson@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -73,7 +73,7 @@ %</driver> %<class>\ProvidesExplClass{skdoc} %<*class> - {2018/04/18}{1.5a}{skdoc documentation class} + {2019/09/29}{1.5b}{skdoc documentation class} %</class> % %<*driver> @@ -132,7 +132,7 @@ % {}{\small\pagemark} % \pagestyle{skdoc-class} % -% \version{1.5a} +% \version{1.5b} % \changes{1.0}{Initial version} % \changes{1.1}{Added support for syntax highlighting using \pkg{minted}} % \changes{1.1a}{Deprecate the use of \pkg{bibtex} in favour of \pkg{biblatex}} @@ -145,6 +145,7 @@ % \changes{1.4b}{Track \pkg{expl3} changes (thanks to Joseph Wright)} % \changes{1.5}{Fix incompatibilities with \pkg{minted}} % \changes{1.5a}{Track \pkg{expl3} changes (thanks to Felix Faltin)} +% \changes{1.5b}{Track \pkg{expl3} changes (thanks to Phelype Oleinik). Replace \pkg{opensans} option \opt{osfigures} with \opt{oldstyle} (\#40)} % \iffalse %%% Don't forget to update the version number and release date of %%% the package declaration on line 76! @@ -800,7 +801,7 @@ \RequirePackage[english=british]{csquotes} \RequirePackage[font=small,labelfont=bf,textfont=it]{caption} \RequirePackage{PTSerif,sourcecodepro} - \RequirePackage[defaultsans,osfigures,scale=0.95]{opensans} + \RequirePackage[defaultsans,oldstyle,scale=0.95]{opensans} \RequirePackage[babel]{microtype} } % \end{macrocode} @@ -943,7 +944,7 @@ % if no \cs{write18} access is available, two if we have restricted % access and one if access is unrestricted. % \begin{macrocode} - \if_int_compare:w\pdf@shellescape=\c_one + \if_int_compare:w\pdf@shellescape=\c_one_int \prg_return_true: \else: \prg_return_false: @@ -1308,7 +1309,7 @@ % Before doing anything, set create or increment a counter keeping % track of the line number of the file we're writing to. % \begin{macrocode} - \int_compare:nNnT{\int_use:c{skdoc@output@##1@line}}=\c_zero% + \int_compare:nNnT{\int_use:c{skdoc@output@##1@line}}=\c_zero_int% {\int_gincr:c{skdoc@output@##1@line}}% } % \end{macrocode} @@ -1381,7 +1382,7 @@ \begin{minipage}[c][1ex]{\textwidth} \bool_if:nF{ \g__skdoc_in_example_bool && - !\int_compare_p:nNn{\clist_count:N\l__skdoc_keys}>\c_one + !\int_compare_p:nNn{\clist_count:N\l__skdoc_keys}>\c_one_int }{ \makebox[4ex]{% \leavevmode diff --git a/macros/latex/contrib/skdoc/skdoc.pdf b/macros/latex/contrib/skdoc/skdoc.pdf Binary files differindex 432f58a336..ac78b085ea 100644 --- a/macros/latex/contrib/skdoc/skdoc.pdf +++ b/macros/latex/contrib/skdoc/skdoc.pdf diff --git a/macros/latex/contrib/statistics/LICENSE b/macros/latex/contrib/statistics/LICENSE index 41d500f5e7..0e88c31492 100644 --- a/macros/latex/contrib/statistics/LICENSE +++ b/macros/latex/contrib/statistics/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. statistics - Copyright (C) 2014-2018 Julien RIVAUD + Copyright (C) 2014-2019 Julien RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - statistics Copyright (C) 2014-2018 Julien RIVAUD + statistics Copyright (C) 2014-2019 Julien RIVAUD This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/macros/latex/contrib/statistics/README.md b/macros/latex/contrib/statistics/README.md index 4a98c88a4a..9d18961311 100644 --- a/macros/latex/contrib/statistics/README.md +++ b/macros/latex/contrib/statistics/README.md @@ -14,7 +14,7 @@ of them. Similarly `statistics` can draw only some parts of the graphs. Every part of the generated tables or graphics is customizable. -(C) Copyright 2014-2018 RIVAUD Julien +(C) Copyright 2014-2019 RIVAUD Julien This package may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this license or (at your diff --git a/macros/latex/contrib/statistics/statistics.dtx b/macros/latex/contrib/statistics/statistics.dtx index bdb85dbff9..4dd8313381 100644 --- a/macros/latex/contrib/statistics/statistics.dtx +++ b/macros/latex/contrib/statistics/statistics.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % vim: tw=80 spl=en % -%% File: statistics.dtx (C) Copyright 2014-2018 RIVAUD Julien +%% File: statistics.dtx (C) Copyright 2014-2019 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this @@ -11,7 +11,7 @@ % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\RequirePackage{expl3}[2016/01/19] +\RequirePackage{expl3}[2018/06/19] %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -20,6 +20,7 @@ \usepackage{xparse} \usepackage{xcolor} \usepackage{geometry} +\usetikzlibrary{patterns} \geometry{ a4paper, vmargin=2.5cm, right=1.5cm, textwidth=385pt, @@ -30,8 +31,8 @@ %<*driver|package> \def\ExplFileName{statistics} \def\ExplFileDescription{Compute and typeset statistics table and graphics} -\def\ExplFileDate{2018/07/21} -\def\ExplFileVersion{2.0} +\def\ExplFileDate{2019/09/29} +\def\ExplFileVersion{2.2} %</driver|package> %<*driver> \ExplSyntaxOn @@ -108,11 +109,11 @@ \str_set:Nn \l_tmpa_str {#1} \tl_trim_spaces:N \l_tmpa_str \str_set:Nx \l_tmpb_str {\char_generate:nn{`\^^M}{12}} - \str_if_eq_x:nnT \l_tmpb_str { \str_head:N \l_tmpa_str } { + \str_if_eq:eeT \l_tmpb_str { \str_head:N \l_tmpa_str } { \str_set:Nx \l_tmpa_str { \str_tail:N \l_tmpa_str } } \tl_reverse:N \l_tmpa_str - \str_if_eq_x:nnT \l_tmpb_str { \str_head:N \l_tmpa_str } { + \str_if_eq:eeT \l_tmpb_str { \str_head:N \l_tmpa_str } { \str_set:Nx \l_tmpa_str { \str_tail:N \l_tmpa_str } } \tl_reverse:N \l_tmpa_str @@ -579,14 +580,22 @@ % % \begin{key}{maxcols} % \begin{syntax} -% maxcols = \meta{integer} +% maxcols = \meta{comma-separated list of integers} % \end{syntax} % Setting this key to a positive integer~$n$ makes \cs{StatsTable} wrap after % having added $n$~columns to the current table. The table is closed, and a new % one is created with the row headers typeset anew. Setting this key to a -% negative number or zero disables wrapping. The initial value is~$0$. +% negative number or zero disables wrapping. If you set the key to a list of +% integers, each one is used as the value for the corresponding subtable, with +% the last number staying in effect for all remaining subtables. The initial +% value is~$0$. % \end{key} % +% \begin{texnote} +% If there is a non-positive integer in the list, all subsequent integers are +% ignored since there will be no further wrapping thus no other subtable. +% \end{texnote} +% % \begin{key}{tablesep} % \begin{syntax} % tablesep = \meta{\TeX\ content} @@ -881,6 +890,43 @@ % ] % \end{demo} % +% \subsubsection{Styling the graph} +% +% \begin{key}{style, style/reset, +% comb/style, comb/style/reset, +% histogram/style, histogram/style/reset, +% cumulative/style, cumulative/style/reset,} +% \begin{syntax} +% style = \meta{TikZ path options} +% \meta{graph type}/style = \meta{TikZ path options} +% style/reset, \meta{graph type}/style/reset +% \end{syntax} +% The \texttt{\meta{graph type}/style} keys append options to the TikZ path +% created by the datavisualization when the corresponding graph type is used. +% You can clear these options with \texttt{\meta{graph type}/style/reset}. +% If you omit the graph type, this sets the label for all graph types +% simultaneously. +% +% The initial values are: +% \begin{verbatim} +% comb/style = ultra-thick, +% cumulative/style = %empty +% histogram/style = { +% every~path/.prefix~style=fill, +% semithick, black, fill=black, fill~opacity=0.1 +% }, +% \end{verbatim} +% \end{key} +% +% \begin{demo} +% \statisticssetup[graph]{width=0.45\linewidth, +% style=blue, cumulative/style=densely dashed } +% \StatsGraph \facebook [ cumulative ] +% \hfill \StatsGraph \facebook[style={ +% fill opacity=0, pattern=north west lines, +% }] +% \end{demo} +% % \subsubsection{Selecting which parts of the graph are shown} % % By default, the complete graph is shown; you can ask \cs{StatsGraph} to only @@ -1051,7 +1097,7 @@ % Initial values are as follows: % \begin{itemize} % \item |comb/counts/axis| and |cumulative/counts/axis| are equal to\\ -% |ticks and grid={many, int about strategy, integer minor steps},|\\ +% |ticks and grid={many, int about strategy, integer minor steps*},|\\ % |label=|\meta{initial value of the label key} % \item |cumulative/counts/axis| and |cumulative/frequencies/axis| are % equal to\\ @@ -1092,11 +1138,13 @@ % \hfill \StatsGraph \facebook % \end{demo} % -% \begin{key}{/tikz/datavisualization/integer minor steps} +% \begin{key}{/tikz/datavisualization/integer minor steps, +% /tikz/datavisualization/integer minor steps*} % \begin{syntax} % integer minor steps $[$ = \meta{integer expression} $]$ +% integer minor steps* $[$ = \meta{integer expression} $]$ % \end{syntax} -% This is not a key in the |graph| module, but a TikZ key. It adds code to +% These are not keys in the |graph| module, but TikZ keys. They add code to % automatically compute |minor steps between steps| after the axis step has been % computed with the choosen strategy, so that the following constraints are % respected: @@ -1105,16 +1153,19 @@ % \item at most \meta{integer expression} ticks are present on the axis (minor % and major included, subminor not counted). % \end{itemize} +% In addition, the starred version ensures that the major step is never below +% one, which makes sense for counts where sub-unit graduations are confusing at +% best. % \end{key} % % If ommited, the \meta{integer expression} defaults to~$50$. % -% This TikZ key should not explode if the computed step is not an integer, but +% These TikZ keys should not explode if the computed step is not an integer, but % will probably not give a useful result, and in particular whether the minor % step will be integer is not defined in that case. % % \begin{texnote} -% The key is independent of \pkg{statistics} and could be reused elsewhere. +% The keys are independent of \pkg{statistics} and could be reused elsewhere. % \end{texnote} % % \begin{key}{counts/format, frequencies/format, y/format, @@ -1280,11 +1331,11 @@ % \meta{graph type}/x/axis = \meta{TikZ datavisualization axis options} % \meta{graph type}/values/axis/reset, \meta{graph type}/x/axis/reset % \end{syntax} -% The \texttt{\meta{graph type}/values/axis} key append options to the TikZ +% The \texttt{\meta{graph type}/values/axis} keys append options to the TikZ % $x$~axis when the corresponding graph type is used. You can clear these -% options with \texttt{\meta{graph type}/values/axis}. The keys with |x| are -% aliases for the similar keys with |values|. If you omit the graph type, this -% sets the label for all graph types simultaneously. +% options with \texttt{\meta{graph type}/values/axis/reset}. The keys with |x| +% are aliases for the similar keys with |values|. If you omit the graph type, +% this sets the label for all graph types simultaneously. % % The initial value is: % \begin{verbatim} @@ -1760,6 +1811,9 @@ } } +\int_new:N \l_@@_table_maxcols_int +\int_set:Nn \l_@@_table_maxcols_int {0} + \@@_keys_define:nn { table } { showonly .value_required:n = true, showonly .code:n = \@@_setshow:n{#1}, @@ -1780,9 +1834,9 @@ }, showonly/shown .initial:n = #1, - maxcols .int_set:N = \l_@@_table_maxcols_int, + maxcols .clist_set:N = \l_@@_table_maxcols_clist, maxcols .value_required:n = true, - maxcols .initial:n = 0, + maxcols .initial:n = , tablesep .tl_set:N = \l_@@_table_sep_tl, tablesep .value_required:n = true, @@ -1933,6 +1987,8 @@ \bool_new:N \l_@@_table_firstrow_bool +\seq_new:N \l_@@_store_values_seq +\seq_new:N \l_@@_store_counts_seq \cs_generate_variant:Nn \keyval_parse:NNn { NNV } \NewDocumentCommand \StatsTable { +O{} +m +O{} } { @@ -1975,6 +2031,18 @@ } % \end{macrocode} % +% Define getters for some items of the table, to be used for instance to +% programmatically choose the formatting. +% +% \begin{macrocode} + \cs_set_nopar:Npn \getvalue { + \seq_item:Nn \l_@@_store_values_seq + } + \cs_set_nopar:Npn \getcount { + \seq_item:Nn \l_@@_store_count_seq + } +% \end{macrocode} +% % Compute the total population count/frequency % % \begin{macrocode} @@ -2010,10 +2078,14 @@ \cs_new_protected_nopar:Nn \@@_table_start: { % \end{macrocode} % -% Init column count +% Init column count and fetch the next maxcols value (or keep the current one if +% we reached the end of the list). % % \begin{macrocode} \int_zero:N \l_@@_nbvals_int + \clist_pop:NNT \l_@@_table_maxcols_clist \l_tmpa_tl { + \int_set:Nn \l_@@_table_maxcols_int { \l_tmpa_tl } + } % \end{macrocode} % % Start rows with headers @@ -2120,6 +2192,7 @@ % Values % % \begin{macrocode} + \seq_put_right:Nn \l_@@_store_values_seq { #1 } \bool_if:NT \l_@@_table_values_bool { \tl_put_right:Nx \l_@@_table_values_tl { \exp_not:V \l_tmpa_tl { @@ -2134,6 +2207,7 @@ % Counts % % \begin{macrocode} + \seq_put_right:Nx \l_@@_store_counts_seq { \fp_eval:n {#2} } \bool_if:NT \l_@@_table_counts_bool { \tl_put_right:Nx \l_@@_table_counts_tl { \exp_not:V \l_tmpa_tl { @@ -2531,7 +2605,7 @@ counts/format = { \num{#1} }, counts/axis = { ticks~and~grid={ - many, int~about~strategy, integer~minor~steps, + many, int~about~strategy, integer~minor~steps*, } }, comb/counts/label = \countname, cumulative/counts/label = \ccountname, @@ -2545,7 +2619,10 @@ histogram/y/axis = {ticks = none}, histogram/y/autostep = 1, histogram/legend = { x=, y=0, w=\xstep }, - histogram/style = { semithick, black, fill=black, fill~opacity=0.1 }, + histogram/style = { + every~path/.prefix~style=fill, + semithick, black, fill=black, fill~opacity=0.1 + }, histogram/areas, histogram/areas/style = { auto, font=\small }, @@ -2668,6 +2745,18 @@ integer~minor~steps/.style={ } }, integer~minor~steps/.default=50, +integer~minor~steps*/.style={ + compute~step/.append = { + \tl_set_eq:NN \l_tmpa_tl \tikz@lib@dv@step + \tl_if_eq:NNF \l_tmpa_tl \relax { + \fp_compare:nT { \l_tmpa_tl < 1 } { + \tl_set:Nx \tikz@lib@dv@step {1} + } + } + }, + integer~minor~steps=#1, +}, +integer~minor~steps*/.default=50, } % \end{macrocode} % @@ -2718,7 +2807,7 @@ integer~minor~steps/.default=50, \fp_gset:Nn \g_@@_graph_xstep_fp { \tl_use:c {\l_tmpa_tl} } }{ - \fp_gset:Nn \g_@@_graph_xstep_fp { \c_one } + \fp_gset:Nn \g_@@_graph_xstep_fp { \c_one_int } } % \end{macrocode} % @@ -3030,9 +3119,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = histogram, histogram = } { \exp_not:n { polygon, style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l_@@_graph_options_histogram_tl - } } } + } } \exp_not:n { ] data [set = histogram, format = TeX~code] } { \exp_not:V \l_@@_graph_tikzdata_tl } @@ -3190,9 +3278,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = bar~graph, bar~graph = } { \exp_not:n { style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l_@@_graph_options_comb_tl - } } } + } } \exp_not:n { ] data [set = bar~graph, format = TeX~code] } { \exp_not:V \l_@@_graph_tikzdata_tl } @@ -3365,9 +3452,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = cumulative, cumulative = } { \exp_not:n { style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l_@@_graph_options_cumulative_tl - } } } + } } \exp_not:n { ] data [set = cumulative, format = TeX~code] } { \exp_not:V \l_@@_graph_tikzdata_tl } diff --git a/macros/latex/contrib/statistics/statistics.ins b/macros/latex/contrib/statistics/statistics.ins index fb958db323..743475ec40 100644 --- a/macros/latex/contrib/statistics/statistics.ins +++ b/macros/latex/contrib/statistics/statistics.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File statistics.ins (C) Copyright 2014-2018 RIVAUD Julien +File statistics.ins (C) Copyright 2014-2019 RIVAUD Julien It may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this diff --git a/macros/latex/contrib/statistics/statistics.pdf b/macros/latex/contrib/statistics/statistics.pdf Binary files differindex 13ba2fb5b1..625901633b 100644 --- a/macros/latex/contrib/statistics/statistics.pdf +++ b/macros/latex/contrib/statistics/statistics.pdf diff --git a/macros/latex/contrib/testidx/CHANGES b/macros/latex/contrib/testidx/CHANGES index c37932f084..4917d1faa6 100644 --- a/macros/latex/contrib/testidx/CHANGES +++ b/macros/latex/contrib/testidx/CHANGES @@ -1,3 +1,11 @@ +v1.2 (2019-09-29): + + * Added options ascii and noascii + + * Added lonely sub-item + + * Corrected description for seal + v1.1 (2017-08-11): * Added more sample text, including examples starting with some diff --git a/macros/latex/contrib/testidx/README b/macros/latex/contrib/testidx/README index 1671deff3c..9802c9ed45 100644 --- a/macros/latex/contrib/testidx/README +++ b/macros/latex/contrib/testidx/README @@ -1,6 +1,6 @@ -LaTeX Package : testidx v1.1 +LaTeX Package : testidx v1.2 -Last Modified : 2017-08-11 +Last Modified : 2019-09-29 Author : Nicola Talbot @@ -24,7 +24,8 @@ Example document: \end{document} Note that the dummy indexing intentionally triggers multiple encap -warnings for testing purposes. +warnings for testing purposes. The package is designed to emulate +common problems. LICENCE diff --git a/macros/latex/contrib/testidx/samples/sample-idx-a4.pdf b/macros/latex/contrib/testidx/samples/sample-idx-a4.pdf Binary files differindex 40d26c22e5..3ca5dc3cff 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-a4.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-a4.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-amsmath.pdf b/macros/latex/contrib/testidx/samples/sample-idx-amsmath.pdf Binary files differindex b212b990cc..5cc32f4301 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-amsmath.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-amsmath.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-babel-german.pdf b/macros/latex/contrib/testidx/samples/sample-idx-babel-german.pdf Binary files differindex 624a7ec024..c6c10af4b2 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-babel-german.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-babel-german.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-babel-german.tex b/macros/latex/contrib/testidx/samples/sample-idx-babel-german.tex index 3f0719aa34..2537bc3b99 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-babel-german.tex +++ b/macros/latex/contrib/testidx/samples/sample-idx-babel-german.tex @@ -18,7 +18,7 @@ \usepackage{filecontents} \usepackage{makeidx} \usepackage{babel} -\usepackage{testidx} +\usepackage[ascii]{testidx} \providecommand*\lettergroup[1]{% \par\textbf{#1}\par diff --git a/macros/latex/contrib/testidx/samples/sample-idx-german.pdf b/macros/latex/contrib/testidx/samples/sample-idx-german.pdf Binary files differindex 8796631b56..a63d6cd0d9 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-german.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-german.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-german.tex b/macros/latex/contrib/testidx/samples/sample-idx-german.tex index 0a3543bbea..c8be326632 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-german.tex +++ b/macros/latex/contrib/testidx/samples/sample-idx-german.tex @@ -18,7 +18,7 @@ \usepackage{filecontents} \usepackage{makeidx} \usepackage{ngerman} -\usepackage[german]{testidx} +\usepackage[german,ascii]{testidx} \providecommand*\lettergroup[1]{% \par\textbf{#1}\par diff --git a/macros/latex/contrib/testidx/samples/sample-idx-hyp.pdf b/macros/latex/contrib/testidx/samples/sample-idx-hyp.pdf Binary files differindex e46507fbae..85fc48dea5 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-hyp.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-hyp.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-letter.pdf b/macros/latex/contrib/testidx/samples/sample-idx-letter.pdf Binary files differindex 319f33dd7b..2f85f38412 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-letter.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-letter.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-lua.pdf b/macros/latex/contrib/testidx/samples/sample-idx-lua.pdf Binary files differindex 6cf3556cd3..70b9f497eb 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-lua.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-lua.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-lua.tex b/macros/latex/contrib/testidx/samples/sample-idx-lua.tex index 39526333cd..31b7ad0339 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-lua.tex +++ b/macros/latex/contrib/testidx/samples/sample-idx-lua.tex @@ -12,7 +12,7 @@ % arara: lualatex % arara: xindy: {language: english, codepage: utf8, % arara: --> log: sample-idx-lua.ilg, -% arara: --> modules: [basename, texindy]} +% arara: --> modules: [sample-idx-lua, texindy]} % arara: lualatex \documentclass{article} diff --git a/macros/latex/contrib/testidx/samples/sample-idx-subset.pdf b/macros/latex/contrib/testidx/samples/sample-idx-subset.pdf Binary files differindex c6045b334e..68e21fbfe3 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-subset.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-subset.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-t1.pdf b/macros/latex/contrib/testidx/samples/sample-idx-t1.pdf Binary files differindex 50a176f0d4..5ca311a23e 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-t1.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-t1.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-utf8.pdf b/macros/latex/contrib/testidx/samples/sample-idx-utf8.pdf Binary files differindex f35959e4b7..92c8339c56 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-utf8.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-utf8.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-utf8.tex b/macros/latex/contrib/testidx/samples/sample-idx-utf8.tex index e4cbb529f3..836963ea27 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-utf8.tex +++ b/macros/latex/contrib/testidx/samples/sample-idx-utf8.tex @@ -11,7 +11,7 @@ % % arara: pdflatex % arara: xindy: {language: english, codepage: utf8, -% arara: --> modules: [basename, texindy]} +% arara: --> modules: [sample-idx-utf8, texindy]} % arara: pdflatex \documentclass{article} diff --git a/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.pdf b/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.pdf Binary files differindex a9c6341239..820d84b896 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.tex b/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.tex index 7fcd40f949..d579daaabe 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.tex +++ b/macros/latex/contrib/testidx/samples/sample-idx-xe-digraphs.tex @@ -4,9 +4,9 @@ % with XeLaTeX and xindy using digraph glyphs. % You can build this document using: % -% xelatex sample-idx-xe -% xindy -M sample-idx-xe -M texindy -C utf8 -L english -t sample-idx-xe.ilg sample-idx-xe.idx -% xelatex sample-idx-xe +% xelatex sample-idx-xe-digraphs +% xindy -M sample-idx-xe-digraphs -M texindy -C utf8 -L english -t sample-idx-xe-digraphs.ilg sample-idx-xe-digraphs.idx +% xelatex sample-idx-xe-digraphs % % You may want to experiment with different languages. % @@ -14,7 +14,7 @@ % % arara: xelatex % arara: xindy: {language: english, codepage: utf8, -% arara: --> modules: [basename, texindy]} +% arara: --> modules: [sample-idx-xe-digraphs, texindy]} % arara: xelatex \documentclass{article} diff --git a/macros/latex/contrib/testidx/samples/sample-idx-xe.pdf b/macros/latex/contrib/testidx/samples/sample-idx-xe.pdf Binary files differindex af1f8ada1e..7d5a0510e1 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-xe.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx-xe.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idx-xe.tex b/macros/latex/contrib/testidx/samples/sample-idx-xe.tex index 4502dafe6f..f1edaa47f6 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx-xe.tex +++ b/macros/latex/contrib/testidx/samples/sample-idx-xe.tex @@ -13,7 +13,7 @@ % % arara: xelatex % arara: xindy: {language: english, codepage: utf8, -% arara: --> modules: [basename, texindy]} +% arara: --> modules: [sample-idx-xe, texindy]} % arara: xelatex \documentclass{article} diff --git a/macros/latex/contrib/testidx/samples/sample-idx.pdf b/macros/latex/contrib/testidx/samples/sample-idx.pdf Binary files differindex 61197f8097..cf24bc93dd 100644 --- a/macros/latex/contrib/testidx/samples/sample-idx.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idx.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls-xe.pdf b/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls-xe.pdf Binary files differindex e5410c3d84..5354e2194b 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls-xe.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls-xe.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls.pdf b/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls.pdf Binary files differindex 956cdf1511..9b22eb4b61 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss-bib2gls.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.pdf b/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.pdf Binary files differindex 764fc16f9d..7cfe8e25ec 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.tex b/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.tex index 34c350a27c..51bf60d169 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.tex +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss-desc.tex @@ -5,7 +5,7 @@ \usepackage[T1]{fontenc} \usepackage[hidelinks]{hyperref} -\usepackage[desc]{testidx-glossaries} +\usepackage[desc,ascii]{testidx-glossaries} \tstidxmakegloss diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss-xe-digraphs.pdf b/macros/latex/contrib/testidx/samples/sample-idxgloss-xe-digraphs.pdf Binary files differindex ee78e9178c..ac3bd07d79 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss-xe-digraphs.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss-xe-digraphs.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss-xindy.pdf b/macros/latex/contrib/testidx/samples/sample-idxgloss-xindy.pdf Binary files differindex 582ce035b0..06816ef5f8 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss-xindy.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss-xindy.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss.pdf b/macros/latex/contrib/testidx/samples/sample-idxgloss.pdf Binary files differindex de7e98a83a..a220c9492d 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss.pdf +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss.pdf diff --git a/macros/latex/contrib/testidx/samples/sample-idxgloss.tex b/macros/latex/contrib/testidx/samples/sample-idxgloss.tex index 0b7f8b6118..3fc6661563 100644 --- a/macros/latex/contrib/testidx/samples/sample-idxgloss.tex +++ b/macros/latex/contrib/testidx/samples/sample-idxgloss.tex @@ -6,7 +6,7 @@ \usepackage[T1]{fontenc} \usepackage{amssymb} \usepackage[a4paper,left=.75in,right=1.6in]{geometry} -\usepackage[verbose]{testidx-glossaries} +\usepackage[verbose,ascii]{testidx-glossaries} \renewcommand*{\glstreenamefmt}[1]{#1} \renewcommand*{\glstreegroupheaderfmt}[1]{\textbf{#1}} diff --git a/macros/latex/contrib/testidx/samples/sample-noidxgloss.pdf b/macros/latex/contrib/testidx/samples/sample-noidxgloss.pdf Binary files differindex 633472b549..9dadb10e47 100644 --- a/macros/latex/contrib/testidx/samples/sample-noidxgloss.pdf +++ b/macros/latex/contrib/testidx/samples/sample-noidxgloss.pdf diff --git a/macros/latex/contrib/testidx/testidx-code.pdf b/macros/latex/contrib/testidx/testidx-code.pdf Binary files differindex 0e30ab91a9..0374b93cd1 100644 --- a/macros/latex/contrib/testidx/testidx-code.pdf +++ b/macros/latex/contrib/testidx/testidx-code.pdf diff --git a/macros/latex/contrib/testidx/testidx-manual.pdf b/macros/latex/contrib/testidx/testidx-manual.pdf Binary files differindex 7eedfb5ba4..4c81af5790 100644 --- a/macros/latex/contrib/testidx/testidx-manual.pdf +++ b/macros/latex/contrib/testidx/testidx-manual.pdf diff --git a/macros/latex/contrib/testidx/testidx-manual.tex b/macros/latex/contrib/testidx/testidx-manual.tex index 5311acae3a..a08bdfe22a 100644 --- a/macros/latex/contrib/testidx/testidx-manual.tex +++ b/macros/latex/contrib/testidx/testidx-manual.tex @@ -27,12 +27,12 @@ \begin{document} - \title{testidx.sty v1.1: + \title{testidx.sty v1.2: dummy text for testing indexes} \author{Nicola L.C. Talbot\\[10pt] \url{http://www.dickimaw-books.com/}} - \date{2017-08-11} + \date{2019-09-29} \maketitle \tableofcontents @@ -41,7 +41,11 @@ dummy text for testing indexes} The \styfmt{testidx} package is for testing indexes (\cs{index}, \env{theindex} and indexing applications, such as \app{makeindex} -and \app{xindy}). +and \app{xindy}). See also +\href{http://tug.org/TUGboat/tb38-3/tb120talbot.pdf}{Testing +indexes: \texttt{testidx.sty}} in +\href{http://tug.org/TUGboat/Contents/contents38-3.html}{TUGboat issue 38:3, 2017}. + As with packages like \sty{lipsum} and \sty{blindtext}, this package provides dummy text, but it's interspersed with \cs{index} commands. The filler text is mostly English not lorum ipsum, as this makes it @@ -112,13 +116,23 @@ equation. \item Symbols and numbers that don't have a natural word order. The numbers may or may not be ordered numerically, depending on the indexing method. + +\item An item with just a single sub-item. (Perhaps the document +author intended to index more sub-items but they weren't needed in +the end.) Ideally this needs to be flagged and have the hierarchy +removed. There are actually two lonely sub-items. The first is +\qt{properties} as a sub-item of \qt{document}. In this case the +parent \qt{document} has also been indexed and has a location. The +second is \qt{lonely} as a sub-item of \qt{sub-items}. In this case +the parent \qt{sub-items} hasn't been indexed and so doesn't have a +location. \end{itemize} In addition, words containing extended Latin characters, digraphs and a trigraph are indexed to help test various Latin alphabets, such as Swedish, Icelandic, Welsh, Dutch, Polish and Hungarian. These may or may not be recognised by indexing applications. -Version 1.1 now comes with a supplementary package +As from version 1.1, \sty{testidx} now comes with a supplementary package \sty{testidx-glossaries} which provides a similar way of testing the \sty{glossaries} or \sty{glossaries-extra} package. @@ -150,6 +164,24 @@ There will be warnings about multiple encaps. This is intentional to test how the indexing applications deal with this problem. \end{important} +Note that as from 2018, \LaTeX\ now automatically provides limited +UTF-8 support even if the document doesn't load \sty{inputenc}. Therefore +the above document will use the ASCII indexing tests with pre-2018 +\LaTeX, but will use the UTF-8 indexing tests with newer versions of +the \LaTeX\ kernel (because \cs{inputencodingname} is now defined as +\texttt{utf8}). If you specifically want to test ASCII indexing +then you either need to switch to ASCII encoding: +\begin{verbatim} +\usepackage[ascii]{inputenc} +\usepackage{makeidx} +\usepackage{testidx} +\end{verbatim} +or use \sty{testidx}'s \pkgopt{ascii} option: +\begin{verbatim} +\usepackage{makeidx} +\usepackage[ascii]{testidx} +\end{verbatim} + If you want to use \app{xindy}, you'll need to define the attributes (encaps) used in the dummy text. For example: \begin{verbatim} @@ -272,7 +304,7 @@ For example: \usepackage{filecontents} \usepackage{makeidx} \usepackage{ngerman} -\usepackage[german]{testidx} +\usepackage[german,ascii]{testidx} \begin{filecontents*}{\jobname.ist} quote '+' @@ -302,7 +334,7 @@ Alternatively: \usepackage{filecontents} \usepackage{makeidx} \usepackage{babel} -\usepackage{testidx} +\usepackage[ascii]{testidx} \begin{filecontents*}{\jobname.ist} quote '+' @@ -324,7 +356,7 @@ The \styfmt{testidx-glossaries} package automatically loads \documentclass{report} \usepackage[T1]{fontenc} -\usepackage{testidx-glossaries} +\usepackage[ascii]{testidx-glossaries} \renewcommand*{\glstreenamefmt}[1]{#1} @@ -358,6 +390,15 @@ redefined in the above example to simply do its argument. The following package options are provided: \begin{description} +\item[\pkgopt{ascii}] Use only ASCII tests even if the document +supports UTF-8. Any characters outside +that range are produced with \LaTeX\ commands. + +\item[\pkgopt{noascii}] (Default.) Don't enforce ASCII tests. This option +doesn't actually provide UTF-8 support but will simply +determine whether or not to use ASCII tests depending on the +document's input encoding. + \item[\pkgopt{german} or \pkgopt{ngerman}] This redefines the indexing \qt{quote} character to use \texttt{+} instead of the double-quote character. Remember to add this @@ -412,6 +453,10 @@ This option may also be implemented using \begin{definition}[\DescribeMacro\testidxSanitizeOff] \cs{testidxSanitizeOff} \end{definition} +Note that as from \LaTeX\ 2019/10/01 UTF-8 characters are no longer +expanded while they are written to the \texttt{.idx} file. This +means that there may be no difference between \pkgopt{sanitize} and +\pkgopt{nosanitize} depending on the \LaTeX\ kernel in use. \item[\pkgopt{showmarks}] (Default.) Show the location of the \cs{index} commands @@ -1026,12 +1071,16 @@ The \qt{close range} character. The default is: \label{sec:exlatin} The dummy text includes words or phrases that have extended -Latin characters. There are two modes: +Latin characters. (The document encoding should be correctly set +before loading \sty{testidx}.) There are two modes: \begin{description} -\item[ASCII] This mode is on \emph{unless} you are using -\XeLaTeX\ or \LuaLaTeX, or the document has loaded -\sty{inputenc} with the encoding set to \pkgopt{utf8}. +\item[ASCII] This mode is on by default \emph{unless} you are using +\XeLaTeX\ or \LuaLaTeX, or the document has the encoding set to \pkgopt{utf8}. +Note that with new versions of \LaTeX, \cs{inputencodingname} is now +automatically defined as \pkgopt{utf8} by the kernel. You can +explicitly switch this mode on with the \pkgopt{ascii} package +option. Example that will switch on ASCII mode: \begin{verbatim} @@ -1049,12 +1098,30 @@ Example that will switch on ASCII mode: \printindex \end{document} \end{verbatim} +(With new versions of \LaTeX\ this document will start with +\cs{inputencodingname} set to \texttt{utf8} and then it will be +changed to \texttt{latin1} when \sty{inputenc} is loaded.) + +Alternatively use the \pkgopt{ascii} package option: +\begin{verbatim} +\documentclass{article} -\item[UTF-8] This mode is on \emph{if} you are using -\XeLaTeX\ or \LuaLaTeX, or if the document has loaded -\sty{inputenc} with the encoding set to \pkgopt{utf8}. +\usepackage{makeidx} +\usepackage[ascii]{testidx} -Example that will switch on UTF-8 mode: +\makeindex + +\begin{document} +\testidx + +\printindex +\end{document} +\end{verbatim} + +\item[UTF-8] This mode is on by default \emph{if} you are using +\XeLaTeX\ or \LuaLaTeX, or if \cs{inputencodingname} is set to \pkgopt{utf8}. + +Example that will switch on UTF-8 mode (\XeLaTeX\ or \LuaLaTeX): \begin{verbatim} \documentclass{article} @@ -1070,7 +1137,7 @@ Example that will switch on UTF-8 mode: \printindex \end{document} \end{verbatim} -Or +Or (\sty{inputenc} sets the encoding to UTF-8): \begin{verbatim} \documentclass{article} @@ -1087,13 +1154,30 @@ Or \printindex \end{document} \end{verbatim} +Or with new versions of the \LaTeX\ kernel (which automatically +provides UTF-8 support): +\begin{verbatim} +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage{makeidx} +\usepackage{testidx} + +\makeindex + +\begin{document} +\testidx + +\printindex +\end{document} +\end{verbatim} If the UTF-8 mode is on, you can additionally use the \pkgopt{diglyphs} package option to replace the \tstidxqt{ll}, \tstidxqt{ij} and \tstidxqt{dz} digraphs with a single glyph, but you'll need a font that supports those glyphs. (The trigraph \tstidxqt{dzw} and other digraphs, -such as \tstidxqt{th} aren't affected by this option.) For example +such as \tstidxqt{th} aren't affected by this option.) For example: \begin{verbatim} \documentclass{article} @@ -1174,7 +1258,7 @@ above will appear in the \texttt{.idx} file as: \end{verbatim} (where 3 is the page number). -Since this can confuse the indexing application, +Since this expansion can confuse the indexing application, \styfmt{testidx} provides a \pkgopt{sanitize} package option which will first sanitize the UTF-8 characters before indexing them. This option is on by default for regular \LaTeX\ and @@ -1188,6 +1272,13 @@ if you want to test how your indexing command (whatever \cs{tstindex} is defined as) behaves with these characters, then switch it off. +\begin{important} +As from \LaTeX\ 2019/10/01 this behaviour has changed and the UTF-8 +characters are no longer expanded while they are written to the +\texttt{.idx} file. This means that the tests may produce different +results depending on the \LaTeX\ kernel in use. +\end{important} + Note that this \pkgopt{sanitize} option isn't adjusting the definition of \cs{index} or \cs{tstindex}, but is essentially pretending that the user is doing something like: diff --git a/macros/latex/contrib/testidx/testidx.dtx b/macros/latex/contrib/testidx/testidx.dtx index 39a48ed9fe..8b743807ce 100644 --- a/macros/latex/contrib/testidx/testidx.dtx +++ b/macros/latex/contrib/testidx/testidx.dtx @@ -1,17 +1,17 @@ %\iffalse % testidx.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: -% -author "Nicola Talbot" -% -doc "testidx-codedoc.tex" -% -setambles ".*\.bib=>\nopreamble\nopostamble" -% -codetitle "Main Package Code" % -src "(testidx.sty)\Z=>\1" % -src "(testidx-.*.sty)\Z=>\1" % -src "(testidx-glossaries.*\.tex)\Z=>\1" % -src "(testidx-glossaries.*\.bib)\Z=>\1" +% -setambles ".*\.bib=>\nopreamble\nopostamble" +% -doc "testidx-codedoc.tex" +% -codetitle "Main Package Code" +% -author "Nicola Talbot" % -macrocode ".*\.bib" % testidx -% Created on 2017/8/11 12:58 +% Created on 2019/9/29 13:53 %\fi %\iffalse %<*package> @@ -34,7 +34,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2017 Nicola Talbot, all rights reserved. +% Copyright (C) 2019 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -45,6 +45,7 @@ testidx-codedoc.tex is a stub file used by makedtx to create testidx.dtx \fi +\usepackage{metalogo} \usepackage{fontspec} \setromanfont{FreeSerif} \setsansfont{FreeSans}[Scale=MatchLowercase] @@ -61,7 +62,7 @@ testidx.dtx \setcounter{IndexColumns}{2} -\CheckSum{10076} +\CheckSum{10168} \begin{document} \DocInput{testidx.dtx} @@ -71,12 +72,12 @@ testidx.dtx %\MakeShortVerb{"} %\DeleteShortVerb{\|} % -% \title{Documented Code For testidx v1.1} +% \title{Documented Code For testidx v1.2} % \author{Nicola L.C. Talbot\\[10pt] %Dickimaw Books\\ %\url{http://www.dickimaw-books.com/}} % -% \date{2017-08-11} +% \date{2019-09-29} % \maketitle % %\tableofcontents @@ -106,7 +107,7 @@ testidx.dtx %\section{Initialisation} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{testidx}[2017/08/11 v1.1 (NLCT)] +\ProvidesPackage{testidx}[2019/09/29 v1.2 (NLCT)] % \end{macrocode} %To avoid as much conflict as possible, this package loads the %bare minimum, so I'm not using useful packages like \styfmt{etoolbox} or @@ -135,9 +136,10 @@ testidx.dtx } % \end{macrocode} %\end{macro} -%\begin{macro}{\@tstidx@ifutfviii} +%\begin{macro}{\@@tstidx@ifutfviii} +%\changes{1.2}{2019-09-29}{renamed from \cs{@tstidx@ifutfviii}} % \begin{macrocode} -\newcommand*{\@tstidx@ifutfviii}[2]{% +\newcommand*{\@@tstidx@ifutfviii}[2]{% \@tstidx@ifxelua{#1} {% \ifx\inputencodingname\@tstidx@utfviii#1\else#2\fi @@ -146,6 +148,23 @@ testidx.dtx \newcommand*{\@tstidx@utfviii}{utf8} % \end{macrocode} %\end{macro} +%\begin{macro}{\@tstidx@ifutfviii} +%\changes{1.2}{2019-09-29}{now let to \cs{@@tstidx@ifutfviii}} +% \begin{macrocode} +\let\@tstidx@ifutfviii\@@tstidx@ifutfviii +% \end{macrocode} +%\end{macro} +%As from 2018, \LaTeX\ now automatically enables UTF-8 support, so provide +%an option to use only ASCII in the test: +%\changes{1.2}{2019-09-29}{added ascii and noascii options} +% \begin{macrocode} +\DeclareOption{ascii}{\let\@tstidx@ifutfviii\@secondoftwo} +% \end{macrocode} +%Provide option to counteract this (if document doesn't support +%UTF-8 this won't make a difference): +% \begin{macrocode} +\DeclareOption{noascii}{\let\@tstidx@ifutfviii\@@tstidx@ifutfviii} +% \end{macrocode} % %\begin{macro}{\tstidxprocessasciisort} %The first argument is a control sequence in which to store the @@ -301,6 +320,12 @@ testidx.dtx } % \end{macrocode} %\end{macro} +%Note that as from LaTeX 2019/10/01, UTF-8 characters no longer +%expand as they are written to the indexing file. This means that +%there won't be a difference if the sanitizing is on or off. +%Similarly there's no difference with \XeLaTeX\ and \LuaLaTeX\ since +%they natively support UTF-8 and don't make extended characters +%active anyway. % %\begin{macro}{\iftestidxdiglyphs} %\changes{1.1}{2017-08-11}{new} @@ -3702,6 +3727,7 @@ testidx.dtx %\end{macro} % %\begin{macro}{\@tidx@par@iii} +%\changes{1.2}{2019-09-29}{added lonely sub-item} % \begin{macrocode} \tstidxnewblock {% @@ -3812,7 +3838,8 @@ testidx.dtx any further sub-levels. Although \tstidxapp{xindy} allows more than three levels (\tstidxapp{makeindex} doesn't), it's somewhat \tstidxword{excessive} to go below a sub-sub-level. - You'll have to add your own tests for anything deeper.% + You'll have to add your own tests for anything deeper. + Watch out for \tstidxsubword{sub-items}{lonely} sub-items.% } % \end{macrocode} %\end{macro} @@ -4676,7 +4703,7 @@ and then we can take a \tstidxword{ffotograff} of %and then used in the dummy text. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{testidx-glossaries}[2017/08/11 v1.1 (NLCT)] +\ProvidesPackage{testidx-glossaries}[2019/09/29 v1.2 (NLCT)] % \end{macrocode} % %\begin{macro}{\tstidx@glossariespkg} @@ -7728,9 +7755,10 @@ use the any further sub-levels. Although \tstidxapp{xindy} allows more than three levels (\tstidxapp{makeindex} doesn't), it's somewhat \tstidxword{excessive} to go below a sub-sub-level. - You'll have to add your own tests for anything deeper.% - + You'll have to add your own tests for anything deeper. + Watch out for \tstidxsubword{sub-items}{lonely} sub-items.% } + \let\@tidx@org@par@iii\@tidx@par@iii \let\@tidx@par@iii\@tidx@gls@par@iii % \end{macrocode} @@ -8059,6 +8087,7 @@ design or provide new commands} \tstidxnewword{people}{human individuals (or fictional anthropomorphisms)} \tstidxnewword{places}{particular areas or locations} +\tstidxnewword{sub-items}{items that have a parent entry} \tstidxnewword{applications}{computer programs} \tstidxnewword{environments}{a marked-up block within the document that requires special action or formatting} @@ -8257,7 +8286,7 @@ something} \tstidxnewword{thrilling}{exciting} \tstidxnewword{quixotic}{impractically unselfish and idealist} \tstidxnewword{sea}{large area of salt water} -\tstidxnewword{seal}{seal-dwelling fish-eating mammal with flippers} +\tstidxnewword{seal}{sea-dwelling fish-eating mammal with flippers} \tstidxnewword{seaborne}{transported or travelling by sea} \tstidxnewword{zither}{a type of stringed musical instrument} \tstidxnewword{zealous}{having great enthusiasm for something} @@ -8566,6 +8595,8 @@ story, especially fairy tales} % \end{macrocode} %Sub-entries (terms). % \begin{macrocode} +\tstidxnewsubword{sub-items}{lonely}{a sub-item that doesn't have +any siblings} \tstidxnewsubword{document}{properties}{attributes such as page size} \tstidxnewsubword{font encoding}{OT1}{one of the original font encodings supplied with \TeX} @@ -10512,6 +10543,12 @@ some other languages} description={particular areas or locations} } +@index{subitems, + category={word}, + name={sub-items}, + description={items that have a parent entry} +} + @index{applications, category={word}, description={computer programs} @@ -11362,7 +11399,7 @@ something} @index{seal, category={word}, - description={seal-dwelling fish-eating mammal with flippers} + description={sea-dwelling fish-eating mammal with flippers} } @index{sea, @@ -11591,6 +11628,13 @@ the sovereign} description={attributes such as page size} } +@index{subitems.lonely, + name={lonely}, + parent={subitems}, + category={word}, + description={a sub-item that doesn't have any siblings} +} + @index{fontencoding.OT1, name={OT1}, parent={fontencoding}, diff --git a/macros/latex/contrib/testidx/testidx.ins b/macros/latex/contrib/testidx/testidx.ins index 3ec870db68..47846d5a8b 100644 --- a/macros/latex/contrib/testidx/testidx.ins +++ b/macros/latex/contrib/testidx/testidx.ins @@ -1,10 +1,10 @@ -% testidx.ins generated using makedtx version 1.2 2017/8/11 12:58 +% testidx.ins generated using makedtx version 1.2 2019/9/29 13:53 \input docstrip \preamble testidx.dtx - Copyright 2017 Nicola Talbot + Copyright 2019 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 |