summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-01-05 21:42:46 +0000
committerKarl Berry <karl@freefriends.org>2024-01-05 21:42:46 +0000
commit6aaa0d32d81bf1387c1f9c811889f09b6a4a7767 (patch)
tree6c240f6dd1b7aa9a949f1851bbf286ba798790ff
parent7e7d846832cfc0229d189eaa73eb7e131cbfd1d6 (diff)
morewrites (5jan24)
git-svn-id: svn://tug.org/texlive/trunk@69306 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/morewrites/README.md18
-rw-r--r--Master/texmf-dist/doc/latex/morewrites/morewrites.pdfbin715831 -> 748706 bytes
-rw-r--r--Master/texmf-dist/doc/latex/morewrites/primargs.pdfbin601061 -> 635774 bytes
-rw-r--r--Master/texmf-dist/source/latex/morewrites/morewrites.dtx272
-rw-r--r--Master/texmf-dist/source/latex/morewrites/morewrites.ins6
-rw-r--r--Master/texmf-dist/source/latex/morewrites/primargs.dtx32
-rw-r--r--Master/texmf-dist/tex/latex/morewrites/morewrites.sty174
-rw-r--r--Master/texmf-dist/tex/latex/morewrites/primargs.sty15
8 files changed, 371 insertions, 146 deletions
diff --git a/Master/texmf-dist/doc/latex/morewrites/README.md b/Master/texmf-dist/doc/latex/morewrites/README.md
index aa31c5370a0..eca82dee126 100644
--- a/Master/texmf-dist/doc/latex/morewrites/README.md
+++ b/Master/texmf-dist/doc/latex/morewrites/README.md
@@ -1,16 +1,16 @@
-Provide more writing streams in LaTeX
+Always room for a new write stream
=====================================
-* E-mail: blflatex+morewrites@gmail.com
+* E-mail: blflatex@gmail.com
* Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
-The morewrites LaTeX package should be used when encountering the
-`No room for a new \write ` error. This is done by redefining a
-few TeX primitives related to output.
+The morewrites package silently hooks into the TeX primitives
+responsible for writing to files to lift the restriction on
+the number of files open at the same time (16). Load the package
+with `\usepackage{morewrites}` as early as possible to avoid the
+`No room for a new \write ` error.
-This package uses the `l3kernel` bundle.
-
-This is work in progress, all suggestions/comments/bug reports
-are welcome! See https://github.com/blefloch/latex-morewrites
+Suggestions/comments/bug reports welcome at
+https://github.com/blefloch/latex-morewrites
diff --git a/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf b/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf
index 4b838b67797..20632fc76df 100644
--- a/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf
+++ b/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/morewrites/primargs.pdf b/Master/texmf-dist/doc/latex/morewrites/primargs.pdf
index d63d7f97a26..0c3a84562a7 100644
--- a/Master/texmf-dist/doc/latex/morewrites/primargs.pdf
+++ b/Master/texmf-dist/doc/latex/morewrites/primargs.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/morewrites/morewrites.dtx b/Master/texmf-dist/source/latex/morewrites/morewrites.dtx
index 6e52eff3948..1bd5e0f6b33 100644
--- a/Master/texmf-dist/source/latex/morewrites/morewrites.dtx
+++ b/Master/texmf-dist/source/latex/morewrites/morewrites.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: morewrites.dtx Copyright (C) 2011-2018 Bruno Le Floch
+%% File: morewrites.dtx Copyright (C) 2011-2024 Bruno Le Floch
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -28,7 +28,7 @@
% \title{The \textsf{morewrites} package: \\
% Always room for a new \tn{write}}
% \author{Bruno Le Floch}
-% \date{2018/12/29}
+% \date{2024/01/05}
%
% \maketitle
% \tableofcontents
@@ -60,11 +60,13 @@
% \item This package loads the \pkg{expl3} package, hence the
% \pkg{l3kernel} bundle needs to be up to date.
% \item This package uses an auxiliary file, \meta{job~name}|.mw|,
-% which can safely be deleted. Versions from 2015 and later will only
-% use the auxiliary file if it is originally empty, to avoid
-% destroying data (such as |.mw| files used by Maple). This means
-% that |.mw| files generated by versions before 2015 should be
-% deleted by hand.
+% which can safely be deleted. The package only overwrites this
+% auxiliary file if it is empty, and otherwise uses a modified
+% file name, obtained by adding an integer to the name (previously
+% it was obtained by appending additional copies of |.mw| to the
+% name). Such files can be safely deleted. Be careful though to
+% not delete a Maple worksheet by accident when cleaning up your
+% files.
% \item \LuaTeX{} allows $128$ \tn{write} streams, so this package does
% nothing (with a warning) when used with \LuaTeX{}.
% \end{itemize}
@@ -88,7 +90,7 @@
% \pkg{morewrites}.
% \end{function}
%
-% \begin{function}[added = 2014-07-26, updated = 2015-08-01]{file}
+% \begin{function}[added = 2014-07-26, updated = 2024-01-05]{file}
% \begin{syntax}
% \cs{morewritessetup} |{| |file| |=| \meta{file name} |}|
% \end{syntax}
@@ -100,13 +102,23 @@
% remaining.
% \end{function}
%
+% \begin{function}[added = 2024-01-05]{verbose}
+% \begin{syntax}
+% \cs{morewritessetup} |{| |verbose| |}|
+% \end{syntax}
+% This boolean option (\texttt{false} by default) makes the package
+% write to the terminal all of the operations that it performs. This
+% can render \pkg{morewrites} useful for debugging some file-writing
+% operations.
+% \end{function}
+%
% \begin{function}[updated = 2015-08-01]{\newwrite}
% This macro is redefined by \pkg{morewrites}. Since \pkg{morewrites}
% allows more than~$16$ write streams, it removes the corresponding
% restrictions in \tn{newwrite}.
% \begin{texnote}
% The revised \tn{newwrite} allocate stream numbers starting at
-% $19$. This might break some code that expects stream numbers to
+% $129$. This might break some code that expects stream numbers to
% be less than $16$.
% \end{texnote}
% \end{function}
@@ -153,10 +165,9 @@
%
%<*package>
% \begin{macrocode}
-\RequirePackage {expl3} [2018/02/21]
-\RequirePackage {primargs} [2018/12/29]
+\RequirePackage {primargs} [2024/01/05]
\ProvidesExplPackage
- {morewrites} {2018/12/29} {} {Always room for a new write}
+ {morewrites} {2024/01/05} {} {Always room for a new write}
% \end{macrocode}
%
% Quit early under \LuaTeX{}.
@@ -195,15 +206,18 @@
%
% Henceforth, ``\TeX{} stream'' will refer to stream numbers in the
% range $[0,15]$ provided to \TeX{}'s write primitives, while
-% ``user stream'' will denote stream numbers in $[0,15]\cup[19,\infty)$
+% ``user stream'' will denote stream numbers in $[0,15]\cup[129,\infty)$
% manipulated by the redefined \tn{openout}, \tn{write}, \tn{closeout},
% and \tn{newwrite}. A user stream in $[0,15]$ (reserved by \LaTeXe{}
% or allocated by \pkg{expl3}) is mapped to the same \TeX{} stream
-% number, while a user stream in $[19,\infty)$ is mapped to a \TeX{}
+% number, while a user stream in $[129,\infty)$ is mapped to a \TeX{}
% stream according to the property list (with integer keys and values)
% \cs{l_@@_write_prop}. Stream numbers $16$,
% $17$ and $18$ are unused because \tn{write}16 is often used to write
% to the terminal, and \tn{write}18 sends its argument to a shell.
+% The stream number $128$ is also often used like $16$ to avoid
+% distinguishing \LuaTeX{}. Rather than special-casing it we skip
+% directly to larger stream numbers.
%
% The primitives \tn{openout}, \tn{write}, and \tn{closeout} expect to
% be followed by an \meta{integer}, normally in the range $[0,15]$, then
@@ -313,21 +327,20 @@
%
% \subsubsection{Variants}
%
-% \begin{macro}{\prop_gpop:NVNT, \prop_gput:NVx, \tl_gput_right:Nv}
% We need these variants.
% \begin{macrocode}
\cs_generate_variant:Nn \prop_gpop:NnNT { NV }
\cs_generate_variant:Nn \prop_gput:Nnn { NVx }
\cs_generate_variant:Nn \tl_gput_right:Nn { Nv }
% \end{macrocode}
-% \end{macro}
%
% \subsubsection{Variables}
%
-% \begin{variable}{\l_@@_internal_tl}
+% \begin{variable}{\l_@@_internal_tl, \l_@@_internal_seq}
% Used for temporary scratch purposes.
% \begin{macrocode}
\tl_new:N \l_@@_internal_tl
+\seq_new:N \l_@@_internal_seq
% \end{macrocode}
% \end{variable}
%
@@ -338,6 +351,13 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_verbose_bool}
+% When this boolean is set true, \pkg{morewrites} will print to the terminal all of the operations that it does.
+% \begin{macrocode}
+\bool_new:N \l_@@_verbose_bool
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\g_@@_later_int}
% The integer \cs{g_@@_later_int} labels the various
% non-immediate operations in the order in which they appear in the
@@ -458,12 +478,25 @@
% \end{macrocode}
% \end{variable}
%
+% \subsubsection{Verbosity}
+%
+% \begin{macro}{\@@_verbose:n}
+% Messages to put in the terminal if the \texttt{verbose} option is
+% selected.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_verbose:n #1
+ { \bool_if:NT \l_@@_verbose_bool { \iow_term:e { morewrites:~#1 } } }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Helpers for auxiliary file}
%
% \begin{macro}{\@@_set_file:n}
% Sets \cs{g_@@_tmp_file_tl} to the given value (initially
-% \cs{c_sys_jobname_str}|.mw|). Mark that the file has not been
-% checked.
+% \cs{c_sys_jobname_str}|.mw|). We do not yet expand, delaying that
+% to the time where we start opening/closing the file, in case |#1|
+% contains something that has not yet been fixed. Mark that the file
+% has not been checked.
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_file:n #1
{
@@ -474,7 +507,7 @@
% \end{macro}
%
% \begin{macro}{\@@_empty_file:n}
-% Empties the file \cs{g_@@_tmp_file_tl} by opening it and closing it
+% Empties a file by opening it and closing it
% right away. This is used when performing \tn{immediate}
% \tn{openout}. It is also used to ensure the file used by
% \pkg{morewrites} is left empty. We do this every time the auxiliary
@@ -483,7 +516,7 @@
\cs_new_protected:Npn \@@_empty_file:n #1
{
\@@_tex_immediate:w \@@_tex_openout:w
- \g_@@_iow = #1 \scan_stop:
+ \g_@@_iow = {#1} \scan_stop:
\@@_tex_immediate:w \@@_tex_closeout:w
\g_@@_iow
}
@@ -503,7 +536,7 @@
\prg_new_conditional:Npnn \@@_if_file_trivial:n #1 { TF }
{
\group_begin:
- \tex_openin:D \g_@@_ior = #1 \scan_stop:
+ \tex_openin:D \g_@@_ior = {#1}
\if_eof:w \g_@@_ior
\cs_gset_eq:NN \@@_tmp:w \prg_return_true:
\else:
@@ -523,22 +556,41 @@
% \end{macro}
%
% \begin{macro}{\@@_chk_file:}
-% Check that the file \cs{g_@@_tmp_file_tl} does not exist or is blank.
-% If not, try the file name obtained by adding |.mw|.
+% Expand the file name in \cs{g_@@_tmp_file_tl} once and for all.
+% Check that the file does not exist or is
+% blank. If not, try another file name obtained as follows: if it
+% ends with |.mw| pick up any number that lies just before |.mw| and
+% increment it, and otherwise just add |.mw| at the end of the file.
% This avoids clobbering files that the user would not want to lose.
% \begin{macrocode}
\cs_new_protected:Npn \@@_chk_file:
{
+ \tl_gset:Ne \g_@@_tmp_file_tl
+ { \tl_to_str:e { \g_@@_tmp_file_tl } }
\@@_if_file_trivial:nTF { \g_@@_tmp_file_tl }
{ \bool_gset_true:N \g_@@_tmp_file_bool }
{
+ \@@_chk_file_aux:
\msg_warning:nnxx { morewrites } { file-exists }
- { \g_@@_tmp_file_tl }
- { \g_@@_tmp_file_tl .mw }
- \tl_gput_right:Nn \g_@@_tmp_file_tl { .mw }
+ { \g_@@_tmp_file_tl } { \l_@@_internal_tl }
+ \tl_gset_eq:NN \g_@@_tmp_file_tl \l_@@_internal_tl
\@@_chk_file:
}
}
+\cs_new_protected:Npn \@@_chk_file_aux:
+ {
+ \regex_extract_once:nVNTF
+ { \A (\D*) (\d*) .mw \Z } \g_@@_tmp_file_tl \l_@@_internal_seq
+ {
+ \tl_set:Ne \l_@@_internal_tl
+ {
+ \seq_item:Nn \l_@@_internal_seq { 2 }
+ \int_eval:n { \seq_item:Nn \l_@@_internal_seq { 3 } + 1 }
+ .mw
+ }
+ }
+ { \tl_set:Ne \l_@@_internal_tl { \g_@@_tmp_file_tl .mw } }
+ }
\msg_new:nnnn { morewrites } { file-exists }
{ File~'#1'~exists,~using~'#2'~instead. }
{
@@ -564,7 +616,7 @@
\cs_new_protected:Npn \@@_equals_file:N #1
{
\group_begin:
- \tex_aftergroup:D \primargs_get_file_name:N
+ \tex_aftergroup:D \primargs_get_input_file_name:N
\tex_aftergroup:D #1
\primargs_remove_equals:N \group_end:
}
@@ -588,9 +640,9 @@
% \begin{macro}{\@@_user_to_tstr:NTF}
% The goal is to go from a user stream \cs{l_@@_user_int} to a \TeX{}
% stream \cs{l_@@_tstr_tl} (it defaults to the user stream). Streams
-% less than $19$ are not managed by \pkg{morewrites}: actual \TeX{}
+% less than $129$ are not managed by \pkg{morewrites}: actual \TeX{}
% streams in $[0,15]$; negative for writing to \texttt{log}; $16$,
-% $17$ for writing to terminal; $18$ for shell escape. Larger stream
+% $17$, $128$ for writing to terminal; $18$ for shell escape. Larger stream
% numbers are looked up in the property list |#1|, namely
% \cs{g_@@_write_prop}. If present, use the corresponding value as
% the \TeX{} stream, otherwise run the \texttt{false} branch.
@@ -598,7 +650,7 @@
\cs_new_protected:Npn \@@_user_to_tstr:NTF #1
{
\tl_set:NV \l_@@_tstr_tl \l_@@_user_int
- \int_compare:nNnTF { \l_@@_user_int } < { 19 }
+ \int_compare:nNnTF { \l_@@_user_int } < { 129 }
{ \use_i:nn }
{ \prop_get:NVNTF #1 \l_@@_user_int \l_@@_tstr_tl }
}
@@ -724,9 +776,10 @@
% then test for \tn{openout}, \tn{write}, and \tn{closeout}. More
% precisely we test for the marker \cs{s_@@} and run the appropriate
% code as described above. Otherwise we call the primitive, for cases
-% where the next token is \tn{pdfobj} or similar. This code performs
-% too much expansion for some nonsensical uses of \tn{noexpand} after
-% \tn{immediate}.
+% where the next token is \tn{pdfobj} or similar. In contrived
+% situations involving nonsensical uses of \tn{noexpand} after
+% \tn{immediate}, this code does not perfectly match how \TeX{}
+% expands.
% \begin{macrocode}
\cs_new_protected:Npn \@@_immediate:w
{ \primargs_read_x_token:N \@@_immediate_auxii: }
@@ -734,7 +787,11 @@
{
\token_if_eq_meaning:NNTF \g_primargs_token \s_@@
{ \@@_immediate_auxiii:N }
- { \@@_tex_immediate:w }
+ {
+ \@@_verbose:n
+ { \tl_to_str:n { \immediate } \token_to_meaning:N \g_primargs_token }
+ \@@_tex_immediate:w
+ }
}
\cs_new_protected:Npn \@@_immediate_auxiii:N #1
{ \str_if_eq:nnTF { #1 } { \s_@@ } { \use_iii:nnn } { #1 } }
@@ -746,9 +803,10 @@
%
% The \tn{openout}, \tn{write}, and \tn{closeout} primitive can be
% either delayed or immediate. In all cases they begin by looking for a
-% user stream. Here, we implement the immediate versions only.
+% user stream. In this subsubsection we implement the immediate versions
+% only.
%
-% \begin{macro}{\@@_closeout:w, \@@_closeout_now:, \@@_closeout_now:nn}
+% \begin{macro}{\@@_closeout:w, \@@_closeout_now:, \@@_closeout_now_silent:, \@@_closeout_now:nn}
% In the immediate case \cs{@@_closeout_now:}, there are three cases.
% The stream may point to a \TeX{} stream, in which case it is closed,
% removed from \cs{g_@@_write_prop}, and put back in the list of
@@ -771,6 +829,11 @@
}
\cs_new_protected:Npn \@@_closeout_now:
{
+ \@@_verbose:n { \tl_to_str:n { \immediate \closeout } \int_use:N \l_@@_user_int }
+ \@@_closeout_now_silent:
+ }
+\cs_new_protected:Npn \@@_closeout_now_silent:
+ {
\@@_user_to_tstr:NTF \g_@@_write_prop
{
\@@_tex_immediate:w \@@_tex_closeout:w \l_@@_tstr_tl \exp_stop_f:
@@ -787,7 +850,7 @@
}
\cs_new_protected:Npn \@@_closeout_now:nn #1#2
{
- \@@_tex_immediate:w \@@_tex_openout:w \g_@@_iow = #2 \scan_stop:
+ \@@_tex_immediate:w \@@_tex_openout:w \g_@@_iow = {#2}
\group_begin:
\int_set:Nn \tex_newlinechar:D { -1 }
\tl_use:c { \@@_user_tl_name:n {#1} }
@@ -798,7 +861,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_openout:w, \@@_openout_now:n}
+% \begin{macro}{\@@_openout:w, \@@_openout_now:n, \@@_openout_now_silent:n}
% In the immediate case find a file name, then allocate a \TeX{}
% stream if possible, and otherwise point the user stream to a token
% list. In all cases, close the stream to avoid losing any material
@@ -814,18 +877,28 @@
}
\cs_new_protected:Npn \@@_openout_now:n #1
{
- \@@_closeout_now:
- \int_compare:nNnTF { \l_@@_user_int } < { 19 }
+ \@@_verbose:n
+ {
+ \tl_to_str:n { \immediate\openout }
+ \int_use:N \l_@@_user_int
+ \c_space_tl = ~ {#1}
+ }
+ \@@_openout_now_silent:n {#1}
+ }
+\cs_new_protected:Npn \@@_openout_now_silent:n #1
+ {
+ \@@_closeout_now_silent:
+ \int_compare:nNnTF { \l_@@_user_int } < { 129 }
{
\@@_tex_immediate:w \@@_tex_openout:w \l_@@_user_int
- = \tl_to_str:n {#1} \scan_stop:
+ = { \tl_to_str:n {#1} }
}
{
\seq_gpop:NNTF \g_@@_write_seq \l_@@_tstr_tl
{
\prop_gput:NVV \g_@@_write_prop \l_@@_user_int \l_@@_tstr_tl
\@@_tex_immediate:w \@@_tex_openout:w \l_@@_tstr_tl \exp_stop_f:
- = \tl_to_str:n {#1} \scan_stop:
+ = { \tl_to_str:n {#1} }
}
{
\@@_empty_file:n {#1}
@@ -854,14 +927,41 @@
\cs_new_protected:Npn \@@_write_now:w
{
\@@_user_to_tstr:NTF \g_@@_write_prop
- { \@@_tex_immediate:w \@@_tex_write:w \l_@@_tstr_tl \exp_stop_f: }
+ {
+ \int_compare:nNnT \l_@@_user_int = { 18 } { \use_iii:nnn }
+ \int_compare:nT { -1 < \l_@@_user_int < 16 }
+ {
+ \@@_verbose:n
+ {
+ \tl_to_str:n { \immediate \write }
+ \int_use:N \l_@@_user_int
+ }
+ }
+ \@@_tex_immediate:w \@@_tex_write:w \l_@@_tstr_tl \exp_stop_f:
+ }
{ \primargs_get_general_text:N \@@_write_now:n }
}
-\cs_new_protected:Npn \@@_write_now:n
+\cs_new_protected:Npn \@@_write_now:n #1
{
\prop_get:NVNTF \g_@@_write_file_prop \l_@@_user_int \l_@@_internal_tl
- { \@@_write_now_open:n }
- { \@@_tex_immediate:w \@@_tex_write:w 16 }
+ {
+ \@@_verbose:n
+ {
+ \tl_to_str:n { \immediate \write }
+ \int_use:N \l_@@_user_int
+ \tl_to_str:n { ~ {#1} }
+ }
+ \@@_write_now_open:n {#1}
+ }
+ {
+ \@@_verbose:n
+ {
+ \tl_to_str:n { \immediate \write }
+ \int_use:N \l_@@_user_int
+ \tl_to_str:n { ~ (closed) ~ {#1} }
+ }
+ \@@_tex_immediate:w \@@_tex_write:w 16 {#1}
+ }
}
% \end{macrocode}
% \end{macro}
@@ -885,14 +985,14 @@
{
\bool_if:NF \g_@@_tmp_file_bool { \@@_chk_file: }
\@@_tex_immediate:w \@@_tex_openout:w
- \g_@@_iow = \g_@@_tmp_file_tl \scan_stop:
+ \g_@@_iow = { \g_@@_tmp_file_tl }
\@@_tex_immediate:w \@@_tex_write:w
\g_@@_iow {#1}
\@@_tex_immediate:w \@@_tex_closeout:w
\g_@@_iow
\group_begin:
\int_set:Nn \tex_endlinechar:D { -1 }
- \tex_openin:D \g_@@_ior = \g_@@_tmp_file_tl \scan_stop:
+ \tex_openin:D \g_@@_ior = { \g_@@_tmp_file_tl }
\@@_write_now_loop:
\tex_closein:D \g_@@_ior
\@@_collect_gput_right:c
@@ -949,29 +1049,41 @@
%
% \begin{macro}{\@@_closeout_later:}
% If the user stream is a \TeX{} stream, use the primitive, otherwise
-% save \cs{@@_closeout_now:} for later.
+% save \cs{@@_closeout_now_silent:} for later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_closeout_later:
{
- \int_compare:nNnTF \l_@@_user_int < { 19 }
+ \@@_verbose:n { \tl_to_str:n { \closeout (later) ~ } \int_use:N \l_@@_user_int }
+ \int_compare:nNnTF \l_@@_user_int < { 129 }
{ \@@_tex_closeout:w \l_@@_user_int }
- { \@@_later:n { \@@_closeout_now: } }
+ { \@@_later:n { \@@_closeout_now_silent: } }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_openout_later:w, \@@_openout_later:n}
% If the user stream is a \TeX{} stream use the primitive, otherwise
-% find a file name and call \cs{@@_openout_now:n} later.
+% find a file name and call \cs{@@_openout_now_silent:n} later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_openout_later:w
{
- \int_compare:nNnTF \l_@@_user_int < { 19 }
- { \@@_tex_openout:w \l_@@_user_int }
+ \int_compare:nNnTF \l_@@_user_int < { 129 }
+ {
+ \@@_verbose:n { \tl_to_str:n { \openout (later) ~ } \int_use:N \l_@@_user_int }
+ \@@_tex_openout:w \l_@@_user_int
+ }
{ \@@_equals_file:N \@@_openout_later:n }
}
\cs_new_protected:Npn \@@_openout_later:n #1
- { \@@_later:n { \@@_openout_now:n {#1} } }
+ {
+ \@@_verbose:n
+ {
+ \tl_to_str:n { \openout (later)~ }
+ \int_use:N \l_@@_user_int
+ \c_space_tl = ~ {#1}
+ }
+ \@@_later:n { \@@_openout_now_silent:n {#1} }
+ }
% \end{macrocode}
% \end{macro}
%
@@ -982,17 +1094,32 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_write_later:w
{
- \int_compare:nNnTF \l_@@_user_int < { 19 }
- { \@@_tex_write:w \l_@@_user_int }
+ \int_compare:nNnTF \l_@@_user_int < { 129 }
+ {
+ \@@_verbose:n { \tl_to_str:n { \write (later)~ } \int_use:N \l_@@_user_int }
+ \@@_tex_write:w \l_@@_user_int
+ }
{ \primargs_get_general_text:N \@@_write_later:n }
}
\cs_new_protected:Npn \@@_write_later:n #1
- { \@@_later:n { \@@_write_later_aux:n {#1} } }
+ {
+ \@@_verbose:n
+ {
+ \tl_to_str:n { \write (later)~ }
+ \int_use:N \l_@@_user_int
+ \tl_to_str:n { ~ {#1} }
+ }
+ \@@_later:n { \@@_write_later_aux:n {#1} }
+ }
\cs_new_protected:Npn \@@_write_later_aux:n
{
\@@_user_to_tstr:NTF \g_@@_write_prop
{ \@@_tex_immediate:w \@@_tex_write:w \l_@@_tstr_tl \exp_stop_f: }
- { \@@_write_now:n }
+ {
+ \prop_get:NVNTF \g_@@_write_file_prop \l_@@_user_int \l_@@_internal_tl
+ { \@@_write_now_open:n }
+ { \@@_tex_immediate:w \@@_tex_write:w 16 \exp_stop_f: }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -1022,7 +1149,7 @@
{
\bool_if:NF \g_@@_tmp_file_bool { \@@_chk_file: }
\@@_tex_immediate:w \@@_tex_openout:w
- \g_@@_iow = \g_@@_tmp_file_tl \scan_stop:
+ \g_@@_iow = { \g_@@_tmp_file_tl }
}
% \end{macrocode}
% \end{macro}
@@ -1059,7 +1186,7 @@
\tl_set:Nx \l_@@_internal_tl
{
\exp_after:wN \@@_after_shipout_loop:ww
- \tex_input:D \g_@@_tmp_file_tl \c_space_tl
+ \tex_input:D { \g_@@_tmp_file_tl }
}
\@@_empty_file:n { \g_@@_tmp_file_tl }
\exp_args:NNo
@@ -1165,7 +1292,10 @@
\cs_new_protected:Npn \@@_close_all:
{
\prop_map_inline:Nn \g_@@_write_prop
- { \@@_tex_immediate:w \@@_tex_closeout:w ##2 \scan_stop: }
+ {
+ \@@_verbose:n { \tl_to_str:n { \immediate \closeout } ##1 ~ (at~end) }
+ \@@_tex_immediate:w \@@_tex_closeout:w ##2 \scan_stop:
+ }
\prop_gclear:N \g_@@_write_prop
\prop_map_function:NN \g_@@_write_file_prop
\@@_closeout_now:nn
@@ -1197,13 +1327,16 @@
% \subsubsection{Modified \tn{newwrite}}
%
% \begin{variable}{\g_@@_alloc_write_int}
-% Counter to allocate user streams. Initialized to $18$ so that the
-% first user stream allocated by \pkg{morewrites} is $19$. Indeed,
-% $18$ is reserved for shell commands and packages may expect $16$ or
-% $17$ to write to the terminal.
+% Counter to allocate user streams. We used to initialize it to $18$
+% so that the first user stream allocated by \pkg{morewrites} was
+% $19$. Indeed, $18$ is reserved for shell commands and packages may
+% expect $16$ or $17$ to write to the terminal. This is now changed
+% to start allocation at $129$, since some packages that do not want
+% to distinguish \LuaTeX{} from other engines simply use $128$ as a
+% never-open stream.
% \begin{macrocode}
\int_new:N \g_@@_alloc_write_int
-\int_gset:Nn \g_@@_alloc_write_int { 18 }
+\int_gset:Nn \g_@@_alloc_write_int { 128 }
% \end{macrocode}
% \end{variable}
%
@@ -1265,7 +1398,8 @@
{
allocate .code:n = \@@_allocate:n {#1} ,
file .code:n = \@@_set_file:n {#1} ,
- file .initial:n = \c_sys_jobname_str .mw
+ file .initial:n = \c_sys_jobname_str .mw ,
+ verbose .bool_set:N = \l_@@_verbose_bool
}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/morewrites/morewrites.ins b/Master/texmf-dist/source/latex/morewrites/morewrites.ins
index d9e17d55e00..6cb78787a27 100644
--- a/Master/texmf-dist/source/latex/morewrites/morewrites.ins
+++ b/Master/texmf-dist/source/latex/morewrites/morewrites.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File morewrites.ins Copyright (C) 2012 Bruno Le Floch
+File morewrites.ins Copyright (C) 2012-2024 Bruno Le Floch
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -22,8 +22,8 @@ The released version of this bundle is available from CTAN.
\preamble
-Communicate any suggestions for changing this package
-to Bruno Le Floch (blflatex@gmail.com).
+Suggestions/comments/bug reports welcome at
+https://github.com/blefloch/latex-morewrites
\endpreamble
% stop docstrip adding \endinput
diff --git a/Master/texmf-dist/source/latex/morewrites/primargs.dtx b/Master/texmf-dist/source/latex/morewrites/primargs.dtx
index 5ba63d5e855..132b01e6b64 100644
--- a/Master/texmf-dist/source/latex/morewrites/primargs.dtx
+++ b/Master/texmf-dist/source/latex/morewrites/primargs.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: primargs.dtx Copyright (C) 2012-2018 Bruno Le Floch
+%% File: primargs.dtx Copyright (C) 2012-2024 Bruno Le Floch
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -25,7 +25,7 @@
% \title{The \textsf{primargs} package: \\
% Parsing arguments of primitives}
% \author{Bruno Le Floch}
-% \date{2018/12/29}
+% \date{2024/01/05}
%
% \maketitle
% \tableofcontents
@@ -167,17 +167,19 @@
% argument.
% \end{function}
%
-% \begin{function}[updated = 2017-04-10, tested = primargs004]{\primargs_get_file_name:N, \primargs_get_input_file_name:N}
+% \begin{function}[updated = 2024-01-05, tested = primargs004]{\primargs_get_file_name:N, \primargs_get_input_file_name:N}
% \begin{syntax}
% \cs{primargs_get_file_name:N} \meta{function}
% \cs{primargs_get_input_file_name:N} \meta{function}
% \end{syntax}
% Reads a \meta{file name} following the \meta{function} and calls the
% \meta{function} with this \meta{file name} as a braced argument.
-% The two functions are identical except in the \LuaTeX{} engine where
-% \cs{primargs_get_input_file_name:N} allows braced file names:
-% \LuaTeX{} allows such braced file names for some primitives (\tn{input}
-% and \tn{openin}) but not others (\tn{openout}).
+% The first function only allows for the historical unbraced file
+% names that plain \TeX{} supports. The second one also allows braced
+% file names. Historically this was first supported in \LuaTeX{} for
+% \tn{input} and related primitives, hence the name. Now all main
+% engines (in \TeX{}Live at least) support both syntaxes for all
+% primitives that take file names.
% \begin{texnote}
% When braced file names are disallowed, the file name is obtained
% by discarding \meta{optional spaces} then repeatedly doing the
@@ -250,9 +252,8 @@
%
%<*package>
% \begin{macrocode}
-\RequirePackage {expl3} [2018/02/21]
\ProvidesExplPackage
- {primargs} {2018/12/29} {} {Parsing arguments of primitives}
+ {primargs} {2024/01/05} {} {Parsing arguments of primitives}
% \end{macrocode}
%
% \begin{macrocode}
@@ -801,7 +802,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_get_file_name_char:
{
- \token_if_eq_charcode:NNT " \g_primargs_token
+ \token_if_eq_charcode:NNT " \g_primargs_token % "
{
\tl_gset:Nx \g_@@_file_name_level_tl
{ \int_eval:n { 1 - \g_@@_file_name_level_tl } }
@@ -828,8 +829,11 @@
% \@@_get_input_file_name_loop:, \@@_get_input_file_name_test:,
% \@@_get_input_file_name_brace:, \@@_get_input_file_name_aux:N
% }
-% For most engines this is an alias of \cs{primargs_get_file_name:N}.
-% In \LuaTeX{} we test for a catcode $1$ token (after a filler) then
+% In addition to file names detected by \cs{primargs_get_file_name:N}
+% this allows for braced file names. The weird indentation is because
+% historically we had to distinguish \LuaTeX{}, allowing braced file
+% names, from other engines.
+% We test for a catcode $1$ token (after a filler) then
% expand and collect tokens (turned to strings) one by one, counting
% begin-group and end-group tokens in \cs{g_@@_file_name_level_tl}.
% The control sequence \tn{par} is ignored. After removing a filler
@@ -837,8 +841,6 @@
% the tests are safe. We use primitives to cope with outer macro
% hidden by \tn{noexpand} upon first expansion.
% \begin{macrocode}
-\sys_if_engine_luatex:TF
- {
\cs_new_protected:Npn \primargs_get_input_file_name:N #1
{
\group_begin:
@@ -905,8 +907,6 @@
}
\@@_get_input_file_name_loop:
}
- }
- { \cs_new_eq:NN \primargs_get_input_file_name:N \primargs_get_file_name:N }
% \end{macrocode}
% \end{macro}
% \end{macro}
diff --git a/Master/texmf-dist/tex/latex/morewrites/morewrites.sty b/Master/texmf-dist/tex/latex/morewrites/morewrites.sty
index 38b7b39f436..436f95b44e6 100644
--- a/Master/texmf-dist/tex/latex/morewrites/morewrites.sty
+++ b/Master/texmf-dist/tex/latex/morewrites/morewrites.sty
@@ -6,10 +6,10 @@
%%
%% morewrites.dtx (with options: `package')
%%
-%% Communicate any suggestions for changing this package
-%% to Bruno Le Floch (blflatex@gmail.com).
+%% Suggestions/comments/bug reports welcome at
+%% https://github.com/blefloch/latex-morewrites
%%
-%% File: morewrites.dtx Copyright (C) 2011-2018 Bruno Le Floch
+%% File: morewrites.dtx Copyright (C) 2011-2024 Bruno Le Floch
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -21,10 +21,9 @@
%% This work has the LPPL maintenance status 'maintained'
%% and the current maintainer is Bruno Le Floch.
%% -----------------------------------------------------------------------
-\RequirePackage {expl3} [2018/02/21]
-\RequirePackage {primargs} [2018/12/29]
+\RequirePackage {primargs} [2024/01/05]
\ProvidesExplPackage
- {morewrites} {2018/12/29} {} {Always room for a new write}
+ {morewrites} {2024/01/05} {} {Always room for a new write}
\sys_if_engine_luatex:T
{
\cs_new_protected:Npn \morewritessetup #1 { }
@@ -43,7 +42,9 @@
\cs_generate_variant:Nn \prop_gput:Nnn { NVx }
\cs_generate_variant:Nn \tl_gput_right:Nn { Nv }
\tl_new:N \l__morewrites_internal_tl
+\seq_new:N \l__morewrites_internal_seq
\cs_new_eq:NN \__morewrites_tmp:w ?
+\bool_new:N \l__morewrites_verbose_bool
\int_new:N \g__morewrites_later_int
\seq_new:N \g__morewrites_write_seq
\prop_new:N \g__morewrites_write_prop
@@ -60,6 +61,8 @@
\bool_gset_false:N \g__morewrites_tmp_file_bool
\int_new:N \g__morewrites_group_level_int
\box_new:N \g__morewrites_shipout_box
+\cs_new_protected:Npn \__morewrites_verbose:n #1
+ { \bool_if:NT \l__morewrites_verbose_bool { \iow_term:e { morewrites:~#1 } } }
\cs_new_protected:Npn \__morewrites_set_file:n #1
{
\bool_gset_false:N \g__morewrites_tmp_file_bool
@@ -68,14 +71,14 @@
\cs_new_protected:Npn \__morewrites_empty_file:n #1
{
\__morewrites_tex_immediate:w \__morewrites_tex_openout:w
- \g__morewrites_iow = #1 \scan_stop:
+ \g__morewrites_iow = {#1} \scan_stop:
\__morewrites_tex_immediate:w \__morewrites_tex_closeout:w
\g__morewrites_iow
}
\prg_new_conditional:Npnn \__morewrites_if_file_trivial:n #1 { TF }
{
\group_begin:
- \tex_openin:D \g__morewrites_ior = #1 \scan_stop:
+ \tex_openin:D \g__morewrites_ior = {#1}
\if_eof:w \g__morewrites_ior
\cs_gset_eq:NN \__morewrites_tmp:w \prg_return_true:
\else:
@@ -93,16 +96,32 @@
}
\cs_new_protected:Npn \__morewrites_chk_file:
{
+ \tl_gset:Ne \g__morewrites_tmp_file_tl
+ { \tl_to_str:e { \g__morewrites_tmp_file_tl } }
\__morewrites_if_file_trivial:nTF { \g__morewrites_tmp_file_tl }
{ \bool_gset_true:N \g__morewrites_tmp_file_bool }
{
+ \__morewrites_chk_file_aux:
\msg_warning:nnxx { morewrites } { file-exists }
- { \g__morewrites_tmp_file_tl }
- { \g__morewrites_tmp_file_tl .mw }
- \tl_gput_right:Nn \g__morewrites_tmp_file_tl { .mw }
+ { \g__morewrites_tmp_file_tl } { \l__morewrites_internal_tl }
+ \tl_gset_eq:NN \g__morewrites_tmp_file_tl \l__morewrites_internal_tl
\__morewrites_chk_file:
}
}
+\cs_new_protected:Npn \__morewrites_chk_file_aux:
+ {
+ \regex_extract_once:nVNTF
+ { \A (\D*) (\d*) .mw \Z } \g__morewrites_tmp_file_tl \l__morewrites_internal_seq
+ {
+ \tl_set:Ne \l__morewrites_internal_tl
+ {
+ \seq_item:Nn \l__morewrites_internal_seq { 2 }
+ \int_eval:n { \seq_item:Nn \l__morewrites_internal_seq { 3 } + 1 }
+ .mw
+ }
+ }
+ { \tl_set:Ne \l__morewrites_internal_tl { \g__morewrites_tmp_file_tl .mw } }
+ }
\msg_new:nnnn { morewrites } { file-exists }
{ File~'#1'~exists,~using~'#2'~instead. }
{
@@ -117,7 +136,7 @@
\cs_new_protected:Npn \__morewrites_equals_file:N #1
{
\group_begin:
- \tex_aftergroup:D \primargs_get_file_name:N
+ \tex_aftergroup:D \primargs_get_input_file_name:N
\tex_aftergroup:D #1
\primargs_remove_equals:N \group_end:
}
@@ -130,7 +149,7 @@
\cs_new_protected:Npn \__morewrites_user_to_tstr:NTF #1
{
\tl_set:NV \l__morewrites_tstr_tl \l__morewrites_user_int
- \int_compare:nNnTF { \l__morewrites_user_int } < { 19 }
+ \int_compare:nNnTF { \l__morewrites_user_int } < { 129 }
{ \use_i:nn }
{ \prop_get:NVNTF #1 \l__morewrites_user_int \l__morewrites_tstr_tl }
}
@@ -180,7 +199,11 @@
{
\token_if_eq_meaning:NNTF \g_primargs_token \s__morewrites
{ \__morewrites_immediate_auxiii:N }
- { \__morewrites_tex_immediate:w }
+ {
+ \__morewrites_verbose:n
+ { \tl_to_str:n { \immediate } \token_to_meaning:N \g_primargs_token }
+ \__morewrites_tex_immediate:w
+ }
}
\cs_new_protected:Npn \__morewrites_immediate_auxiii:N #1
{ \str_if_eq:nnTF { #1 } { \s__morewrites } { \use_iii:nnn } { #1 } }
@@ -193,6 +216,11 @@
}
\cs_new_protected:Npn \__morewrites_closeout_now:
{
+ \__morewrites_verbose:n { \tl_to_str:n { \immediate \closeout } \int_use:N \l__morewrites_user_int }
+ \__morewrites_closeout_now_silent:
+ }
+\cs_new_protected:Npn \__morewrites_closeout_now_silent:
+ {
\__morewrites_user_to_tstr:NTF \g__morewrites_write_prop
{
\__morewrites_tex_immediate:w \__morewrites_tex_closeout:w \l__morewrites_tstr_tl \exp_stop_f:
@@ -209,7 +237,7 @@
}
\cs_new_protected:Npn \__morewrites_closeout_now:nn #1#2
{
- \__morewrites_tex_immediate:w \__morewrites_tex_openout:w \g__morewrites_iow = #2 \scan_stop:
+ \__morewrites_tex_immediate:w \__morewrites_tex_openout:w \g__morewrites_iow = {#2}
\group_begin:
\int_set:Nn \tex_newlinechar:D { -1 }
\tl_use:c { \__morewrites_user_tl_name:n {#1} }
@@ -226,18 +254,28 @@
}
\cs_new_protected:Npn \__morewrites_openout_now:n #1
{
- \__morewrites_closeout_now:
- \int_compare:nNnTF { \l__morewrites_user_int } < { 19 }
+ \__morewrites_verbose:n
+ {
+ \tl_to_str:n { \immediate\openout }
+ \int_use:N \l__morewrites_user_int
+ \c_space_tl = ~ {#1}
+ }
+ \__morewrites_openout_now_silent:n {#1}
+ }
+\cs_new_protected:Npn \__morewrites_openout_now_silent:n #1
+ {
+ \__morewrites_closeout_now_silent:
+ \int_compare:nNnTF { \l__morewrites_user_int } < { 129 }
{
\__morewrites_tex_immediate:w \__morewrites_tex_openout:w \l__morewrites_user_int
- = \tl_to_str:n {#1} \scan_stop:
+ = { \tl_to_str:n {#1} }
}
{
\seq_gpop:NNTF \g__morewrites_write_seq \l__morewrites_tstr_tl
{
\prop_gput:NVV \g__morewrites_write_prop \l__morewrites_user_int \l__morewrites_tstr_tl
\__morewrites_tex_immediate:w \__morewrites_tex_openout:w \l__morewrites_tstr_tl \exp_stop_f:
- = \tl_to_str:n {#1} \scan_stop:
+ = { \tl_to_str:n {#1} }
}
{
\__morewrites_empty_file:n {#1}
@@ -257,27 +295,54 @@
\cs_new_protected:Npn \__morewrites_write_now:w
{
\__morewrites_user_to_tstr:NTF \g__morewrites_write_prop
- { \__morewrites_tex_immediate:w \__morewrites_tex_write:w \l__morewrites_tstr_tl \exp_stop_f: }
+ {
+ \int_compare:nNnT \l__morewrites_user_int = { 18 } { \use_iii:nnn }
+ \int_compare:nT { -1 < \l__morewrites_user_int < 16 }
+ {
+ \__morewrites_verbose:n
+ {
+ \tl_to_str:n { \immediate \write }
+ \int_use:N \l__morewrites_user_int
+ }
+ }
+ \__morewrites_tex_immediate:w \__morewrites_tex_write:w \l__morewrites_tstr_tl \exp_stop_f:
+ }
{ \primargs_get_general_text:N \__morewrites_write_now:n }
}
-\cs_new_protected:Npn \__morewrites_write_now:n
+\cs_new_protected:Npn \__morewrites_write_now:n #1
{
\prop_get:NVNTF \g__morewrites_write_file_prop \l__morewrites_user_int \l__morewrites_internal_tl
- { \__morewrites_write_now_open:n }
- { \__morewrites_tex_immediate:w \__morewrites_tex_write:w 16 }
+ {
+ \__morewrites_verbose:n
+ {
+ \tl_to_str:n { \immediate \write }
+ \int_use:N \l__morewrites_user_int
+ \tl_to_str:n { ~ {#1} }
+ }
+ \__morewrites_write_now_open:n {#1}
+ }
+ {
+ \__morewrites_verbose:n
+ {
+ \tl_to_str:n { \immediate \write }
+ \int_use:N \l__morewrites_user_int
+ \tl_to_str:n { ~ (closed) ~ {#1} }
+ }
+ \__morewrites_tex_immediate:w \__morewrites_tex_write:w 16 {#1}
+ }
}
\cs_new_protected:Npn \__morewrites_write_now_open:n #1
{
\bool_if:NF \g__morewrites_tmp_file_bool { \__morewrites_chk_file: }
\__morewrites_tex_immediate:w \__morewrites_tex_openout:w
- \g__morewrites_iow = \g__morewrites_tmp_file_tl \scan_stop:
+ \g__morewrites_iow = { \g__morewrites_tmp_file_tl }
\__morewrites_tex_immediate:w \__morewrites_tex_write:w
\g__morewrites_iow {#1}
\__morewrites_tex_immediate:w \__morewrites_tex_closeout:w
\g__morewrites_iow
\group_begin:
\int_set:Nn \tex_endlinechar:D { -1 }
- \tex_openin:D \g__morewrites_ior = \g__morewrites_tmp_file_tl \scan_stop:
+ \tex_openin:D \g__morewrites_ior = { \g__morewrites_tmp_file_tl }
\__morewrites_write_now_loop:
\tex_closein:D \g__morewrites_ior
\__morewrites_collect_gput_right:c
@@ -319,37 +384,64 @@
{ \tl_use:c { c__morewrites_later_ \int_eval:n {#1} _tl } }
\cs_new_protected:Npn \__morewrites_closeout_later:
{
- \int_compare:nNnTF \l__morewrites_user_int < { 19 }
+ \__morewrites_verbose:n { \tl_to_str:n { \closeout (later) ~ } \int_use:N \l__morewrites_user_int }
+ \int_compare:nNnTF \l__morewrites_user_int < { 129 }
{ \__morewrites_tex_closeout:w \l__morewrites_user_int }
- { \__morewrites_later:n { \__morewrites_closeout_now: } }
+ { \__morewrites_later:n { \__morewrites_closeout_now_silent: } }
}
\cs_new_protected:Npn \__morewrites_openout_later:w
{
- \int_compare:nNnTF \l__morewrites_user_int < { 19 }
- { \__morewrites_tex_openout:w \l__morewrites_user_int }
+ \int_compare:nNnTF \l__morewrites_user_int < { 129 }
+ {
+ \__morewrites_verbose:n { \tl_to_str:n { \openout (later) ~ } \int_use:N \l__morewrites_user_int }
+ \__morewrites_tex_openout:w \l__morewrites_user_int
+ }
{ \__morewrites_equals_file:N \__morewrites_openout_later:n }
}
\cs_new_protected:Npn \__morewrites_openout_later:n #1
- { \__morewrites_later:n { \__morewrites_openout_now:n {#1} } }
+ {
+ \__morewrites_verbose:n
+ {
+ \tl_to_str:n { \openout (later)~ }
+ \int_use:N \l__morewrites_user_int
+ \c_space_tl = ~ {#1}
+ }
+ \__morewrites_later:n { \__morewrites_openout_now_silent:n {#1} }
+ }
\cs_new_protected:Npn \__morewrites_write_later:w
{
- \int_compare:nNnTF \l__morewrites_user_int < { 19 }
- { \__morewrites_tex_write:w \l__morewrites_user_int }
+ \int_compare:nNnTF \l__morewrites_user_int < { 129 }
+ {
+ \__morewrites_verbose:n { \tl_to_str:n { \write (later)~ } \int_use:N \l__morewrites_user_int }
+ \__morewrites_tex_write:w \l__morewrites_user_int
+ }
{ \primargs_get_general_text:N \__morewrites_write_later:n }
}
\cs_new_protected:Npn \__morewrites_write_later:n #1
- { \__morewrites_later:n { \__morewrites_write_later_aux:n {#1} } }
+ {
+ \__morewrites_verbose:n
+ {
+ \tl_to_str:n { \write (later)~ }
+ \int_use:N \l__morewrites_user_int
+ \tl_to_str:n { ~ {#1} }
+ }
+ \__morewrites_later:n { \__morewrites_write_later_aux:n {#1} }
+ }
\cs_new_protected:Npn \__morewrites_write_later_aux:n
{
\__morewrites_user_to_tstr:NTF \g__morewrites_write_prop
{ \__morewrites_tex_immediate:w \__morewrites_tex_write:w \l__morewrites_tstr_tl \exp_stop_f: }
- { \__morewrites_write_now:n }
+ {
+ \prop_get:NVNTF \g__morewrites_write_file_prop \l__morewrites_user_int \l__morewrites_internal_tl
+ { \__morewrites_write_now_open:n }
+ { \__morewrites_tex_immediate:w \__morewrites_tex_write:w 16 \exp_stop_f: }
+ }
}
\cs_new_protected:Npn \__morewrites_before_shipout:
{
\bool_if:NF \g__morewrites_tmp_file_bool { \__morewrites_chk_file: }
\__morewrites_tex_immediate:w \__morewrites_tex_openout:w
- \g__morewrites_iow = \g__morewrites_tmp_file_tl \scan_stop:
+ \g__morewrites_iow = { \g__morewrites_tmp_file_tl }
}
\cs_new_protected:Npn \__morewrites_after_shipout:
{
@@ -364,7 +456,7 @@
\tl_set:Nx \l__morewrites_internal_tl
{
\exp_after:wN \__morewrites_after_shipout_loop:ww
- \tex_input:D \g__morewrites_tmp_file_tl \c_space_tl
+ \tex_input:D { \g__morewrites_tmp_file_tl }
}
\__morewrites_empty_file:n { \g__morewrites_tmp_file_tl }
\exp_args:NNo
@@ -436,7 +528,10 @@
\cs_new_protected:Npn \__morewrites_close_all:
{
\prop_map_inline:Nn \g__morewrites_write_prop
- { \__morewrites_tex_immediate:w \__morewrites_tex_closeout:w ##2 \scan_stop: }
+ {
+ \__morewrites_verbose:n { \tl_to_str:n { \immediate \closeout } ##1 ~ (at~end) }
+ \__morewrites_tex_immediate:w \__morewrites_tex_closeout:w ##2 \scan_stop:
+ }
\prop_gclear:N \g__morewrites_write_prop
\prop_map_function:NN \g__morewrites_write_file_prop
\__morewrites_closeout_now:nn
@@ -451,7 +546,7 @@
}
\AtEndDocument { \__morewrites_close_all_at_end:nw { 5 } }
\int_new:N \g__morewrites_alloc_write_int
-\int_gset:Nn \g__morewrites_alloc_write_int { 18 }
+\int_gset:Nn \g__morewrites_alloc_write_int { 128 }
\cs_new_protected:Npn \__morewrites_newwrite:N #1
{
\int_gincr:N \g__morewrites_alloc_write_int
@@ -485,7 +580,8 @@
{
allocate .code:n = \__morewrites_allocate:n {#1} ,
file .code:n = \__morewrites_set_file:n {#1} ,
- file .initial:n = \c_sys_jobname_str .mw
+ file .initial:n = \c_sys_jobname_str .mw ,
+ verbose .bool_set:N = \l__morewrites_verbose_bool
}
\cs_gset_eq:NN \immediate \__morewrites_immediate:w
\cs_gset_eq:NN \openout \__morewrites_openout:w
diff --git a/Master/texmf-dist/tex/latex/morewrites/primargs.sty b/Master/texmf-dist/tex/latex/morewrites/primargs.sty
index 0211368429c..111b2f657f0 100644
--- a/Master/texmf-dist/tex/latex/morewrites/primargs.sty
+++ b/Master/texmf-dist/tex/latex/morewrites/primargs.sty
@@ -6,10 +6,10 @@
%%
%% primargs.dtx (with options: `package')
%%
-%% Communicate any suggestions for changing this package
-%% to Bruno Le Floch (blflatex@gmail.com).
+%% Suggestions/comments/bug reports welcome at
+%% https://github.com/blefloch/latex-morewrites
%%
-%% File: primargs.dtx Copyright (C) 2012-2018 Bruno Le Floch
+%% File: primargs.dtx Copyright (C) 2012-2024 Bruno Le Floch
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -21,9 +21,8 @@
%% This work has the LPPL maintenance status 'maintained'
%% and the current maintainer is Bruno Le Floch.
%% -----------------------------------------------------------------------
-\RequirePackage {expl3} [2018/02/21]
\ProvidesExplPackage
- {primargs} {2018/12/29} {} {Parsing arguments of primitives}
+ {primargs} {2024/01/05} {} {Parsing arguments of primitives}
\tl_new:N \g__primargs_code_tl
\tl_new:N \g__primargs_file_name_tl
\tl_new:N \g__primargs_file_name_level_tl
@@ -259,7 +258,7 @@
}
\cs_new_protected:Npn \__primargs_get_file_name_char:
{
- \token_if_eq_charcode:NNT " \g_primargs_token
+ \token_if_eq_charcode:NNT " \g_primargs_token % "
{
\tl_gset:Nx \g__primargs_file_name_level_tl
{ \int_eval:n { 1 - \g__primargs_file_name_level_tl } }
@@ -275,8 +274,6 @@
\cs_new:Npn \__primargs_get_file_name_char_ii:w #1 ~ #2 ~ #3 \q_stop
{ \__primargs_get_file_name_char_iii:w #3 ~ #3 ~ \q_stop }
\cs_new:Npn \__primargs_get_file_name_char_iii:w #1 ~ #2 ~ #3 \q_stop {#2}
-\sys_if_engine_luatex:TF
- {
\cs_new_protected:Npn \primargs_get_input_file_name:N #1
{
\group_begin:
@@ -343,8 +340,6 @@
}
\__primargs_get_input_file_name_loop:
}
- }
- { \cs_new_eq:NN \primargs_get_input_file_name:N \primargs_get_file_name:N }
%%
%%
%% End of file `primargs.sty'.