summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/expl3/l3file.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-31 00:04:47 +0000
committerKarl Berry <karl@freefriends.org>2010-03-31 00:04:47 +0000
commit3ab55a61f6f8d2218a8f3175bc7481ce162b60d3 (patch)
treef606e0c2117a8058213441400e50ba25400ba94a /Master/texmf-dist/tex/latex/expl3/l3file.sty
parent035ea73193af75f6ade46e306603e61d82b24950 (diff)
expl3 1881 (30mar10)
git-svn-id: svn://tug.org/texlive/trunk@17631 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3file.sty')
-rw-r--r--Master/texmf-dist/tex/latex/expl3/l3file.sty163
1 files changed, 69 insertions, 94 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3file.sty b/Master/texmf-dist/tex/latex/expl3/l3file.sty
index 5a1df4c8349..b120352243b 100644
--- a/Master/texmf-dist/tex/latex/expl3/l3file.sty
+++ b/Master/texmf-dist/tex/latex/expl3/l3file.sty
@@ -15,7 +15,7 @@
%% Do not distribute a modified version of this file.
%%
%%
-%% File: l3file.dtx Copyright (C) 2009 LaTeX3 project
+%% File: l3file.dtx Copyright (C) 2009-2010 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
@@ -49,112 +49,87 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{l3names}
-\GetIdInfo$Id: l3file.dtx 1676 2009-11-02 08:18:16Z will $
+\GetIdInfo$Id: l3file.dtx 1853 2010-03-21 09:11:08Z joseph $
{L3 Experimental file loading}
\ProvidesExplPackage
{\filename}{\filedate}{\fileversion}{\filedescription}
\package_check_loaded_expl:
-\clist_new:N \g_file_record_clist
-\clist_new:N \g_file_record_full_clist
-\clist_new:N \l_file_search_path_clist
-\ior_new:N \l_file_test_read_stream
-\bool_new:N \l_file_tmp_bool
-\tl_new:N \l_file_tmp_tl
-\prg_new_conditional:Nnn \file_if_exist:n {p,TF,T,F} {
- \ior_open:Nn \l_file_test_read_stream {#1}
- \ior_if_eof:NTF \l_file_test_read_stream {
- \file_if_exist_path:n {#1}
- }{
- \ior_close:N \l_file_test_read_stream
- \prg_return_true:
- }
-}
-\cs_new_nopar:Npn \file_if_exist_path:n #1 {
- \bool_set_false:N \l_file_tmp_bool
- \cs_set_nopar:Npn \file_if_exist_aux:n ##1 {
- \ior_open:Nn \l_file_test_read_stream { #1 ##1 }
- \ior_if_eof:NF \l_file_test_read_stream {
- \bool_set_true:N \l_file_tmp_bool
- \clist_map_break:
+\tl_new:N \g_file_current_name_tl
+\seq_new:N \g_file_stack_seq
+\tl_gset_eq:NN \g_file_current_name_tl \@currname
+\seq_new:N \g_file_record_seq
+\seq_new:N \l_file_search_path_seq
+\seq_new:N \l_file_search_path_saved_seq
+\tl_new:N \l_file_name_tl
+\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } {
+ \ior_open:Nn \g_file_test_stream {#1}
+ \ior_if_eof:NTF \g_file_test_stream
+ { \file_if_exist_path_aux:n {#1} }
+ {
+ \ior_close:N \g_file_test_stream
+ \tl_set:Nn \l_file_name_tl {#1}
+ \prg_return_true:
}
- }
- \cs_if_exist:NT \input@path {
- \cs_set_eq:NN \l_file_search_path_clist \input@path
- }
- \clist_map_function:NN \l_file_search_path_clist \file_if_exist_aux:n
- \ior_close:N \l_file_test_read_stream
- \bool_if:NTF \l_file_tmp_bool {
- \prg_return_true:
- }{
- \prg_return_false:
- }
-}
-\cs_new_nopar:Npn \file_if_exist_aux:n #1 { }
-\cs_new_nopar:Npn \file_add_path:nN #1#2 {
- \tl_clear:N #2
- \ior_open:Nn \l_file_test_read_stream {#1}
- \ior_if_eof:NTF \l_file_test_read_stream {
- \file_add_path_search:nN {#1} #2
- }{
- \tl_set:Nn #2 {#1}
- }
- \ior_close:N \l_file_test_read_stream
}
-\cs_new_nopar:Npn \file_add_path_search:nN #1#2 {
- \cs_set_nopar:Npn \file_add_path_aux:n ##1 {
- \ior_open:Nn \l_file_test_read_stream { ##1 #1 }
- \ior_if_eof:NF \l_file_test_read_stream {
- \tl_set:Nn #2 { ##1 #1 }
- \clist_map_break:
+\cs_new_protected_nopar:Npn \file_if_exist_path_aux:n #1 {
+ \tl_clear:N \l_file_name_tl
+ \cs_if_exist:NT \input@path
+ {
+ \seq_set_eq:NN \l_file_search_path_saved_seq
+ \l_file_search_path_seq
+ \clist_map_inline:Nn \input@path
+ { \seq_put_right:Nn \l_file_search_path_seq {##1} }
}
- }
- \cs_if_exist:NT \input@path {
- \cs_set_eq:NN \l_file_search_path_clist \input@path
- }
- \clist_map_function:NN \l_file_search_path_clist \file_add_path_aux:n
-}
-\cs_new_nopar:Npn \file_add_path_aux:n #1 { }
-\cs_new:Npn \file_input:n #1 {
- \file_add_path:nN {#1} \l_file_tmp_tl
- \tl_if_empty:NF \l_file_tmp_tl {
- \file_input_no_check:n \l_file_tmp_tl
- }
-}
-\cs_new:Npn \file_input_no_record:n #1 {
- \file_add_path:nN {#1} \l_file_tmp_tl
- \tl_if_empty:NF \l_file_tmp_tl {
- \file_input_no_check_no_record:n \l_file_tmp_tl
- }
-}
-\cs_new_nopar:Npn \file_input_no_check:n #1 {
- \clist_gput_right:Nx \g_file_record_clist {#1}
- \wlog{ADDING: #1}
- \@addtofilelist {#1}
- \clist_gput_right:Nx \g_file_record_full_clist {#1}
- \tex_input:D #1 ~
-}
-\cs_new_nopar:Npn \file_input_no_check_no_record:n #1 {
- \clist_gput_right:Nx \g_file_record_full_clist {#1}
- \tex_input:D #1 ~
+ \seq_map_inline:Nn \l_file_search_path_seq
+ {
+ \ior_open:Nn \g_file_test_stream { ##1 #1 }
+ \ior_if_eof:NF \g_file_test_stream
+ {
+ \tl_set:Nn \l_file_name_tl { ##1 #1 }
+ \seq_map_break:
+ }
+ }
+ \cs_if_exist:NT \input@path
+ {
+ \seq_set_eq:NN \l_file_search_path_seq
+ \l_file_search_path_saved_seq
+ }
+ \ior_close:N \g_file_test_stream
+ \tl_if_empty:NTF \l_file_name_tl
+ { \prg_return_false: }
+ { \prg_return_true: }
}
-\cs_new_nopar:Npn \file_list: {
- \file_list:N \g_file_record_clist
+\cs_generate_variant:Nn \file_if_exist:nT { V }
+\cs_generate_variant:Nn \file_if_exist:nF { V }
+\cs_generate_variant:Nn \file_if_exist:nTF { V }
+\cs_new_protected_nopar:Npn \file_input:n #1 {
+ \file_if_exist:nT {#1}
+ {
+ \@addtofilelist {#1}
+ \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl
+ \tl_gset:Nn \g_file_current_name_tl {#1}
+ \tex_expandafter:D \tex_input:D \l_file_name_tl ~
+ \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl
+ }
}
-\cs_new_nopar:Npn \file_list_full: {
- \file_list:N \g_file_record_full_clist
+\cs_generate_variant:Nn \file_input:n { V }
+\cs_new_protected_nopar:Npn \file_path_include:n #1 {
+ \seq_put_right:Nn \l_file_search_path_seq {#1}
+ \seq_remove_duplicates:N \l_file_search_path_seq
}
-\cs_new_nopar:Npn \file_list:N #1 {
- \clist_remove_duplicates:N #1
- \iow_log:x { *~File~List~* }
- \clist_map_function:NN #1 \file_list_aux:n
- \iow_log:x { ************* }
+\cs_new_protected_nopar:Npn \file_path_remove:n #1 {
+ \seq_remove_element:Nn \l_file_search_path_seq {#1}
}
-\cs_new_nopar:Npn \file_list_aux:n #1 {
- \iow_log:x { #1 }
+\cs_new_protected_nopar:Npn \file_list: {
+ \seq_remove_duplicates:N \g_file_record_seq
+ \iow_log:n { *~File~List~* }
+ \seq_map_function:NN \g_file_record_seq \file_list_aux:n
+ \iow_log:n { ************* }
}
+\cs_new_protected_nopar:Npn \file_list_aux:n #1 { \iow_log:n {#1} }
\AtBeginDocument{
- \clist_put_right:NV \g_file_record_clist \@filelist
- \clist_put_right:NV \g_file_record_full_clist \@filelist
+ \clist_map_inline:Nn \@filelist
+ { \seq_put_right:Nn \g_file_record_seq {#1} }
}
%%
%%