Debian Codegraph @

texmf-dist/source/latex/base/ltdirchk.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 %
30 %
31 % \iffalse
32 %%% From File: ltdirchk.dtx
33 %
34 %<*unstripped>
35 \ifx\documentclass\undefined\let\next\relax\else\def\next{%
36 %</unstripped>
37 %<*driver>
38 % \fi
39 % \fi
40 \ProvidesFile{ltdirchk.dtx}
41 [2024/11/02 v1.3b LaTeX Kernel (System Dependent Parts)]
42 % \iffalse
43 % \iffalse
44 \documentclass{ltxdoc}
45 \GetFileInfo{ltdirchk.dtx}
46 \title{\filename\thanks{%
47 this document also includes the source for
48 texsys.cfg and ltxcheck.tex}}
49 \author{David Carlisle}
50 \date{\filedate}
51 \begin{document}
52 \MaintainedByLaTeXTeam{latex}
53 \maketitle
54 \DocInput{\filename}
55 \end{document}
56 %</driver>
57 %<*unstripped>
58 }\fi\next
59 %</unstripped>
60 % \fi
61 %
62 % \changes{v0.2j}{1994/02/25}
63 % {Remove need for drv file}
64 % \changes{v0.2k}{1994/03/01}
65 % {Add unstripped module,
66 % so that dircheck.dtx may be used with initex}
67 % \changes{v1.0a}{1994/03/08}
68 % {Reorganize driver module into `new style'}
69 % \changes{v1.0b}{1994/03/12}
70 % {Change name from dircheck.dtx}
71 % \changes{v1.0b}{1994/03/12}
72 % {Minor edits to the typeouts in ltxcheck}
73 % \changes{v1.0d}{1994/03/28}
74 % {Improve documentation}
75 % \changes{v1.0i}{1994/11/03}
76 % {Generate an error if latex.ltx not used with clean initex}
77 % \changes{v1.0j}{1994/11/17}
78 % {\cs{@tempa} to \cs{reserved@a}}
79 % \changes{v1.0r}{1996/06/13}
80 % {documentation improvements mainly from internal/2174}
81 % \changes{v1.0v}{1997/06/16}
82 % {documentation improvements mainly from internal/2520}
83 % \changes{v1.0w}{1998/08/17}{(RmS) Documentation improvements.}
84 %
85 %
86 % \section{\LaTeX\ System Dependent Initializations}
87 %
88 % \changes{v0.2g}{1994/01/21}
89 % {Improve documentation, reorganize docstrip module}
90 %
91 % This file implements the semi-automatic determination of various
92 % system dependent parts of the initialization. The actual definitions
93 % may be placed in a file |texsys.cfg|. Thus for operating systems for
94 % which the tests here do not result in acceptable settings, a `hand
95 % written' |texsys.cfg| may be produced.
96 %
97 % The macros that must be defined are:
98 %
99 % \DescribeMacro{\@currdir}
100 % |\@currdir|\meta{filename}\meta{space} should expand to a form of the
101 % filename that uniquely refers to the `current directory' if this is
102 % possible. (The expansion should also end with a space.) on UNIX,
103 % this is |\def\@currdir{./}|. For more exotic operating systems you may
104 % want to make |\@currdir| a macro with arguments delimited by |.|
105 % and/or \meta{space}. If the operating system has no concept of
106 % directory structure, this macro should be defined to be empty.
107 %
108 %
109 % \DescribeMacro{\input@path}
110 % If the primitive |\openin| searches the same directories as the
111 % primitive |\input|, then it is possible to tell (using |\ifeof|)
112 % whether a file exists before trying to input it. For systems like
113 % this, |\input@path| should be left undefined.
114 %
115 % If |\openin| does not `follow' |\input| then |\input@path| must be
116 % defined to be a list of directories to search for input files. The
117 % format for each directory is as for |\@currdir|, normally just a
118 % prefix is required, but it may be a macro with space-delimited
119 % argument. That is, if \meta{dir} is an entry in the input path,
120 % \TeX\ will try to load the expansion of
121 % \meta{dir}\meta{filename}\meta{space}
122 %
123 % So either \meta{dir} should be defined as a macro with argument
124 % delimited by space, or it should just expand to a directory name,
125 % including the final directory separator, so that it may be
126 % concatenated with the \meta{filename}. This means that for UNIX-like
127 % syntax, each \meta{dir} should end with a slash, |/|.
128 %
129 % |\input@path| should expand to a list of such directories, each in a
130 % |{}| group.
131 %
132 % \begin{sloppypar}
133 % \DescribeMacro{\filename@parse}
134 % After a call of the form: |\filename@parse{|\meta{filename}|}|, the
135 % three macros |\filename@area|, |\filename@base| and |\filename@ext| should
136 % be defined to be the `area' (or directory), basename and
137 % extension respectively. If there was no extension specified in
138 % \meta{filename}, |\filename@ext| should be |\let| to |\relax| (so this
139 % case may be tested with |\@ifundefined{filename@ext}| and, perhaps a
140 % default extension substituted).
141 % \end{sloppypar}
142 %
143 % Normally one would not need to define this macro in |texsys.cfg| as
144 % the automatic tests can supply parsers that work with UNIX and VMS and
145 % Macintosh syntax, as well as a basic parser that will cover many other
146 % cases. However some operating systems may need a `hand produced'
147 % parser in which case it should be defined in this file.
148 %
149 % The UNIX parser also works for most MSDOS \TeX\ versions.
150 % Currently if the UNIX, VMS or Macintosh parser is not used,
151 % |\filename@parse| is defined to always return an empty area, and to
152 % split the argument into basename and extension at the first `|.|'
153 % that occurs in the name.
154 % Parsers for other formats may be defined in |texsys.cfg|,
155 % in which case they will be used in preference to the default
156 % definitions.
157 %
158 % \DescribeMacro{\@TeXversion}
159 % \changes{v1.0f}{1994/05/23}{Document \cs{@TeXversion}}
160 % |\@TeXversion| is now set automatically by the initialization tests
161 % in this file. You should not need to set it in |texsys.cfg|, however
162 % the following documentation is left for information. \LaTeX\ does
163 % not set this variable exactly, the automatic tests set it to:\\
164 % |2| for any version, $v$, $v < 3.0$\\
165 % |3| for any version, $v$, $3.0 \leq v \leq 3.14$\\
166 % \meta{undefined} otherwise.\\
167 % However these values are accurate enough for \LaTeX\ to take
168 % appropriate action for these old \TeX{}s.
169 %
170 % If your \TeX\ is older than version 3.141, then you should define
171 % |\@TeXversion| (using |\def|) to be the version number. If you do not
172 % do this\footnote
173 % {Actually if your \TeX\ is really old, version~2, \LaTeX\ can
174 % detect this, and sets \cs{@TeXversion} to~2 if it is not set in
175 % the \texttt{cfg} file.}
176 %, \LaTeX\ will not work around a bug in old \TeX\ versions, and
177 % so error messages will appear in a very strange format, with |^^J|
178 % appearing instead of line breaks:
179 % \begingroup
180 % ^^A FMi next line doesn't work with hacked class
181 % ^^A\catcode`\==\active \def=#1#2{}\hfuzz\maxdimen
182 %\begin{verbatim}
183 %! LaTeX Error: \rubbish undefined.^^J^^JSee the LaTeX manual or LaTeX=
184 % Companion
185 % for explanation.^^JType H <return> for immediate help.
186 % ...
187 %
188 %l.3 \renewcommand{\rubbish}
189 % {}
190 %?
191 %\end{verbatim}
192 % \endgroup\noindent
193 % However if you put |\def\@TeXversion{3.14}| in \texttt{texsys.cfg}
194 % the following format will be used:
195 %\begin{verbatim}
196 %! LaTeX Error: \rubbish undefined.
197 %
198 %See the LaTeX manual or LaTeX Companion for explanation.
199 %Type H <return> for immediate help.
200 %! .
201 % ...
202 %
203 %l.3 \renewcommand{\rubbish}
204 % {}
205 %?
206 %\end{verbatim}
207 % Note that this has an extra line |! .| which does not appear in
208 % error messages that use the default settings with a current version of
209 % \TeX, but this should not cause any confusion we hope.
210 %
211 % \MaybeStop{}
212 %
213 % \section{Initialization}
214 % As this file is read at a very early stage, some definitions that
215 % are normally considered to be part of the format must be made here.
216 %
217 % Most such definitions are repeated later in the ``right'' place,
218 % usually (but not always) with different implementations. To be able
219 % to spot this more easily if you look into the file
220 % \texttt{latex.ltx} (which is stripped of comments) we add some
221 % comment lines to that effect that survive the stripping process by
222 % \texttt{docstrip}.
223 % \changes{v1.3a}{2021/12/11}{Add comment lines into latex.ltx to
224 % indicate temp definitions that are later overwritten (gh/725)}
225 % \begin{macrocode}
226 %<*dircheck>
227 %% ---- START temporary definitions for bootstrapping; later overwritten ----
228 %</dircheck>
229 % \end{macrocode}
230 %
231 % \subsection{INITEX}
232 % \changes{v0.2i}{1994/01/25}
233 % {Protect against looping on \cs{@@input} and \cs{@@end}.}
234 % \begin{macrocode}
235 %<*dircheck>
236 %<*initex>
237 %<initex>\ifnum\catcode`\{=1
238 %<initex> \errmessage
239 %<initex> {LaTeX must be made using an initex with no format preloaded}
240 %<initex>\fi
241 \catcode`\{=1
242 \catcode`\}=2
243 % \end{macrocode}
244 % \changes{v1.1}{2015/01/03}{Enable extra primitives when Lua\TeX{} is used}
245 % \changes{v1.2}{2015/08/23}{Do not use luatex prefix}
246 % \changes{v1.2a}{2015/10/02}{Allow backing out of unprefixed names}
247 % If Lua\TeX{} is in use the extensions and other new primitives
248 % have to be activated: this is done as early as possible. Older
249 % versions of Lua\TeX{} do not hide the primitives: a version check is
250 % not needed as the version itself will be missing in the case where
251 % action is needed!
252 % \begin{macrocode}
253 \ifx\directlua\undefined
254 \else
255 \ifx\luatexversion\undefined
256 % \end{macrocode}
257 % Enable e-TeX/pdfTeX/Umath primitives with their natural names
258 % \begin{macrocode}
259 \directlua{tex.enableprimitives("",%
260 tex.extraprimitives('etex', 'pdftex', 'umath'))}
261 % \end{macrocode}
262 %
263 % In current formats enable primitives with unprefixed names.
264 % the \textsf{latexrelease} guards allow the primitives to be
265 % defined with a |\luatex| prefix if older formats are specified.
266 %
267 % The unprefixed forms are \emph{not} undefined for improved
268 % compatibility with external packages when rolling back
269 % the format.
270 % \begin{macrocode}
271 %</initex>
272 %</dircheck>
273 %<*initex,latexrelease>
274 %<latexrelease>\ifx\directlua\undefined\else
275 %<latexrelease>\IncludeInRelease{2015/10/01}{\luatexluafunction}
276 %<latexrelease> {LuaTeX (prefixed names)}%
277 \directlua{tex.enableprimitives("",%
278 tex.extraprimitives("omega", "aleph", "luatex"))}
279 %<latexrelease>\EndIncludeInRelease
280 %<latexrelease>\IncludeInRelease{0000/00/00}{\luatexluafunction}
281 %<latexrelease> {LuaTeX (prefixed names)}%
282 %<latexrelease>\directlua{
283 %<latexrelease> tex.enableprimitives(
284 %<latexrelease> "luatex",
285 %<latexrelease> tex.extraprimitives("core","omega", "aleph", "luatex")
286 %<latexrelease> )
287 %<latexrelease>}
288 %<latexrelease>\EndIncludeInRelease
289 %<latexrelease>\fi
290 %</initex,latexrelease>
291 %<*dircheck>
292 %<*initex>
293 % \end{macrocode}
294 %
295 % \begin{macrocode}
296 \fi
297 \fi
298 % \end{macrocode}
299 %
300 % \changes{v1.2b}{2016/10/15}{Require e\TeX{}}
301 % A test can now be made for e\TeX{}.
302 % \begin{macrocode}
303 %<initex>\ifx\eTeXversion\undefined
304 %<initex> \errmessage
305 %<initex> {LaTeX requires e-TeX}
306 %<initex> \expandafter\endinput
307 %<initex>\fi
308 % \end{macrocode}
309 %
310 % \changes{v1.3b}{2024/11/02}{Add tab char to \cs{dospecials}}
311 % That distraction over, back to the basics of a format.
312 % \begin{macrocode}
313 \catcode`\#=6
314 \catcode`\^=7
315 \chardef\active=13
316 \catcode`\@=11
317 \countdef\count@=255
318 \let\bgroup={ \let\egroup=}
319 \ifx\@@input\@undefined\let\@@input\input\fi
320 \ifx\@@end\@undefined\let\@@end\end\fi
321 \chardef\@inputcheck0
322 \chardef\sixt@@n=16
323 \newlinechar`\^^J
324 \def\typeout{\immediate\write17}
325 \def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
326 \do\#\do\^\do\_\do\%\do\~\do\^^I}
327 \def\@makeother#1{\catcode`#1=12\relax}
328 \def\space{ }
329 \def\@tempswafalse{\let\if@tempswa\iffalse}
330 \def\@tempswatrue{\let\if@tempswa\iftrue}
331 \let\if@tempswa\iffalse
332 \def\loop#1\repeat{\def\iterate{#1\relax\expandafter\iterate\fi}%
333 \iterate \let\iterate\relax}
334 \let\repeat\fi
335 %</initex>
336 % \end{macrocode}
337 %
338 % \subsection{Some bits of 2e}
339 % \begin{macrocode}
340 %<*2ekernel>
341 \def\two@digits#1{\ifnum#1<10 0\fi\number#1}
342 \long\def\@firstoftwo#1#2{#1}
343 \long\def\@secondoftwo#1#2{#2}
344 % \end{macrocode}
345 % \changes{v1.0e}{1994/05/11}
346 % {Add \cs{ProvidesFile} as used in fd files.}
347 % \changes{v1.0l}{1995/10/17}
348 % {Modify initex version of \cs{ProvidesFile}}
349 % \changes{v1.0n}{1995/11/01}
350 % {Initialise \cs{@addtofilelist} to \cs{@gobble}}
351 % This is a special version of |\ProvidesFile| for initex use.
352 % \changes{v1.0x}{2001/05/25}{Explicitly set catcode of
353 % \cs{endlinechar} to 10 (pr/3334)}
354 % \changes{v1.0y}{2001/06/04}{But only if it is a char (pr/3334)}
355 % \begin{macrocode}
356 \def\ProvidesFile#1{%
357 \begingroup
358 \catcode`\ 10 %
359 \ifnum \endlinechar<256 %
360 \ifnum \endlinechar>\m@ne
361 \catcode\endlinechar 10 %
362 \fi
363 \fi
364 \@makeother\/%
365 \@ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}}
366 \def\@providesfile#1[#2]{%
367 \wlog{File: #1 #2}%
368 \@addtofilelist{ #2}%
369 \endgroup}
370 \long\def\@addtofilelist#1{}
371 % \end{macrocode}
372 %
373 % \begin{macrocode}
374 \def\@empty{}
375 \catcode`\%=12
376 \def\@percentchar{%}
377 \catcode`\%=14
378 \let\@currdir\@undefined
379 \let\input@path\@undefined
380 \let\filename@parse\@undefined
381 % \end{macrocode}
382 % \begin{macro}{\strip@prefix}
383 % \changes{v0.2a}{1993/12/13}
384 % {modified, name changed from \cs{stripmeaning}.}
385 % \changes{v0.2e}{1994/01/19}
386 % {name changed from \cs{strip@meaning}, to match NFSS.}
387 % \begin{macrocode}
388 \def\strip@prefix#1>{}
389 %</2ekernel>
390 % \end{macrocode}
391 % \end{macro}
392 %
393 % \section{texsys.cfg}
394 % As mentioned above, any site specific definitions required to describe
395 % the filename handling must be entered into a file |texsys.cfg|. If
396 % |texsys.cfg| can not be located by |\openin|, we write a default
397 % version out. The default version only contains comments, so we do not
398 % actually input the file in that case. The automatic tests later will,
399 % hopefully, correctly define the required macros.
400 %
401 % The tricky code below checks to see if |texsys.cfg| exists. If it does
402 % not, all the text in this file between START and END is copied
403 % verbatim to a new file |texsys,cfg|. If |texsys.cfg| is found, then it
404 % is simply input. This is only done when this file is being used
405 % unstripped.
406 % \begin{macrocode}
407 %<*docstrip>
408 \openin15=texsys.cfg
409 \ifeof15
410 \typeout{** Writing a default texsys.cfg}
411 \immediate\openout15=texsys.cfg
412 \begingroup
413 \catcode`\^^M\active%
414 \let^^M\par%
415 \def\reserved@a#1^^M{%
416 \def\reserved@b{#1}%
417 \ifx\reserved@b\reserved@c\endgroup\else%
418 \immediate\write15{#1}%
419 \expandafter\reserved@a\fi}%
420 \def\reserved@d#1START^^M{\let\do\@makeother\dospecials\reserved@a}%
421 \catcode`\%=12
422 \def\reserved@c{%END}
423 \reserved@d
424 % \end{macrocode}
425 %START
426 % \subsection{texsys.cfg}
427 %
428 % This file contains the site specific definitions of the four macros\\
429 % |\@currdir|, |\input@path|, |\filename@parse| and |\@TeXversion|.
430 %
431 % As distributed it only contains comments, however this `empty'
432 % file will work on many systems because of the automatic tests built
433 % into |ltdirchk.dtx|. You \emph{are} allowed to edit this file to add
434 % definitions of these macros appropriate to your system.
435 %
436 %
437 % The macros that must be defined are:
438 %
439 % \DescribeMacro{\@currdir}
440 % |\@currdir|\meta{filename}\meta{space} should expand to a form of the
441 % filename that uniquely refers to the `current directory' if this is
442 % possible. (The expansion should also end with a space.) on UNIX,
443 % this is |\def\@currdir{./}|. For more exotic operating systems you may
444 % want to make |\@currdir| a macro with arguments delimited by |.|
445 % and/or \meta{space}. If the operating system has no concept of
446 % directory structure, this macro should be defined to be empty.
447 %
448 %
449 % \DescribeMacro{\input@path}
450 % If the primitive |\openin| searches the same directories as the
451 % primitive |\input|, then it is possible to tell (using |\ifeof|)
452 % whether a file exists before trying to input it. For systems like
453 % this, |\input@path| should be left undefined.
454 %
455 % If |\openin| does not `follow' |\input| then |\input@path| must be
456 % defined to be a list of directories to search for input files. The
457 % format for each directory is as for |\@currdir|, normally just a
458 % prefix is required, but it may be a macro with space-delimited
459 % argument. That is, if \meta{dir} is an entry in the input path,
460 % \TeX will try to load the expansion of
461 %
462 % \meta{dir}\meta{filename}\meta{space}
463 %
464 % So either \meta{dir} should be defined as a macro with argument
465 % delimited by space, or it should just expand to a directory name,
466 % including the final directory separator, so that it may be
467 % concatenated with the \meta{filename}. This means that for UNIX-like
468 % syntax, each \meta{dir} should end with a slash, |/|. One exception to
469 % this rule is that the input path should \emph{always} contain the
470 % empty directory |{}| as this will allow `full pathnames' to be used,
471 % and the `current directory' to be searched.
472 %
473 % |\input@path| should expand to a list of such directories, each in a
474 % |{}| group.
475 %
476 %
477 % \begin{sloppypar}
478 % \DescribeMacro{\filename@parse}
479 % After a call of the form: |\filename@parse{|\meta{filename}|}|, the
480 % three macros |\filename@area|, |\filename@base|, |\filename@ext| should
481 % be defined to be the `area' (or directory), basename and
482 % extension respectively. If there was no extension specified in
483 % \meta{filename}, |\filename@ext| should be |\let| to |\relax| (so this
484 % case may be tested with |\@ifundefined{filename@ext}| and, perhaps a
485 % default extension substituted).
486 % \end{sloppypar}
487 %
488 % Normally one would not need to define this macro in |texsys.cfg| as
489 % the automatic tests can supply parsers that work with UNIX and VMS
490 % syntax, as well as a basic parser that will cover many other cases.
491 % However some operating systems may need a `hand produced' parser
492 % in which case it should be defined in this file.
493 %
494 % The UNIX parser also works for most MSDOS \TeX\ versions.
495 % Currently if the UNIX or VMS parser is not used, |\filename@parse| is
496 % defined to always return an empty area, and to split the argument into
497 % basename and extension at the first `|.|' that occurs in the name.
498 % Parsers for other formats may be defined in |texsys.cfg|,
499 % in which case they will be used in preference to the default
500 % definitions.
501 %
502 %
503 % \DescribeMacro{\@TeXversion}
504 % You should not need to set this macro in |texsys.cfg|. \LaTeX\
505 % tests to set this automatically. See the comments in the opening
506 % section of \texttt{ltdirchk.dtx}.
507 %
508 %
509 % The following sections give examples of definitions which might
510 % work on various systems. These are currently mainly untested as I only
511 % have access to a few systems, all of which do not need this file as
512 % the automatic tests work. All the code is commented out.
513 %
514 % \subsection{UNIX (web2c)}
515 % This implementation does make |\openin| and |\input| look in the same
516 % places. Acceptable settings are made by |ltdirchk.dtx|, and so this
517 % file may be empty. The definitions below are therefore just for
518 % information.
519 % \begin{macrocode}
520 %\def\@currdir{./}
521 %\let\input@path\@undefined
522 % \end{macrocode}
523 %
524 % \subsection{UNIX (other)}
525 % Apparently some commercial UNIX implementations have different paths
526 % for |\openin| and |\input|. For these one could use definitions like
527 % the following (with whatever directories are used at your site):
528 % note that the directory names should end with |/|.
529 % \begin{macrocode}
530 % \def\@currdir{./}
531 % \def\input@path{%
532 % {/usr/local/lib/tex/inputs/distrib/}%
533 % {/usr/local/lib/tex/inputs/contrib/}%
534 % {/usr/local/lib/tex/inputs/local/}%
535 % }
536 % \end{macrocode}
537 %
538 % \subsection{MSDOS (emtex)}
539 % This implementation does make |\openin| and |\input| look in the same
540 % places. Acceptable settings are made by |ltdirchk.dtx|, and so this
541 % file may be empty. The definitions below are therefore just for
542 % information.
543 % \begin{macrocode}
544 % \def\@currdir{./}
545 % \let\input@path\@undefined
546 % \end{macrocode}
547 %
548 % \subsection{MSDOS (other)}
549 % Some PC implementations have different paths
550 % for |\openin| and |\input|. For these one could use definitions like
551 % the following (with whatever directories are used at your site):
552 % note that the directory names should end with |/|.
553 % This assumes the implementation uses UNIX style |/| as the directory
554 % separator.
555 % \begin{macrocode}
556 % \def\@currdir{./}
557 % \def\input@path{%
558 % {c:/tex/inputs/distrib/}%
559 % {c:/tex/inputs/contrib/}%
560 % {c:/tex/inputs/local/}%
561 % }
562 % \end{macrocode}
563 %
564 % \subsection{VMS (DECUS \TeX, PD VMS 3.6)}
565 % This implementation does make |\openin| and |\input| look in the same
566 % places. Acceptable settings are made by |ltdirchk.dtx|, and so this
567 % file may be empty. The definitions below are therefore just for
568 % information.
569 % \begin{macrocode}
570 % \def\@currdir{[]}
571 % \let\input@path\@undefined
572 % \end{macrocode}
573 %
574 % \subsection{VMS (???)}
575 % Some VMS implementations have different paths
576 % for |\openin| and |\input|. For these one could use definitions like
577 % the following:
578 % \begin{macrocode}
579 % \def\@currdir{[]}
580 % \def\input@path{%
581 % {tex_inputs:}%
582 % {SOMEDISK:[SOME.TEX.DIRECTORY]}%
583 % }
584 % \end{macrocode}
585 %
586 % \subsection{MACINTOSH (OzTeX 1.6)}
587 % This implementation does make |\openin| and |\input| look in the same
588 % places. Acceptable settings are made by |ltdirchk.dtx|, and so this
589 % file may be empty. The definitions below are therefore just for
590 % information.
591 % \begin{macrocode}
592 % \def\@currdir{:}
593 % \let\input@path\@undefined
594 % \end{macrocode}
595 %
596 % \subsection{MACINTOSH (other)}
597 % Some Macintosh implementations have different paths
598 % for |\openin| and |\input|. For these one could use definitions like
599 % the following (with whatever folders are used on your machine):
600 % note that the directory names should end with |:|, and they should
601 % contain {\em no\/} spaces.
602 % \begin{macrocode}
603 % \def\@currdir{:}
604 % \def\input@path{%
605 % {Hard-Disk:Applications:TeX:TeX-inputs:}%
606 % {Hard-Disk:Applications:TeX:My-inputs:}%
607 % }
608 % \end{macrocode}
609 %
610 % \subsection{FAKE EXAMPLE}
611 % This example is for an operating system that has filenames of the
612 % form |<area>name| For maximum compatibility with macro sets,
613 % you want |name.ext| to be mapped to |<ext>name|.
614 % and |<area>name.ext| to be mapped to |<area.ext>name|.
615 % |\input| does this mapping automatically, but |\openin| does not, and
616 % does not look in the same places as |\input|.
617 % |<>name| is the desired `current directory' syntax.
618 %
619 % the following code would possibly work:
620 % \begin{macrocode}
621 % \def\@dir#1#2 {%
622 % \@d@r{#1}#2..\@nil}
623 % \def\@d@r#1#2.#3.#4\@nil{%
624 % <\ifx\@dir#1\@dir\else#1\ifx\@dir#3\@dir\else.\fi\fi#3>#2 }
625 %
626 % \def\@currdir{\@dir{}}
627 % \def\input@path{%
628 % {\@dir{area.one}}%
629 % {\@dir{area.two}}%
630 % }
631 % \end{macrocode}
632 %END
633 % \begin{macrocode}
634 \immediate\closeout15
635 % \end{macrocode}
636 % If |texsys.cfg| did exist, then input it.
637 % \begin{macrocode}
638 \else
639 \typeout{** Using the existing texsys.cfg}
640 \closein15
641 \input texsys.cfg
642 \fi
643 %</docstrip>
644 % \end{macrocode}
645 %
646 % If the stripped version of this file is being used (in latex2e.ltx)
647 % then texsys.cfg should be there, so just input it.
648 % \begin{macrocode}
649 %<dircheck>\input texsys.cfg
650 % \end{macrocode}
651 %
652 % \changes{v0.2f}{1994/01/20}
653 % {\cs{@copytexsys} and the texsys.new file removed}
654 %
655 % \section{Setting \texttt{\cs{@currdir}}}
656 %
657 % \begin{macro}{\@currdir}
658 % \begin{macro}{\IfFileExists}
659 % \changes{v0.2e}{1994/01/19}
660 % {name changed from \cs{test}}
661 % This is a local definition of |\IfFileExists|. It tries to relocate
662 % |texsxys.aux|. If it succeeds, then the |\@currdir| syntax has been
663 % determined. If all the tests fail then |\@currdir| will be set to
664 % |\@empty|, and |ltxcheck| will warn of this when it checks the format.
665 % \begin{macrocode}
666 \begingroup
667 \count@\time
668 \divide\count@ 60
669 \count2=-\count@
670 \multiply\count2 60
671 \advance\count2 \time
672 % \end{macrocode}
673 %
674 % \begin{macro}{\today}
675 % The current date and time stamp.
676 % \changes{v0.2g}{1994/01/21}
677 % {Name changed from \cs{stamp}, to save memory}
678 % \begin{macrocode}
679 \edef\today{%
680 \the\year/\two@digits{\the\month}/\two@digits{\the\day}:%
681 \two@digits{\the\count@}:\two@digits{\the\count2}}
682 % \end{macrocode}
683 % \end{macro}
684 %
685 % Create a file |texsys.aux| (hopefully in the current directory),
686 % then try to locate it again.
687 % \begin{macrocode}
688 \immediate\openout15=texsys.aux
689 \immediate\write15{\today^^J}
690 \immediate\closeout15 %
691 % \end{macrocode}
692 %
693 % |#1| is the file to try, |#2| is what to do on success, |#3| on
694 % failure. Note that this definition is overwritten later on again!
695 % \begin{macrocode}
696 \def\IfFileExists#1#2#3{%
697 \openin\@inputcheck#1 %
698 \ifeof\@inputcheck
699 #3\relax
700 \else
701 \read\@inputcheck to \reserved@a
702 \ifx\reserved@a\today
703 \typeout{#1 found}#2\relax
704 \else
705 \typeout{BAD: old file \reserved@a (should be \today)}%
706 #3\relax
707 \fi
708 \fi
709 \closein\@inputcheck}
710 % \end{macrocode}
711 %
712 % \begin{macrocode}
713 \endlinechar=-1
714 % \end{macrocode}
715 %
716 % If |\@currdir| has not been pre-defined in |texsys.cfg| then test for
717 % UNIX, VMS and Oz-\TeX-Mac. syntax.
718 % \changes{v0.2h}{1994/01/24}
719 % {Stop testing once texsys.aux has been found}
720 % \begin{macrocode}
721 \ifx\@currdir\@undefined
722 \IfFileExists{./texsys.aux}{\gdef\@currdir{./}}%
723 {\IfFileExists{[]texsys.aux}{\gdef\@currdir{[]}}%
724 {\IfFileExists{:texsys.aux}{\gdef\@currdir{:}}{}}}
725 % \end{macrocode}
726 % If it is still undefined at this point, all the above tests failed.
727 % Earlier versions interactively prompted for a definition at this
728 % point, but it seems impossible to reliably obtain information from
729 % users at this point in the installation. This version of the file
730 % produces a format with no user-interaction. Later if the format is not
731 % suitable for the system, |texsys.cfg| may be edited and the format
732 % re-made.
733 % \changes{v0.2a}{1993/12/13}
734 % {Removed interactive prompting for current directory syntax}
735 % \changes{v0.2f}{1994/01/20}
736 % {\cs{@copytexsys} removed}
737 % \changes{v1.0u}{1996/12/06}
738 % {*** removed from various messages for GNU Make.
739 % internal/2338}
740 % \begin{macrocode}
741 \ifx\@currdir\@undefined
742 \global\let\@currdir\@empty
743 \typeout{^^J^^J%
744 !! No syntax for the current directory could be found^^J%
745 }%
746 \fi
747 % \end{macrocode}
748 % Otherwise |\@currdir| was defined in |texsys.cfg|. In this case check
749 % that the syntax specified works on this system. (In case a complete
750 % \LaTeX\ system has been copied from one system to another.) If the
751 % test fails, give up. The installer should remove or correct the
752 % offending |texsys.cfg| and try again.
753 % \begin{macrocode}
754 \else
755 \IfFileExists{\@currdir texsys.aux}{}{%
756 \edef\reserved@a{\errhelp{%
757 texsys.cfg specifies the current directory syntax to be^^J%
758 \meaning\@currdir^^J%
759 but this does not work on this system.^^J%
760 Remove texsys.cfg and restart.}}\reserved@a
761 \errmessage{Bad texsys.cfg file: \noexpand\@currdir}\@@end}
762 % \end{macrocode}
763 % The version of |\@currdir| in |texsys.cfg| looks OK.
764 % \begin{macrocode}
765 \fi
766 % \end{macrocode}
767 % \changes{v0.2d}{1994/01/14}
768 % {Close the texsys.aux output stream}
769 % \begin{macrocode}
770 \immediate\closeout15 %
771 \endgroup
772 % \end{macrocode}
773 %
774 % \begin{macrocode}
775 \typeout{^^J^^J%
776 \noexpand\@currdir set to:
777 \expandafter\strip@prefix\meaning\@currdir.^^J%
778 }
779 % \end{macrocode}
780 % \end{macro}
781 % \end{macro}
782 %
783 %
784 % \changes{v0.2a}{1993/12/13}
785 % {on the `docstrip' pass, do not check openin path}
786 %
787 % Stop here if the file is being used unstripped.
788 % \begin{macrocode}
789 %<*docstrip>
790 \relax\endinput
791 %</docstrip>
792 % \end{macrocode}
793 %
794 % \section{Setting \texttt{\cs{input@path}}}
795 %
796 % Earlier versions of this file attempted to automatically test whether
797 % |\input@path| was required, and interactively prompt for a path if
798 % necessary. This was not found to be very reliable The first-time
799 % installer of \LaTeXe\ can not be expected to have enough information
800 % to supply the correct information to the prompts. Now the interaction
801 % is omitted. After the format is made the installer can attempt to run
802 % the test document |ltxcheck.tex| through \LaTeXe. This will check,
803 % among other things, whether |texsys.cfg| will need to be edited and
804 % the format remade.
805 %
806 % \begin{macro}{\input@path}
807 % Now set up the |\input@path|.
808 %
809 % |\input@path| should either be undefined, or a list of directories as
810 % described in the introduction.
811 % \changes{v0.2e}{1994/01/19}
812 % {No longer check that an empty group is in the path}
813 % \begin{macrocode}
814 \typeout{^^J%
815 Assuming \noexpand\openin and \noexpand\input^^J%
816 \ifx\input@path\@undefined
817 % \end{macrocode}
818 % |\input@path| has not been pre-defined.
819 % \begin{macrocode}
820 have the same search path.^^J%
821 \else
822 % \end{macrocode}
823 % |\input@path| has been defined in |texsys.cfg|.
824 % \begin{macrocode}
825 have different search paths.^^J%
826 LaTeX will use the path specified by \noexpand\input@path:^^J%
827 \fi
828 }
829 % \end{macrocode}
830 % \end{macro}
831 %
832 % \section{Filename Parsing}
833 %
834 % \begin{macro}{\filename@parse}
835 % Split a filename into its components.
836 % \changes{v0.2g}{1994/01/21}
837 % {Minor changes, and add Mac version (:)}
838 % \begin{macrocode}
839 \ifx\filename@parse\@undefined
840 \def\reserved@a{./}\ifx\@currdir\reserved@a
841 % \end{macrocode}
842 % |\filename@parse| was not specified in |texsys.cfg|, but |\@currdir|
843 % looks like UNIX\ldots
844 % \begin{macrocode}
845 \typeout{^^JDefining UNIX/DOS style filename parser.^^J}
846 \def\filename@parse#1{%
847 \let\filename@area\@empty
848 \expandafter\filename@path#1/\\}
849 % \end{macrocode}
850 %
851 % Search for the last |/|.
852 % \begin{macrocode}
853 \def\filename@path#1/#2\\{%
854 \ifx\\#2\\%
855 \def\reserved@a{\filename@simple#1.\\}%
856 \else
857 \edef\filename@area{\filename@area#1/}%
858 \def\reserved@a{\filename@path#2\\}%
859 \fi
860 \reserved@a}
861 % \end{macrocode}
862 %
863 % \begin{macrocode}
864 \else\def\reserved@a{[]}\ifx\@currdir\reserved@a
865 % \end{macrocode}
866 % |\filename@parse| was not specified in |texsys.cfg|, but |\@currdir|
867 % looks like VMS\ldots
868 % \begin{macrocode}
869 \typeout{^^JDefining VMS style filename parser.^^J}
870 \def\filename@parse#1{%
871 \let\filename@area\@empty
872 \expandafter\filename@path#1]\\}
873 % \end{macrocode}
874 %
875 % Search for the last |]|.
876 % \begin{macrocode}
877 \def\filename@path#1]#2\\{%
878 \ifx\\#2\\%
879 \def\reserved@a{\filename@simple#1.\\}%
880 \else
881 \edef\filename@area{\filename@area#1]}%
882 \def\reserved@a{\filename@path#2\\}%
883 \fi
884 \reserved@a}
885 % \end{macrocode}
886 %
887 % \begin{macrocode}
888 \else\def\reserved@a{:}\ifx\@currdir\reserved@a
889 % \end{macrocode}
890 % |\filename@parse| was not specified in |texsys.cfg|, but |\@currdir|
891 % looks like Macintosh\ldots
892 % \begin{macrocode}
893 \typeout{^^JDefining Mac style filename parser.^^J}
894 \def\filename@parse#1{%
895 \let\filename@area\@empty
896 \expandafter\filename@path#1:\\}
897 % \end{macrocode}
898 %
899 % Search for the last |:|.
900 % \changes{v1.0g}{1994/05/25}
901 % {Mac parser had " typo for :}
902 % \begin{macrocode}
903 \def\filename@path#1:#2\\{%
904 \ifx\\#2\\%
905 \def\reserved@a{\filename@simple#1.\\}%
906 \else
907 \edef\filename@area{\filename@area#1:}%
908 \def\reserved@a{\filename@path#2\\}%
909 \fi
910 \reserved@a}
911 % \end{macrocode}
912 %
913 % \begin{macrocode}
914 \else
915 % \end{macrocode}
916 % |\filename@parse| was not specified in |texsys.cfg|.
917 % So just make a simple parser that always sets |\filename@area| to
918 % empty.
919 % \begin{macrocode}
920 \typeout{^^JDefining generic filename parser.^^J}
921 \def\filename@parse#1{%
922 \let\filename@area\@empty
923 \expandafter\filename@simple#1.\\}
924 \fi\fi\fi
925 % \end{macrocode}
926 %
927 % |\filename@simple| is used by all three versions.
928 % Finally we can split off the extension.
929 % \changes{v1.3a}{2019/11/01}
930 % {take last . not first}
931 % \begin{macrocode}
932 %</dircheck>
933 %<*dircheck,latexrelease>
934 %<latexrelease>\IncludeInRelease{2019/10/01}{\filename@simple}
935 %<latexrelease> {Final dot for extension}%
936 \def\filename@simple#1.#2\\{%
937 \ifx\\#2\\%
938 \let\filename@ext\relax
939 \edef\filename@base{#1}%
940 \else
941 \filename@dots{#1}#2\\%
942 \fi}
943 % \end{macrocode}
944 %
945 % \begin{macrocode}
946 \def\filename@dots#1#2.#3\\{%
947 \ifx\\#3\\%
948 \def\filename@ext{#2}%
949 \edef\filename@base{#1}%
950 \else
951 \filename@dots{#1.#2}#3\\%
952 \fi}
953 %<latexrelease>\EndIncludeInRelease
954 %<latexrelease>\IncludeInRelease{0000/00/00}{\filename@simple}
955 %<latexrelease> {Final dot for extension}%
956 %<latexrelease> \def\filename@simple#1.#2\\{%
957 %<latexrelease> \ifx\\#2\\%
958 %<latexrelease> \let\filename@ext\relax
959 %<latexrelease> \else
960 %<latexrelease> \edef\filename@ext{\filename@dot#2\\}%
961 %<latexrelease> \fi
962 %<latexrelease> \edef\filename@base{#1}}
963 %<latexrelease>\EndIncludeInRelease
964 %</dircheck,latexrelease>
965 %<*dircheck>
966 % \end{macrocode}
967 %
968 % Remove a final dot, added earlier.
969 % \begin{macrocode}
970 \def\filename@dot#1.\\{#1}
971 % \end{macrocode}
972 %
973 % \begin{macrocode}
974 \else
975 % \end{macrocode}
976 % Otherwise, |\filename@parse| was specified in |texsys.cfg|.
977 % \begin{macrocode}
978 \typeout{^^J^^J%
979 \noexpand\filename@parse was defined in texsys.cfg:^^J%
980 \expandafter\strip@prefix\meaning\filename@parse.^^J%
981 }
982 \fi
983 % \end{macrocode}
984 % \end{macro}
985 %
986 % \section{\TeX\ Versions}
987 %
988 % \begin{macro}{\@TeXversion}
989 % \TeX\ versions older than 3.141 require |\@TeXversion| to be
990 % set. This can be determined automatically due to a trick suggested
991 % by Bernd Raichle. Actually this will not always get the correct
992 % version number, e.g., \TeX3.14 would be detected as \TeX3, but \LaTeX\
993 % only needs to take account of \TeX's older than 3, or between 3 and
994 % 3.14.
995 % \changes{v1.0h}{1994/10/11}
996 % {Check for TeX3.14}
997 % \begin{macrocode}
998 \ifx\@TeXversion\@undefined
999 \ifx\@undefined\inputlineno
1000 \def\@TeXversion{2}
1001 \else
1002 {\catcode`\^^J=\active
1003 \def\reserved@a#1#2\@@{\if#1\string^3\fi}
1004 \edef\reserved@a{\expandafter\reserved@a\string^^J\@@}
1005 \ifx\reserved@a\@empty\else\gdef\@TeXversion{3}\fi}
1006 \fi
1007 \fi
1008 % \end{macrocode}
1009 % \end{macro}
1010 %
1011 % \begin{macrocode}
1012 %% ---- END temporary definitions for bootstrapping ----
1013 %</dircheck>
1014 % \end{macrocode}
1015 %
1016 % \section{ltxcheck.tex}
1017 % After the format has been made, and article.cls moved with the
1018 % other files to the `standard input directory' as specified in
1019 % |install.txt|, the format may be checked by running the file
1020 % |ltxcheck.tex|.
1021 % \changes{v0.2f}{1994/01/20}
1022 % {Modify all of ltxcheck}
1023 % \changes{v1.0h}{1994/10/11}
1024 % {Modify all of ltxcheck again}
1025 % \changes{v1.0t}{1996/09/25}
1026 % {Move ltxcheck to separate file}
1027 %
1028 %
1029 %
1030 % \Finale
1031 %