summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/morewrites
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-20 21:10:32 +0000
committerKarl Berry <karl@freefriends.org>2017-04-20 21:10:32 +0000
commit984b6c73a69561c9051fb490df8d992173ba29ee (patch)
tree3ebf98d8f91eebdfb393a083a348fda8661ee4d6 /Master/texmf-dist/tex/latex/morewrites
parent2e69378317d597453b5549824c8dcbee6a4676d9 (diff)
morewrites (20apr17)
git-svn-id: svn://tug.org/texlive/trunk@43945 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/morewrites')
-rw-r--r--Master/texmf-dist/tex/latex/morewrites/morewrites.sty103
1 files changed, 21 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/latex/morewrites/morewrites.sty b/Master/texmf-dist/tex/latex/morewrites/morewrites.sty
index 5f87462496a..a337c6fc865 100644
--- a/Master/texmf-dist/tex/latex/morewrites/morewrites.sty
+++ b/Master/texmf-dist/tex/latex/morewrites/morewrites.sty
@@ -22,7 +22,7 @@
\RequirePackage {expl3} [2017/03/18]
\RequirePackage {primargs} [2017/04/10]
\ProvidesExplPackage
- {morewrites} {2017/04/10} {} {Always room for a new write}
+ {morewrites} {2017/04/20} {} {Always room for a new write}
\sys_if_engine_luatex:T
{
\cs_new_protected:Npn \morewritessetup #1 { }
@@ -35,12 +35,6 @@
\cs_new_eq:NN \__morewrites_tex_openout:w \tex_openout:D
\cs_new_eq:NN \__morewrites_tex_write:w \tex_write:D
\cs_new_eq:NN \__morewrites_tex_closeout:w \tex_closeout:D
-\cs_new_eq:NN \__morewrites_tex_openin:w \tex_openin:D
-\cs_new_eq:NN \__morewrites_tex_read:w \tex_read:D
-\cs_new_eq:NN \__morewrites_tex_readline:w \etex_readline:D
-\cs_new_eq:NN \__morewrites_tex_closein:w \tex_closein:D
-\exp_args:NNf \cs_new_protected:Npn \__morewrites_tex_newread:N
- { \exp_args:NNc \exp_after:wN \exp_stop_f: { newread } }
\exp_args:NNf \cs_new_protected:Npn \__morewrites_tex_newwrite:N
{ \exp_args:NNc \exp_after:wN \exp_stop_f: { newwrite } }
\cs_generate_variant:Nn \prop_gpop:NnNT { NV }
@@ -49,9 +43,7 @@
\tl_new:N \l__morewrites_internal_tl
\cs_new_eq:NN \__morewrites_tmp:w ?
\int_new:N \g__morewrites_later_int
-\seq_new:N \g__morewrites_read_seq
\seq_new:N \g__morewrites_write_seq
-\prop_new:N \g__morewrites_read_prop
\prop_new:N \g__morewrites_write_prop
\prop_new:N \g__morewrites_write_file_prop
\tl_new:N \l__morewrites_code_tl
@@ -180,51 +172,6 @@
\cs_generate_variant:Nn \__morewrites_collect_gput_right:N { c }
\cs_new:Npn \__morewrites_user_tl_name:n #1
{ g__morewrites_iow_ \int_eval:n {#1} _tl }
-\cs_new_protected:Npn \__morewrites_openin:w
- {
- \__morewrites_get_user:n
- {
- \__morewrites_user_to_tstr:NTF \g__morewrites_read_prop { }
- {
- \seq_pop:NNF \g__morewrites_read_seq \l__morewrites_tstr_tl
- {
- \__morewrites_tex_newread:N \l__morewrites_tstr_token
- \tl_set:NV \l__morewrites_tstr_tl \l__morewrites_tstr_token
- }
- \prop_gput:NVV \g__morewrites_read_prop \l__morewrites_user_int \l__morewrites_tstr_tl
- }
- \__morewrites_tex_openin:w \l__morewrites_tstr_tl \exp_stop_f:
- }
- }
-\cs_new_protected:Npn \__morewrites_read:w
- {
- \__morewrites_get_user:n
- {
- \__morewrites_user_to_tstr:NTF \g__morewrites_read_prop { } { }
- \__morewrites_tex_read:w \l__morewrites_tstr_tl \exp_stop_f:
- }
- }
-\cs_new_protected:Npn \__morewrites_readline:w
- {
- \__morewrites_get_user:n
- {
- \__morewrites_user_to_tstr:NTF \g__morewrites_read_prop { } { }
- \__morewrites_tex_readline:w \l__morewrites_tstr_tl \exp_stop_f:
- }
- }
-\cs_new_protected:Npn \__morewrites_closein:w
- {
- \__morewrites_get_user:n
- {
- \__morewrites_user_to_tstr:NTF \g__morewrites_read_prop { } { }
- \int_compare:nNnF { \l__morewrites_tstr_tl } = { \l__morewrites_user_int }
- {
- \prop_gremove:NV \g__morewrites_read_prop \l__morewrites_user_int
- \seq_gput_left:NV \g__morewrites_read_seq \l__morewrites_tstr_tl
- }
- \__morewrites_tex_closein:w \l__morewrites_tstr_tl \exp_stop_f:
- }
- }
\cs_new_protected:Npn \__morewrites_immediate:w
{ \primargs_read_x_token:N \__morewrites_immediate_auxii: }
\cs_new_protected:Npn \__morewrites_immediate_auxii:
@@ -278,17 +225,24 @@
\cs_new_protected:Npn \__morewrites_openout_now:n #1
{
\__morewrites_closeout_now:
- \seq_pop:NNTF \g__morewrites_write_seq \l__morewrites_tstr_tl
+ \int_compare:nNnTF { \l__morewrites_user_int } < { 19 }
{
- \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:
+ \__morewrites_tex_immediate:w \__morewrites_tex_openout:w \l__morewrites_user_int
= \tl_to_str:n {#1} \scan_stop:
}
{
- \__morewrites_empty_file:n {#1}
- \prop_gput:NVx \g__morewrites_write_file_prop \l__morewrites_user_int
- { \tl_to_str:n {#1} }
- \tl_gclear_new:c { \__morewrites_user_tl_name:n { \l__morewrites_user_int } }
+ \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:
+ }
+ {
+ \__morewrites_empty_file:n {#1}
+ \prop_gput:NVx \g__morewrites_write_file_prop \l__morewrites_user_int
+ { \tl_to_str:n {#1} }
+ \tl_gclear_new:c { \__morewrites_user_tl_name:n { \l__morewrites_user_int } }
+ }
}
}
\cs_new_protected:Npn \__morewrites_write:w
@@ -463,6 +417,7 @@
\GXTorg@shipout
\AtBegShi@OrgShipout
\AtBeginShipoutOriginalShipout
+ \minidocument@orig@shipout
\shipout
}
{
@@ -478,9 +433,12 @@
}
\cs_new_protected:Npn \__morewrites_close_all:
{
- \prop_map_function:NN \g__morewrites_write_prop
- \__morewrites_closeout_now:nn
+ \prop_map_inline:Nn \g__morewrites_write_prop
+ { \__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
+ \prop_gclear:N \g__morewrites_write_file_prop
}
\cs_new_protected:Npn \__morewrites_close_all_at_end:nw #1#2 \@@end
{
@@ -490,22 +448,8 @@
\@@end
}
\AtEndDocument { \__morewrites_close_all_at_end:nw { 5 } }
-\int_new:N \g__morewrites_alloc_read_int
-\int_set:Nn \g__morewrites_alloc_read_int { 18 }
\int_new:N \g__morewrites_alloc_write_int
\int_set:Nn \g__morewrites_alloc_write_int { 18 }
-\cs_new_protected:Npn \__morewrites_newread:N #1
- {
- \int_gincr:N \g__morewrites_alloc_read_int
- \int_set_eq:NN \allocationnumber \g__morewrites_alloc_read_int
- \cs_undefine:N #1
- \int_const:Nn #1 { \allocationnumber }
- \wlog
- {
- \token_to_str:N #1
- = \token_to_str:N \read \int_use:N \allocationnumber
- }
- }
\cs_new_protected:Npn \__morewrites_newwrite:N #1
{
\int_gincr:N \g__morewrites_alloc_write_int
@@ -541,11 +485,6 @@
file .code:n = \__morewrites_set_file:n {#1} ,
file .initial:n = \c_sys_jobname_str .mw
}
-\cs_gset_eq:NN \openin \__morewrites_openin:w
-\cs_gset_eq:NN \read \__morewrites_read:w
-\cs_gset_eq:NN \readline \__morewrites_readline:w
-\cs_gset_eq:NN \closein \__morewrites_closein:w
-\cs_gset_eq:NN \newread \__morewrites_newread:N
\cs_gset_eq:NN \immediate \__morewrites_immediate:w
\cs_gset_eq:NN \openout \__morewrites_openout:w
\cs_gset_eq:NN \write \__morewrites_write:w