blob: b120352243b6825b3a5041eb23ab232035e148da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
%%
%% 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-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
%% 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 ``expl3 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 LaTeX Project Team.
%%
%% -----------------------------------------------------------------------
%%
\RequirePackage{l3names}
\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:
\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_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} }
}
\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_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_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_protected_nopar:Npn \file_path_remove:n #1 {
\seq_remove_element: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_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_map_inline:Nn \@filelist
{ \seq_put_right:Nn \g_file_record_seq {#1} }
}
%%
%%
%% End of file `l3file.sty'.
|