diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3file.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3file.dtx | 87 |
1 files changed, 53 insertions, 34 deletions
diff --git a/macros/latex/contrib/l3kernel/l3file.dtx b/macros/latex/contrib/l3kernel/l3file.dtx index 5dd15d0e3d..c9c1fd72ee 100644 --- a/macros/latex/contrib/l3kernel/l3file.dtx +++ b/macros/latex/contrib/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-10-02} +% \date{Released 2019-10-11} % % \maketitle % @@ -1043,11 +1043,18 @@ %</package> } \cs_generate_variant:Nn \__kernel_ior_open:Nn { No } -\cs_new_protected:Npn \@@_open_stream:Nn #1#2 +% \end{macrocode} +% Here, we act defensively in case \LuaTeX{} is in use with an +% extensionless file name. +% \begin{macrocode} +\cs_new_protected:Npx \@@_open_stream:Nn #1#2 { - \tex_global:D \tex_chardef:D #1 = \l_@@_stream_tl \scan_stop: - \prop_gput:NVn \g_@@_streams_prop #1 {#2} - \tex_openin:D #1 #2 \scan_stop: + \tex_global:D \tex_chardef:D #1 = \exp_not:N \l_@@_stream_tl \scan_stop: + \prop_gput:NVn \exp_not:N \g_@@_streams_prop #1 {#2} + \tex_openin:D #1 + \sys_if_engine_luatex:TF + { {#2} } + { #2 \scan_stop: } } % \end{macrocode} % \end{macro} @@ -2251,25 +2258,12 @@ % \g_file_curr_ext_str , % \g_file_curr_name_str % } -% The name of the current file should be available at all times. -% For the format the file name needs to be picked up at the start of the -% run. In \LaTeXe{} package mode the current file name is collected from -% \tn{@currname}. +% The name of the current file should be available at all times: +% the name itself is set dynamically. % \begin{macrocode} \str_new:N \g_file_curr_dir_str \str_new:N \g_file_curr_ext_str \str_new:N \g_file_curr_name_str -%<*initex> -\tex_everyjob:D \exp_after:wN - { - \tex_the:D \tex_everyjob:D - \str_gset:Nx \g_file_curr_name_str { \tex_jobname:D } - } -%</initex> -%<*package> -\cs_if_exist:NT \@currname - { \str_gset_eq:NN \g_file_curr_name_str \@currname } -%</package> % \end{macrocode} % \end{variable} % @@ -2278,7 +2272,8 @@ % mode we can recover the information from the details held by % \LaTeXe{} (we must be in the preamble and loaded using \tn{usepackage} % or \tn{RequirePackage}). As \LaTeXe{} doesn't store directory and -% name separately, we stick to the same convention here. +% name separately, we stick to the same convention here. In pre-loading, +% \tn{@currnamestack} is empty so is skipped. % \begin{macrocode} \seq_new:N \g_@@_stack_seq %<*package> @@ -2301,7 +2296,10 @@ } } \cs_if_exist:NT \@currnamestack - { \exp_after:wN \@@_tmp:w \@currnamestack } + { + \tl_if_empty:NF \@currnamestack + { \exp_after:wN \@@_tmp:w \@currnamestack } + } \group_end: %</package> % \end{macrocode} @@ -2642,9 +2640,27 @@ \cs_new:Npx \@@_file_ext_check_auxiii:nw #1#2 . #3 . #4 \q_stop { \exp_not:N \quark_if_nil:nTF {#3} - { \exp_not:N \__kernel_file_name_quote:n { #1 \tl_to_str:n { .tex } } } + { + \exp_not:N \exp_args:Nee \exp_not:N \@@_file_ext_check_auxiv:nn + { \exp_not:N \__kernel_file_name_quote:n {#1} } + { + \exp_not:N \__kernel_file_name_quote:n + { #1 \tl_to_str:n { .tex } } + } + } {#1} } +\cs_new:Npn \@@_file_ext_check_auxiv:nn #1#2 + { + \tl_if_blank:eTF { \@@_file_size:n {#2} } + {#1} + { + \int_compare:nNnTF + { \@@_file_size:n {#1} } = { \@@_file_size:n {#2} } + {#2} + {#1} + } + } % \end{macrocode} % Deal with the fact that the primitive might not be available. % \begin{macrocode} @@ -2816,7 +2832,7 @@ % \end{macro} % \end{macro} % -% \begin{macro} +% \begin{macro}[noTF] % {\file_get_mdfive_hash:nN, \file_get_size:nN, \file_get_timestamp:nN} % \begin{macro}{\@@_get_details:nnN} % Non-expandable wrappers around the above in the case where appropriate @@ -3073,7 +3089,7 @@ \str_gset_eq:NN \g_file_curr_ext_str \l_@@_ext_str } %<*package> -\cs_new_eq:NN \__kernel_file_input_push:n \__file_input_push:n +\cs_new_eq:NN \__kernel_file_input_push:n \@@_input_push:n %</package> \cs_new_protected:Npn \@@_input_pop: { @@ -3081,7 +3097,7 @@ \exp_after:wN \@@_input_pop:nnn \l_@@_internal_tl } %<*package> -\cs_new_eq:NN \__kernel_file_input_pop: \__file_input_pop: +\cs_new_eq:NN \__kernel_file_input_pop: \@@_input_pop: %</package> \cs_new_protected:Npn \@@_input_pop:nnn #1#2#3 { @@ -3191,14 +3207,17 @@ % \cs{g_@@_record_seq}. % \begin{macrocode} %<*package> -\AtBeginDocument - { - \exp_args:NNx \seq_set_from_clist:Nn \l_@@_tmp_seq - { \tl_to_str:N \@filelist } - \seq_gconcat:NNN - \g_@@_record_seq - \g_@@_record_seq - \l_@@_tmp_seq +\cs_if_exist:NT \@filelist + { + \AtBeginDocument + { + \exp_args:NNx \seq_set_from_clist:Nn \l_@@_tmp_seq + { \tl_to_str:N \@filelist } + \seq_gconcat:NNN + \g_@@_record_seq + \g_@@_record_seq + \l_@@_tmp_seq + } } %</package> % \end{macrocode} |