<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%% readprov.sty
%% --
%% get file infos without reading the entire file

\def \fileversion {0.5} \def \filedate {2012/11/22} 

%% copyright (C) 2008, 2010, 2011, 2012 Uwe Lueck, 
%% http://www.contact-ednotes.sty.de.vu 
%% -- author-maintained in the sense of LPPL below.
%%
%% This file can be redistributed and/or modified under 
%% the terms of the LaTeX Project Public License; either 
%% version 1.3c of the License, or any later version.
%% The latest version of this license is in
%%     http://www.latex-project.org/lppl.txt
%% We did our best to help you, but there is NO WARRANTY. 
%%
%% Please report bugs, problems, and suggestions via 
%% 
%%   http://www.contact-ednotes.sty.de.vu 
%%
% USAGE:
% 
% LOADING: The functionality of readprov.sty is activated by 
%     \usepackage{readprov}
% or 
%     \RequirePackage{readprov}
% (this one may precede \documentclass) in the document preamble. 
% 'readprov' does not have any package options.
% 
% INSERTING: Recall that \\
% %
% |\GetFileInfo{&lt;filename&gt;}| (including extension)\\
% %
% from LaTeX's doc.sty sets macro \filename to &lt;filename&gt; 
% (including extension) and furthermore sets macros
% \filedate, \fileversion, and \fileinfo 
% to the \emph{date}, \emph{version}, and further \emph{info}
% associated with &lt;filename&gt; earlier ``some way'' ...
% \ This means that file &lt;filename&gt; has been \input before
% and identified itself by \ProvidesFile, \ProvidesPackage, 
% or \ProvidesClass. 
% 
% 'readprov' simply copies \GetFileInfo from doc.sty 
% so the same functionality is provided independently of 
% other doc.sty features---without loading LaTeX's doc.sty.
%
% % new 2010/11/27:
% Unfortunately, \GetFileInfo is fragile, it is especially 
% unhelpful for referring to \emph{two} packages in the same 
% \thanks footnote. So we introduce (do compare 'zwgetfdate'!)\\
% |\UseDateOf{&lt;filename&gt;}|\quad |\UseVersionOf{&lt;filename&gt;}|\quad
% (with extension)\\
% These commands are robust (even expandable). Instead of 
% $$\GetFileInfo{&lt;filename&gt;}\fileversion{}\texttt{ as of }\filedate$$
% you can type 
% $$\UseFileVersionOf{&lt;filename&gt;}\texttt{ as of }\UseFileDateOf{&lt;filename&gt;}$$ 
%
% EXTRACTING: \GetFileInfo, \UseDateOf, and \UseVersionOf need the data 
% from \ProvidesPackage, \ProvidesClass, or \ProvidesFile.
% Instead of getting them by \usepackage, \documentclass, or \input,
% they can be obtained with the following commands.
% \\
% |\ReadFileInfos{&lt;list-of-filenames&gt;}| (with extensions)\\
% applies to all kinds of files---provided such a file contains 
% such a \Provide... command. 
% \\
% |\ReadPackageInfos{&lt;list-of-filenames&gt;}| (without extensions)\\
% searches .sty files from &lt;list-of-filenames&gt; for \ProvidesPackage. 
% 
% The two former commands accept lists with commas as separators 
% almost like with \usepackage (currently we must use "%" 
% to hide a line break in the script, 
% and there must be no spaces in the list).
% \\
% |\ReadClassInfo{&lt;filename&gt;}| (without extension)\\
% searches &lt;filename&gt;.cls for \ProvidesClass. 
% At present [TODO] it can be used once only, 
% and only for use with myfilist.sty.
% But you can use \ReadFileInfos for reporting on \emph{various} 
% classes, even in a document!
% \\
% |\ReadShInfos{&lt;list-of-filenames&gt;}| (with extensions)\\ 
% is a variant of \ReadFileInfos{&lt;list-of-filenames&gt;} that for each 
% &lt;file&gt; in &lt;list-of-filenames&gt; processes 
%     # \ProvidesFile{&lt;file&gt;}[&lt;info&gt;]
% in &lt;file&gt; (new with v0.5).
% 
% NOTE: (i)~So far, [TODO] the \Read... commands explained before 
% do not work after `\begin{document}'
% (with rare exceptions, \NeedTeXFormat is one 
% obstacle---may be 'zwgetfdate' really is better). 
% (ii)~Those \Read... commands execute \GetFileInfo 
% (with the final file from the list). So you may be lucky to get 
% the intended \filename, \filedate, \fileversion, and \fileinfo
% without using \GetFileInfo. The chance is the better the 
% later the \Read... command is used, best right before 
% `\begin{document}'. Even then it may *fail*---when the latter 
% command loads a package redefining \filedate etc. ...
%
% IMPLEMENTATION: 

\NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \newcommand* etc. 
\ProvidesPackage{readprov}
                [\filedate\space v\fileversion \space 
                 file infos without loading (UL)] 
% INSERTING: \\
% |\GetFileInfo{&lt;filename&gt;}| (with extension)\\ % \ %
% just was stolen from Standard LaTeX's doc.sty 
% (before I varied it).
% It is fragile.
\def\GetFileInfo#1{%
  \def\filename{#1}%
  \def\@tempb##1 ##2 ##3\relax##4\relax{%
    \def\filedate{##1}%
    \def\fileversion{##2}%
    \def\fileinfo{##3}}%
% Here was: 
%     \edef\@tempa{\csname ver@#1\endcsname}%
%     \expandafter\@tempb\@tempa\relax? ? \relax\relax}
% We can do it a little more elegantly with the internals %% ly 2012/03/16
% (that vary the original \GetFileInfo) 
% for our new \UseDateOf and \UseVersionOf:
    \read@file@info\@tempb{#1}} 
% (Will be overwritten without warning 
% when doc.sty is loaded afterwards.)
\newcommand*{\read@file@info}[2]{%          new 2010/11/27
  \expandafter \expandafter \expandafter
    #1\csname ver@#2\endcsname \relax? ? \relax\relax}
% |\UseDateOf{&lt;filename&gt;}| is robust (expandable):  %% O 2012/03/20
\newcommand*{\UseDateOf}{\read@file@info\read@file@date}
% The internal reading commands vary `\@tempb' 
% from the original \GetFileInfo:
\def\read@file@date   #1 #2\relax#3\relax{#1}
% |\UseVersionOf{&lt;filename&gt;}| is robust (expandable) as well:
\newcommand*{\UseVersionOf}{\read@file@info\read@file@version}
\def\read@file@version#1 #2 #3\relax#4\relax{#2}
% EXTRACTING: \\
% |\ReadPackageInfos{&lt;list-of-filenames&gt;}| without extensions:
\newcommand*{\ReadPackageInfos}{%
    \read@package@infos\RequirePackage{sty}}
% `\@pkgextension' and `\@clsextension' are bad 
% for using `\filename' in the document (`\@onlypreamble').
% \\
% |\ReadClassInfo{&lt;filename&gt;}| without extension (v0.5):
\newcommand*{\ReadClassInfo}{%
    \read@package@infos\LoadClass{cls}}
% Before v0.4, the modified ultimate expansion of \@pr@videpackage
% was fixed or ``static.'' Now \@pr@videpackage is modified 
% at each call of \ReadClassInfo or `\Read'\-`PackageInfos'
% in such a way that the \emph{current} meaning of 
% `\@pr@vide'\-`package' is used by the modified one---\emph{another}
% package ('filedate') may have modified 
% \@pr@videpackage before, and the latter's meaning may 
% change several times during a \TeX\ run:
\newcommand*{\read@package@infos}[3]{%
  %% #1 \Req.../Load..., #2 extension, #3 name list 
  \begingroup                           %% 2010/11/26
    \let\RP@@provpkg\@pr@videpackage
    \def\@pr@videpackage[##1]{\RP@@provpkg[{##1}]\endinput}%
    #1{#3}%
  \endgroup \GetFileInfo{#3.#2}%        %% 2010/11/26
}
  %% &lt;- TODO more classes 2008/03/16
% |\ReadFileInfos{&lt;list-of-filenames&gt;}| with extensions:
\newcommand*{\ReadFileInfos}[1]{%
  \begingroup
% v0.4 treats \@providesfile by analogy to \@pr@videpackage above:
    \let\RP@@provfile\@providesfile
    \def\@providesfile##1[##2]{\RP@@provfile{##1}[{##2}]\endinput}%
    %% 2008/03/19:
    \def\ProvidesClass  ##1{\ProvidesFile{##1.\@clsextension}}%
    \def\ProvidesPackage##1{\ProvidesFile{##1.\@pkgextension}}%
    \@for\@tempa:=#1\do{%
      \edef\@tempa{\expandafter\read@no@spaces\@tempa\@nil}%
      \input{\@tempa}%
      \global\let\@gtempa\@tempa}   %% 2010/11/26
  \endgroup
  \GetFileInfo\@gtempa              %% 2010/11/26
}
\def\read@no@spaces#1#2\@nil{#1#2}  %% 2008/03/23
% |\ReadShInfos{&lt;list-of-filenames&gt;}| with extensions:
\newcommand*{\ReadShInfos}[1]{%                     %% 2012/11/22
    {\catcode`\#9  % ignore .sh comment characters
     \catcode`\!14 % ignore content of shebang line
     \ReadFileInfos{#1}}}
\endinput 

%% VERSION HISTORY
v0.1    2008/03/19  created file "readprov.sty"
        2008/03/23  smart file name separation, \ifx$ for \ifcat$
        2008/05/22  typo ist -&gt; it
v0.2    2010/04/03  renamed "myfiles.sty"; 
                    broke long lines etc. for doc
v0.3    2010/11/25  split off from former "myfiles.sty", 
                    added \GetFileInfo
        2010/11/26  automatic \GetFileInfo
        2010/11/27  new/real documentation; more \newcommand*s; 
                    \GetFileInfo redefined, \Use...;
                    \docnewline -&gt; \\; NOTE etc.
v0.3a   2012/03/16  doc.: grammar fix
v0.3b   2012/03/20  typo fix "Of" 
v0.4    2012/11/10  reimplementation for `filedate'
                    (\@pr@videpackage, \@providefile)
v0.5    2012/11/22  \ReadShInfos
</pre></body></html>