diff options
author | Norbert Preining <norbert@preining.info> | 2019-11-03 03:01:01 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-11-03 03:01:01 +0000 |
commit | aa26106a9b77529d1eae806729d8076378ced64b (patch) | |
tree | c1a96609e17d84e6fc764caf3a52c65e7ed8c5eb /macros/latex/contrib/xsim/code | |
parent | 3479a92321ed7fe7e2133d3daec2d4f5fd53fbc6 (diff) |
CTAN sync 201911030301
Diffstat (limited to 'macros/latex/contrib/xsim/code')
-rw-r--r-- | macros/latex/contrib/xsim/code/xsim.auxfile.code.tex | 52 | ||||
-rw-r--r-- | macros/latex/contrib/xsim/code/xsim.sty | 26 | ||||
-rw-r--r-- | macros/latex/contrib/xsim/code/xsim.verbwrite.code.tex | 14 |
3 files changed, 67 insertions, 25 deletions
diff --git a/macros/latex/contrib/xsim/code/xsim.auxfile.code.tex b/macros/latex/contrib/xsim/code/xsim.auxfile.code.tex index 39a4306f59..8018694616 100644 --- a/macros/latex/contrib/xsim/code/xsim.auxfile.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.auxfile.code.tex @@ -25,31 +25,67 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\XSIMmodule{auxfile}{writing stuff to the aux file} +\XSIMmodule{auxfile}{writing stuff to an auxiliary file} + +\prg_new_conditional:Npnn \xsim_if_use_aux: {p,T,F,TF} + { + \bool_if:NTF \g_xsim_use_aux_bool + { \prg_return_true: } + { \prg_return_false: } + } \cs_new_protected:Npn \xsim_write_to_aux:n #1 - { \iow_now:Nn \@auxout {#1} } + { + \legacy_if:nT {@filesw} + { + \xsim_if_use_aux:TF + { \iow_now:Nn \@auxout {#1} } + { \iow_now:Nn \l__xsim_aux_file_iow {#1} } + } + } \cs_generate_variant:Nn \xsim_write_to_aux:n {x} % -------------------------------------------------------------------------- \cs_new_protected:Npn \XSIM #1 { \use:c {XSIMaux#1} } +\cs_new_protected:Npn \xsim_new_aux_cs:cpn #1 + { \cs_new_protected:cpn {XSIMaux#1} } + +\cs_new_protected:Npn \xsim_add_cs_to_aux:nn #1#2 + { + \xsim_verbose:n { Writing~ command~ \XSIM {#1}~ to~ aux~ file } + \xsim_write_to_aux:x { \token_to_str:N \XSIM {#1} #2 } + } + \AtBeginDocument { - \xsim_write_to_aux:x + \iow_now:Nx \@auxout { \token_to_str:N \providecommand \token_to_str:N \XSIM [1] {} } } -\cs_new_protected:Npn \xsim_new_aux_cs:cpn #1 - { \cs_new_protected:cpn {XSIMaux#1} } +% ---------------------------------------------------------------------------- -\cs_new_protected:Npn \xsim_add_cs_to_aux:nn #1#2 +\xsim_if_use_aux:F { - \xsim_verbose:n { Writing~ command~ \XSIM {#1}~ to~ aux~ file } - \xsim_write_to_aux:x { \XSIM {#1} #2 } + \iow_new:N \l__xsim_aux_file_iow + \AtBeginDocument + { \iow_open:Nn \l__xsim_aux_file_iow { \c_sys_jobname_str .xsim } } } +\cs_new_protected:Npn \xsim_close_aux: + { + \xsim_if_use_aux:F + { + \iow_close:N \l__xsim_aux_file_iow + \legacy_if:nT {@filesw} + { \iow_now:Nx \@auxout { \token_to_str:N \XSIM {readaux} } } + } + } + +\xsim_new_aux_cs:cpn {readaux} + { \file_input:n { \c_sys_jobname_str .xsim } } + % ---------------------------------------------------------------------------- % list for recording values that need to be written to the aux file and % updated at begin document diff --git a/macros/latex/contrib/xsim/code/xsim.sty b/macros/latex/contrib/xsim/code/xsim.sty index a11fe99ada..a56fa8ecf5 100644 --- a/macros/latex/contrib/xsim/code/xsim.sty +++ b/macros/latex/contrib/xsim/code/xsim.sty @@ -29,10 +29,10 @@ \ExplSyntaxOn -\tl_const:Nn \c_xsim_date_tl {2019/10/19} +\tl_const:Nn \c_xsim_date_tl {2019/11/02} \tl_const:Nn \c_xsim_version_major_number_tl {0} -\tl_const:Nn \c_xsim_version_minor_number_tl {14} -\tl_const:Nn \c_xsim_version_subrelease_tl {a} +\tl_const:Nn \c_xsim_version_minor_number_tl {15} +\tl_const:Nn \c_xsim_version_subrelease_tl {} \tl_const:Nx \c_xsim_version_number_tl { \c_xsim_version_major_number_tl . @@ -58,7 +58,9 @@ \bool_new:N \g_xsim_final_bool \bool_new:N \g_xsim_verbose_bool \bool_new:N \g_xsim_clear_aux_bool -\bool_new:N \l__xsim_write_to_file_bool +\bool_new:N \g__xsim_write_to_file_bool +\bool_new:N \g_xsim_use_aux_bool +\bool_new:N \g__xsim_rerun_bool \keys_define:nn {xsim/package} { @@ -66,7 +68,9 @@ verbose .bool_gset:N = \g_xsim_verbose_bool , clear-aux .bool_gset:N = \g_xsim_clear_aux_bool , no-files .bool_gset_inverse:N = \g__xsim_write_to_file_bool , - no-files .initial:n = false + no-files .initial:n = false , + use-aux .bool_gset:N = \g_xsim_use_aux_bool , + use-aux .initial:n = false } \ProcessKeysPackageOptions {xsim/package} @@ -87,12 +91,10 @@ synchronized. } -\msg_new:nnn {xsim} {verbose} { #1 ~(\msg_line_context:) } +\msg_new:nnn {xsim} {verbose} { #1 ~( \msg_line_context: ) } % -------------------------------------------------------------------------- -\bool_new:N \g__xsim_rerun_bool - \cs_new_protected:Npn \xsim_do_rerun: { \xsim_if_rerun:T { \msg_warning:nn {xsim} {rerun} } } @@ -105,6 +107,10 @@ % -------------------------------------------------------------------------- \xsim_load_modules:n {definitions} -\AtEndDocument { \xsim_do_rerun: } - +\AtEndDocument + { + \xsim_do_rerun: + \xsim_close_aux: + } + \file_input_stop: diff --git a/macros/latex/contrib/xsim/code/xsim.verbwrite.code.tex b/macros/latex/contrib/xsim/code/xsim.verbwrite.code.tex index 4738dc7786..bc9b2ce096 100644 --- a/macros/latex/contrib/xsim/code/xsim.verbwrite.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.verbwrite.code.tex @@ -29,7 +29,7 @@ \xsim_load_modules:n {base} -\iow_new:N \l__file_contents_iow +\iow_new:N \l__xsim_file_contents_iow \tl_new:N \l_xsim_file_begin_tl \tl_new:N \l_xsim_file_end_tl \int_new:N \l_xsim_line_gobble_int @@ -129,12 +129,12 @@ \xsim_if_final:TF % { \xsim_verbose:x { Not~ (re-)writing~ file~ `#1'. } } % { \xsim_verbose:x { (Re-)writing~ file~ `#1'. } } % - \__xsim_open_stream:Nn \l__file_contents_iow {#1} % + \__xsim_open_stream:Nn \l__xsim_file_contents_iow {#1} % \tl_if_blank:VF \l_xsim_file_begin_tl % { % \xsim_if_final:F % { % - \iow_now:Nx \l__file_contents_iow % + \iow_now:Nx \l__xsim_file_contents_iow % { \l_xsim_file_begin_tl } % } % } % @@ -150,13 +150,13 @@ } % { % \tl_if_blank:nTF {##3} % - { \__xsim_write_to_stream:Nn \l__file_contents_iow {##1} } % + { \__xsim_write_to_stream:Nn \l__xsim_file_contents_iow {##1} } % { % \cs_set:Npx \__xsim_M:w { \exp_not:N \end {\@currenvir} } % \char_set_active_eq:nN {13} \__xsim_M:w % % the last line is `##1 \end{\@currenvir} ##2': \tl_if_blank:nF {##1} % - { \__xsim_write_to_stream:Nn \l__file_contents_iow {##1} }% + { \__xsim_write_to_stream:Nn \l__xsim_file_contents_iow {##1} }% \tl_if_blank:nF {##2} % {} % } % @@ -184,11 +184,11 @@ { \xsim_if_final:F { - \iow_now:Nx \l__file_contents_iow + \iow_now:Nx \l__xsim_file_contents_iow { \l_xsim_file_end_tl } } } - \__xsim_close_stream:N \l__file_contents_iow + \__xsim_close_stream:N \l__xsim_file_contents_iow \group_end: } |