summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/alatex/base/testdist.dtx
blob: 9b6625a7292bf9da7bde60cb4192a0fc4dbe51c9 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
% \iffalse meta-comment
%
% Copyright 1993 1994 1995 The LaTeX3 Project and any individual
% authors listed elsewhere in this file. 
% 
% For further copyright information, and conditions for modification
% and distribution, see the file legal.txt, and any other copyright
% notices in this file.
% 
% This file is part of the LaTeX2e system.
% ----------------------------------------
%   This system is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
%   For error reports concerning UNCHANGED versions of this file no
%   more than one year old, see bugs.txt.
% 
%   Please do not request updates from us directly.  Primary
%   distribution is through the CTAN archives.
% 
% 
% IMPORTANT COPYRIGHT NOTICE:
% 
% You are NOT ALLOWED to distribute this file alone.
% 
% You are allowed to distribute this file under the condition that it
% is distributed together with all the files listed in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% 
% Permission is granted to copy this file to another file with a
% clearly different name and to customize the declarations in that
% copy to serve the needs of your installation, provided that you
% comply with the conditions in the file legal.txt.
% 
% However, NO PERMISSION is granted to produce or to distribute a
% modified version of this file under its original name.
%  
% You are NOT ALLOWED to change this file.
% 
% 
% 
% \fi
%
% \ProvidesFile{testdist.dtx}[1994/05/13 Testing distribution]
%
% \iffalse
%%% File: testdist.dtx
%
%<*unstripped>
\ifx\documentclass\undefined\let\next\relax\else\def\next{%
%</unstripped>
%<*driver>
% \fi
\ProvidesFile{testdist.dtx}[1994/05/13 Testing distribution]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{testdist.dtx}
\title{dircheck.dtx}
\author{Alan Jeffrey}
\date{\filedate}
\begin{document}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
%<*unstripped>
}\fi\next
%</unstripped>
% \fi
%
% \changes{v0.02}{1993/12/20}{This file now defines a command
%    \cs{testdistribution}, which reads an arbitrary file, rather than
%    only reading manifest.l2e.}
% \changes{v0.03}{1993/12/21}{Added \cs{@tfor}.}
% \changes{v0.04}{1994/01/18}{Removed directory searching.}
% \changes{v0.05}{1994/01/20}{Corrected missing file number bug.}
% \changes{v0.06}{1994/05/13}{Improved documentation.}
%
% This file defines a command
% |\testdistribution{|\meta{filename}|}{|\meta{error}|}{|\meta{help}|}|,
% which reads a file, and checks that all the filenames listed in it
% can be read by \TeX.  It should be run after |dircheck.dtx| has
% defined |\input@path|. 
%
% \changes{v0.03}{1993/12/21}{Chris pointed out that we need `@tfor
%    here}
% \changes{v0.04}{1994/01/18}{Removed all the directory searching}
%
% \begin{macro}{\IfFileExists}
%    A version of the |\IfFileExists| macro which does no fancy
%    searching, and we assume the directory is on the |\openin| path. 
% \changes{v0.05}{1994/01/20}{Corrected missing file number bug.}
%    \begin{macrocode}
%<*testdist>
 \def\IfFileExists#1{%
    \openin\@inputcheck#1 %
    \ifeof\@inputcheck
      \closein\@inputcheck
      \expandafter\@secondoftwo
    \else
      \closein\@inputcheck
      \expandafter\@firstoftwo
    \fi
    }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\testdistribution}
% \begin{macro}{\@filemustexist}
% \begin{macro}{\@filemustexist@}
% \begin{macro}{\@missingfiles}
%    |\testdistribution| inputs a file of filenames and checks that
%    all the files can be read by \TeX.  The files should be separated
%    by whitespace, and terminated by |\endinput|.
%    \begin{macrocode}
\def\@filemustexist#1{
   \ifx#1\endinput
      \expandafter\endinput
   \else
      \expandafter\@filemustexist@\expandafter#1%
   \fi
}
\def\@filemustexist@#1 {
   \IfFileExists{#1}{
      \wlog{Passed `#1'.}
   }{
      \wlog{Failed `#1'.}
      \xdef\@missingfiles{\@missingfiles\message{#1}}
   }
   \@filemustexist
}
\def\testdistribution#1#2#3{
   \global\let\@missingfiles=\@empty
   {
      \catcode`\^^M=\the\catcode`\ \relax
      \expandafter\@filemustexist\@@input #1
   }
   \ifx\@missingfiles\@empty
   \else
      \immediate\write16{}
      \immediate\write16{The following files are missing:} 
      \immediate\write16{}
      \@missingfiles
      \immediate\write16{}
      \errhelp{#3}
      \errmessage{#2}
      \immediate\write16{}
      \immediate\write16{Carrying on with fingers crossed...}
      \immediate\write16{}
   \fi
}
%</testdist>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
\endinput