%% %% This is file `l3file.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3file.dtx (with options: `package') %% %% EXPERIMENTAL CODE %% %% Do not distribute this file without also distributing the %% source files specified above. %% %% Do not distribute a modified version of this file. %% %% File: l3file.dtx Copyright (C) 2009-2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this %% license or (at your option) any later version. The latest version %% of this license is in the file %% %% http://www.latex-project.org/lppl.txt %% %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% The released version of this bundle is available from CTAN. %% %% ----------------------------------------------------------------------- %% %% The development version of the bundle can be found at %% %% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% %%%%%%%%%%% %% NOTE: %% %%%%%%%%%%% %% %% Snapshots taken from the repository represent work in progress and may %% not work or may contain conflicting material! We therefore ask %% people _not_ to put them into distributions, archives, etc. without %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} \GetIdInfo$Id: l3file.dtx 3287 2012-01-31 22:08:14Z joseph $ {L3 Experimental file operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \tl_new:N \g_file_current_name_tl \tl_gset_eq:NN \g_file_current_name_tl \@currname \seq_new:N \g_file_stack_seq \seq_new:N \g_file_record_seq \tl_new:N \l_file_internal_name_tl \seq_new:N \l_file_search_path_seq \seq_new:N \l_file_internal_saved_path_seq \seq_new:N \l_file_internal_seq \ior_new:N \g_file_internal_ior \cs_new_protected:Npn \file_add_path:nN #1 { \group_begin: \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} \tl_if_in:NnT \l_file_internal_name_tl { ~ } { \msg_kernel_error:nnx { io } { space-in-file-name } { \l_file_internal_name_tl } } \exp_args:NNo \group_end: \file_add_path_aux:nN \l_file_internal_name_tl } \cs_new_protected:Npn \file_add_path_aux:nN #1#2 { \ior_open_unsafe:Nn \g_file_internal_ior {#1} \ior_if_eof:NTF \g_file_internal_ior { \file_add_path_search:nN {#1} #2 } { \ior_close:N \g_file_internal_ior \tl_set:Nn #2 {#1} } } \cs_new_protected:Npn \file_add_path_search:nN #1#2 { \tl_clear:N #2 \cs_if_exist:NT \input@path { \seq_set_eq:NN \l_file_internal_saved_path_seq \l_file_search_path_seq \seq_set_from_clist:NN \l_file_internal_seq \input@path \seq_concat:NNN \l_file_search_path_seq \l_file_search_path_seq \l_file_internal_seq } \seq_map_inline:Nn \l_file_search_path_seq { \ior_open_unsafe:Nn \g_file_internal_ior { ##1 #1 } \ior_if_eof:NF \g_file_internal_ior { \tl_set:Nx #2 { ##1 #1 } \seq_map_break: } } \cs_if_exist:NT \input@path { \seq_set_eq:NN \l_file_search_path_seq \l_file_internal_saved_path_seq } \ior_close:N \g_file_internal_ior } \prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } { \file_add_path:nN {#1} \l_file_internal_name_tl \tl_if_empty:NTF \l_file_internal_name_tl { \prg_return_false: } { \prg_return_true: } } \cs_new_protected:Npn \file_input:n #1 { \file_add_path:nN {#1} \l_file_internal_name_tl \tl_if_empty:NF \l_file_internal_name_tl { \@addtofilelist {#1} \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl \tl_gset:Nn \g_file_current_name_tl {#1} \exp_after:wN \tex_input:D \l_file_internal_name_tl \c_space_tl \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl } } \cs_new_protected:Npn \file_split_path_name_ext:nNNN #1 { \group_begin: \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} \tl_if_in:NnT \l_file_internal_name_tl { ~ } { \msg_kernel_error:nnx { io } { space-in-file-name } { \l_file_internal_name_tl } } \exp_args:NNo \group_end: \file_split_path_name_ext_aux:nNNN \l_file_internal_name_tl } \cs_new_protected:Npn \file_split_path_name_ext_aux:nNNN #1#2#3#4 { \tl_clear:N #2 \tl_clear:N #3 \file_split_path:wNNN #1 / \q_nil / \q_stop #2#3#4 } \cs_new_protected:Npn \file_split_path:wNNN #1 / #2 / #3 \q_stop #4 { \quark_if_nil:nTF {#2} { \file_split_name_ext:wNN #1 . \q_nil . \q_stop } { \tl_put_right:Nn #4 { #1 / } \file_split_path:wNNN #2 / #3 \q_stop #4 } } \cs_new_protected:Npn \file_split_name_ext:wNN #1 . #2 . #3 \q_stop #4#5 { \quark_if_nil:nTF {#2} { \tl_if_empty:NTF #4 { \tl_set:Nn #4 {#1} \tl_clear:N #5 } { \tl_set:Nn #5 {#1} } } { \tl_put_right:Nx #4 { \tl_if_empty:NF #4 { . } #1 } \file_split_name_ext:wNN #2 . #3 \q_stop #4#5 } } \cs_new_protected:Npn \file_path_include:n #1 { \seq_if_in:NnF \l_file_search_path_seq {#1} { \seq_put_right:Nn \l_file_search_path_seq {#1} } } \cs_new_protected:Npn \file_path_remove:n #1 { \seq_remove_all:Nn \l_file_search_path_seq {#1} } \cs_new_protected_nopar:Npn \file_list: { \seq_remove_duplicates:N \g_file_record_seq \iow_log:n { *~File~List~* } \seq_map_inline:Nn \g_file_record_seq { \iow_log:n {##1} } \iow_log:n { ************* } } \AtBeginDocument { \seq_set_from_clist:NN \l_file_internal_seq \@filelist \seq_gconcat:NNN \g_file_record_seq \g_file_record_seq \l_file_internal_seq } %% %% %% End of file `l3file.sty'.