diff options
author | Karl Berry <karl@freefriends.org> | 2023-06-06 20:06:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-06-06 20:06:24 +0000 |
commit | 4efc770b4440003e74a4c1c868ad55c64a32ef05 (patch) | |
tree | 5e07c532363aa9720b217c8c02c29a06aa832e6b /Master/texmf-dist/source/latex/l3kernel/l3file.dtx | |
parent | 94617bbdb2210de3606ba82fafd652ca48e16b93 (diff) |
l3kernel (6jun23)
git-svn-id: svn://tug.org/texlive/trunk@67294 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3file.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3file.dtx | 116 |
1 files changed, 108 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index c4e5f0b1ce9..5e2d8ba74d5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-05-22} +% \date{Released 2023-06-05} % % \maketitle % @@ -157,6 +157,23 @@ % \cs{sys_get_shell:nnNTF}. % \end{function} % +% \begin{function}[added = 2023-05-25]{\iow_shell_open:Nn} +% \begin{syntax} +% \cs{iow_shell_open:Nn} \meta{stream} \Arg{shell~command} +% \end{syntax} +% Opens the \emph{pseudo}-file created by the output of the +% \meta{shell command} for writing using \meta{stream} as the +% control sequence for access. If the \meta{stream} was already +% open it is closed before the new operation begins. The +% \meta{stream} is available for access immediately and will remain +% allocated to \meta{shell command} until a \cs{iow_close:N} instruction +% is given or the \TeX{} run ends. +% If piped system calls are disabled an error is raised. +% +% For details of handling of the \meta{shell command}, see +% \cs{sys_get_shell:nnNTF}. +% \end{function} +% % \begin{function}[updated = 2012-07-31] % {\ior_close:N, \ior_close:c, \iow_close:N, \iow_close:c} % \begin{syntax} @@ -917,6 +934,21 @@ % function. An error is raised if the file is not found. % \end{function} % +% \begin{function}[added = 2023-05-18, EXP]{\file_input_raw:n} +% \begin{syntax} +% \cs{file_input_raw:n} \Arg{file name} +% \end{syntax} +% Searches for \meta{file name} in the path as detailed for +% \cs{file_if_exist:nTF}, and if found reads in the file as +% additional \TeX{} source. No data concerning the file is +% tracked. If the file is not found, no action is taken. +% \begin{texnote} +% This function is intended only for contexts where files must +% be read purely by expansion, for example at the start of a +% table cell in an \tn{halign}. +% \end{texnote} +% \end{function} +% % \begin{function}[added = 2014-07-02]{\file_if_exist_input:n, \file_if_exist_input:nF} % \begin{syntax} % \cs{file_if_exist_input:n} \Arg{file name} @@ -1169,7 +1201,7 @@ { \sys_if_shell:TF { \exp_args:No \@@_shell_open:nN { \tl_to_str:n {#2} } #1 } - { \msg_error:nn { ior } { pipe-failed } } + { \msg_error:nn { kernel } { pipe-failed } } } \cs_new_protected:Npn \@@_shell_open:nN #1#2 { @@ -1180,7 +1212,7 @@ } { \__kernel_ior_open:Nn #2 { |#1 } } } -\msg_new:nnnn { ior } { pipe-failed } +\msg_new:nnnn { kernel } { pipe-failed } { Cannot~run~piped~system~commands. } { LaTeX~tried~to~call~a~system~process~but~this~was~not~possible.\\ @@ -1634,6 +1666,29 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\iow_shell_open:Nn} +% \begin{macro}{\@@_shell_open:nN} +% Very similar to the \texttt{ior} version +% \begin{macrocode} +\cs_new_protected:Npn \iow_shell_open:Nn #1#2 + { + \sys_if_shell:TF + { \exp_args:No \@@_shell_open:nN { \tl_to_str:n {#2} } #1 } + { \msg_error:nn { kernel } { pipe-failed } } + } +\cs_new_protected:Npn \@@_shell_open:nN #1#2 + { + \tl_if_in:nnTF {#1} { " } + { + \msg_error:nnx + { kernel } { quote-in-shell } {#1} + } + { \__kernel_iow_open:Nn #2 { |#1 } } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\iow_close:N, \iow_close:c} % Closing a stream is not quite the reverse of opening one. First, % the close operation is easier than the open one, and second as the @@ -2818,7 +2873,9 @@ % % \begin{macro}[EXP]{\file_full_name:n, \@@_full_name:n, \@@_full_name_aux:n} % \begin{macro}[EXP]{\@@_full_name_auxi:nn, \@@_full_name_auxii:nn} -% \begin{macro}[EXP]{\@@_full_name_aux:Nnnn} +% \begin{macro}[EXP]{\@@_full_name_aux:Nnn} +% \begin{macro}[EXP]{\@@_full_name_slash:n} +% \begin{macro}[EXP]{\@@_full_name_slash:w} % \begin{macro}[EXP]{\@@_full_name_aux:nN} % \begin{macro}[EXP]{\@@_full_name_aux:nnN} % \begin{macro}[EXP]{\@@_name_cleanup:w} @@ -2888,11 +2945,11 @@ \tl_if_blank:nTF {#2} { \seq_map_tokens:Nn \l_file_search_path_seq - { \@@_full_name_aux:Nnnn \seq_map_break:n {#1} { / } } + { \@@_full_name_aux:Nnn \seq_map_break:n {#1} } \cs_if_exist:NT \input@path { \tl_map_tokens:Nn \input@path - { \@@_full_name_aux:Nnnn \tl_map_break:n {#1} { } } + { \@@_full_name_aux:Nnn \tl_map_break:n {#1} } } \@@_name_end: } @@ -2902,8 +2959,25 @@ % Two pars to the auxiliary here so we can avoid doing quoting % twice in the event we find the right file. % \begin{macrocode} -\cs_new:Npn \@@_full_name_aux:Nnnn #1#2#3#4 - { \exp_args:Ne \@@_full_name_aux:nN { \tl_to_str:n {#4} #3 #2 } #1 } +\cs_new:Npn \@@_full_name_aux:Nnn #1#2#3 + { + \exp_args:Ne \@@_full_name_aux:nN + { + \exp_args:Ne \@@_full_name_slash:n + { \tl_to_str:n {#3} } #2 + } + #1 + } +\cs_new:Npn \@@_full_name_slash:n #1 + { + \@@_full_name_slash:nw {#1} #1 \q_nil / \q_nil / \q_nil \q_stop + } +\cs_new:Npn \@@_full_name_slash:nw #1#2 / \q_nil / #3 \q_stop + { + \quark_if_nil:nTF {#3} + { #1 / } + { #2 / } + } \cs_new:Npn \@@_full_name_aux:nN #1 { \exp_args:Nne \@@_full_name_aux:nnN {#1} { \@@_full_name_aux:n {#1} } } \cs_new:Npn \@@_full_name_aux:nnN #1 #2 #3 @@ -2971,6 +3045,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\file_get_full_name:nN, \file_get_full_name:VN} % \begin{macro}[TF]{\file_get_full_name:nN, \file_get_full_name:VN} @@ -3355,6 +3431,30 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\file_input_raw:n, \@@_input_raw:nn} +% No error checking, no tracking. +% \begin{macrocode} +\cs_new:Npn \file_input_raw:n #1 + { \exp_args:Ne \@@_input_raw:nn { \file_full_name:n {#1} } {#1} } +\cs_new:Npx \@@_input_raw:nn #1#2 + { + \exp_not:N \tl_if_blank:nTF {#1} + { + \exp_not:N \exp_args:Nnne \exp_not:N \msg_expandable_error:nnn + { kernel } { file-not-found } + { \exp_not:N \__kernel_file_name_sanitize:n {#2} } + } + { + \exp_not:N \tex_input:D + \sys_if_engine_luatex:TF + { {#1} } + { \exp_not:N \__kernel_file_name_quote:n {#1} \scan_stop: } + } + } +\exp_args_generate:n { nne } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\file_parse_full_name:n, \file_parse_full_name_apply:nN} % The main parsing macro \cs{file_parse_full_name_apply:nN} passes the % file name |#1| through \cs{__kernel_file_name_sanitize:n} so that we |