From 3121f2e4839a5b49ac3164f1415b098816244325 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 5 Jan 2011 00:23:35 +0000
Subject: currfile 0.3 (3jan11)

git-svn-id: svn://tug.org/texlive/trunk@20934 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/source/latex/currfile/currfile.dtx  | 103 +++++++++++----------
 1 file changed, 52 insertions(+), 51 deletions(-)

(limited to 'Master/texmf-dist/source/latex/currfile/currfile.dtx')

diff --git a/Master/texmf-dist/source/latex/currfile/currfile.dtx b/Master/texmf-dist/source/latex/currfile/currfile.dtx
index 03a66bedbd9..c5e3a3f7dab 100644
--- a/Master/texmf-dist/source/latex/currfile/currfile.dtx
+++ b/Master/texmf-dist/source/latex/currfile/currfile.dtx
@@ -1,5 +1,5 @@
 % \iffalse meta-comment
-%% Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
+%% Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de>
 %% -----------------------------------------------------------------
 %%
 %% This work may be distributed and/or modified under the
@@ -19,7 +19,7 @@
 %% This work consists of the files currfile.dtx, currfile.ins
 %% and the derived file currfile.sty.
 %%
-%% $Id: currfile.dtx 1911 2010-12-08 19:29:13Z martin $
+%% $Id: currfile.dtx 2006 2011-01-03 22:54:46Z martin $
 % \fi
 %
 % \iffalse
@@ -29,12 +29,12 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{currfile}
 %<*package>
-    [2010/12/08 v0.2 Current input file name and path]
+    [2011/01/03 v0.3 Current input file name and path]
 %</package>
 %
 %<*driver>
-\documentclass{ltxdoc}
-\usepackage{currfile}[2010/04/08]
+\documentclass{ydoc}[2011/01/03]
+\usepackage{currfile}[2011/01/03]
 \usepackage{ifpdf}
 \usepackage{booktabs}
 \usepackage{hyperref}
@@ -42,6 +42,8 @@
 \CodelineIndex
 \RecordChanges
 \providecommand*\pkg{\texttt}
+\providecommand*\opt{\texttt}
+\let\cs\Macro
 \begin{document}
   \DocInput{currfile.dtx}
   \PrintChanges
@@ -50,7 +52,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{209}
+% \CheckSum{201}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -73,10 +75,16 @@
 % \changes{v0.2}{2010/04/10}{Now work for all files, not only for \cs{input} and \cs{include} files.
 %  Added package option 'fink' to define the same macros as the 'fink' package.
 % }
+% \changes{v0.3}{2011/01/03}{Update to use new version of filehook.}
 %
 % \GetFileInfo{currfile.dtx}
 %
-% \DoNotIndex{\newcommand,\newenvironment}
+% \DoNotIndex{\newcommand,\newenvironment,\fi,\relax,\def,\gdef,\xdef}
+% \DoNotIndex{\RequirePackage,\space,\PackageError,\PackageWarning,\let}
+% \DoNotIndex{\ifx,\global,\long,\dindent,\else,\empty,\expandafter}
+% \DoNotIndex{\csname,\endcsname,\DeclareBoolOption,\DeclareStringOption}
+% \DoNotIndex{\SetupKeyvalOptions,\begingroup,\endgroup,\@gobble,\edef}
+% \DoNotIndex{\message,\jobname,\@namedef}
 % 
 % \ifpdf
 % \hypersetup{%
@@ -112,30 +120,30 @@
 % The directory, base (name without extension), extension (without dot), name (=base+`|.|'+ext) and path (=dir+name) of the current file are provided by these macros.
 % This means that the macros returns the file information of the file they are used in. All macros are fully expanded, i.e.\ only hold
 % text and not further macros.
-% Special care is taken to keep the file information of |\include|d files till the final |\clearpage| command, so that page header and footer of the last page 
+% Special care is taken to keep the file information of \Macro\included files till the final \Macro\clearpage command, so that page header and footer of the last page 
 % will hold the correct data.
 %
-% Since v0.2 all files are are taken into account, i.e.\ files read using |\input|, |\include|, |\InputIfFileExists|, |\usepackage|, |\RequirePackage| and even
-% |\LoadClass| and similar macros. Before v0.2 only |\input| or |\include| and the main file were taken into account.
+% Since v0.2 all files are are taken into account, i.e.\ files read using \Macro\input, \Macro\include, \Macro\InputIfFileExists, \Macro\usepackage, \Macro\RequirePackage and even
+% \Macro\LoadClass and similar macros. Before v0.2 only \Macro\input or \Macro\include and the main file were taken into account.
 %
-% This package uses the |filehook| package written by the same author. See there for possible incompatibilities with classes or other packages.
+% This package uses the \pkg{filehook} package written by the same author. See there for possible incompatibilities with classes or other packages.
 %
 % More detailed information can be found in the implementation section \ref{sec:impl} if required.
 %
 % \subsection*{Package Options}
-% The package provides two options |mainext| and |maindir| which can be used to provide the extension and directory of the main file.
+% The package provides two options \opt{mainext} and \opt{maindir} which can be used to provide the extension and directory of the main file.
 % This is required if the above macros should be used for the main file itself and if this does has a file extension other than `|.tex|' (e.g.\ a |.dtx| file)
-% or is not located in the current directory. To provide support for the macros defined by the |fink| package (see section~\ref{sec:fink}) a |fink| option exists.
+% or is not located in the current directory. To provide support for the macros defined by the \pkg{fink} package (see section~\ref{sec:fink}) a \pkg{fink} option exists.
 %
 % \section{Compatibility with the \texttt{fink} package}\label{sec:fink}
-% The |fink| package (\emph{fi}le \emph{n}ame \emph{k}eeper) provides a similar functionality. It has inspired this package in several points (e.g.\ package
-% options). However, it does not exclude package and other preamble files and does not take care to change the filename \emph{after} the |\clearpage| of
-% |\include|. The author of \texttt{fink} is now discontinuing it in favour of this package.
-% Existing documents which use |fink| should either rename the related macros as shown by Table~\ref{tab:fink} or use the |fink| option of |currfile| which defines
-% the |fink| macros to use the |currfile| ones.
+% The \pkg{fink} package (\emph{fi}le \emph{n}ame \emph{k}eeper) provides a similar functionality. It has inspired this package in several points (e.g.\ package
+% options). However, it does not exclude package and other preamble files and does not take care to change the filename \emph{after} the \Macro\clearpage of
+% \Macro\include. The author of \texttt{fink} is now discontinuing it in favour of this package.
+% Existing documents which use \pkg{fink} should either rename the related macros as shown by Table~\ref{tab:fink} or use the \pkg{fink} option of \pkg{currfile} which defines
+% the \pkg{fink} macros to use the \pkg{currfile} ones.
 %
-% Because both packages do basically the same thing, especially patch the same macros, there are incompatible and should not be loaded both.
-% In consent with the |fink| package author this package will undo most of the |fink| code if it was already loaded or prevent it from being loaded afterwards.
+% Because both packages do basically the same thing, especially patch the same macros, there are incompatible and should not be loaded at the same time.
+% In consent with the \pkg{fink} package author this package will undo most of the \pkg{fink} code if it was already loaded or prevent it from being loaded afterwards.
 %
 % \begin{table}
 % \belowcaptionskip=\abovecaptionskip
@@ -145,7 +153,7 @@
 % \centering
 % \begin{tabular}{lll}
 %   \toprule
-%    \texttt{fink}  &  \texttt{currfile} &  Example Result \\
+%     \texttt{fink}  &  \texttt{currfile} &  Example Result        \\
 %   \midrule
 %      \cs{finkdir}  &  \cs{currfiledir}  & \ttfamily\currfiledir  \\
 %      \cs{finkbase} &  \cs{currfilebase} & \ttfamily\currfilebase \\
@@ -170,19 +178,21 @@
 \RequirePackage{kvoptions}
 \SetupKeyvalOptions{family=currfile,prefix=currfile@}
 
-\@ifl@aded{\@pkgextension}{fink}{%
+\@ifpackageloaded{fink}{%
     \DeclareStringOption[\fnk@mainext]{mainext}%
     \DeclareStringOption[\fnk@maindir]{maindir}%
     \DeclareBoolOption[true]{fink}%
-    \PackageWarning{currfile}{Package 'fink' detected. %
-      The 'fink' option will default to 'true'. %
+    \PackageWarning{currfile}{Deprecated package 'fink' detected. %
+      The 'fink' option will default to 'true'.^^J%
       If set to 'false' no 'fink' macros will be changed but they will stop
-      working correctly!}{}{}{}%
+      working correctly!}%
 }{%
     \DeclareStringOption[tex]{mainext}%
     \DeclareStringOption[\@currdir]{maindir}%
     \DeclareBoolOption[false]{fink}%
 }%
+\DeclareVoidOption{force}{\PassOptionsToPackage{force}{filehook}}
+\RequirePackage{filehook}[2011/01/03]
 \ProcessKeyvalOptions*\relax
 
 \begingroup
@@ -198,25 +208,16 @@
 %
 % \subsection{File Hooks}
 % The \pkg{filehook} package is used to execute the macros at the correct places.
+% However it must be loaded before the option processed because the |fink| compatibility
+% code in |filehook-fink| will modify the option list.
 % The internal interface, not the user-interface, is used to make sure that the file names are valid for all other hooks.
 %
 %    \begin{macrocode}
-\RequirePackage{filehook}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\filehook@prefixwarg\filehook@include@atbegin{%
-  \currfile@push
-  \currfile@set{#1}%
-}
-\filehook@appendwarg\filehook@include@after{%
-  \currfile@pop
-}
-\filehook@prefixwarg\filehook@atbegin{%
+\filehook@prefixwarg\filehook@every@atbegin{%
   \currfile@push
   \currfile@set{#1}%
 }
-\filehook@appendwarg\filehook@atend{%
+\filehook@appendwarg\filehook@every@atend{%
   \currfile@pop
 }
 %    \end{macrocode}
@@ -225,7 +226,7 @@
 % \subsection{Set Current Values}
 %
 % \begin{macro}{\currfile@set}
-% Sets the file information which are parsed by \LaTeX's |\filename@parse|.
+% Sets the file information which are parsed by \LaTeX's \Macro\filename@parse.
 %    \begin{macrocode}
 \def\currfile@set#1{%
   \begingroup
@@ -267,7 +268,7 @@
 \def\currfile@pop{%
 %<debug> \message{^^JDEBUG: \dindent\empty Leaving file '\currfilename' ^^J }%
   \ifx\currfile@stack\empty
-    \PackageWarning{currfile}{File stack underflow!}{}{}%
+    \PackageWarning{currfile}{File stack underflow!}%
     \global\let\currfile@stack\currfile@stackinit
   \fi
   \expandafter\currfile@pop@\currfile@stack\relax
@@ -299,7 +300,7 @@
 %
 % \begin{macro}{\currfile@stack}
 % \begin{macro}{\currfile@stackinit}
-% Place |\jobname| values on stack and use this as init value.
+% Place \Macro\jobname values on stack and use this as init value.
 %    \begin{macrocode}
 \def\currfile@stack{}
 \currfile@set{\currfile@maindir\jobname.\currfile@mainext}
@@ -312,12 +313,12 @@
 %
 % \subsection{Fink Macros}
 %
-% The |fink| option defines all |fink| package macros to use the ones provided
-% by this package. If the |fink| package was loaded beforehand the restoration
+% The \pkg{fink} option defines all \pkg{fink} package macros to use the ones provided
+% by this package. If the \pkg{fink} package was loaded beforehand the restoration
 % of these macros must be avoided at the end of this file
-% (|fink|s |\InputIfFileExists| was then used to load this package).
+% (\pkg{fink}s \Macro\InputIfFileExists was then used to load this package).
 % If the package was not loaded its version is set to a dummy value and its
-% options to this package options. If |fink| is attempted to be loaded later
+% options to this package options. If \pkg{fink} is attempted to be loaded later
 % it will trigger an package option clash if different option are used.
 % Otherwise it will be taken as already loaded and not loaded ``again''.
 %
@@ -328,19 +329,19 @@
     \def\finkpath{\currfilepath}%
     \def\finkbase{\currfilebase}%
     \def\finkext{\currfileext}%
-    \@ifl@aded{\@pkgextension}{fink}{%
+    \@ifpackageloaded{fink}{%
         \def\fink@restore#1{}%
     }{%
-        \@namedef{ver@fink.sty}{2010/12/06}%
+        \@namedef{ver@fink.sty}{2011/01/03}%
         \expandafter\edef\csname opt@fink.sty\endcsname{%
             maindir=\currfile@maindir,mainext=\currfile@mainext
         }%
     }%
 \else
-    \@ifl@aded{\@pkgextension}{fink}{}{%
-        \AtBeginOfFile{fink.sty}{%
-            \PackageError{currfile}{Package class with deprecated 'fink'. %
-             Load 'currfile' with the 'fink' option or see the upgrade guide in the manual}{}{}{}%
+    \@ifpackageloaded{fink}{}{%
+        \AtBeginOfPackageFile{fink}{%
+            \PackageError{currfile}{The 'fink' package is now deprecated. %
+             Load 'currfile' with the 'fink' option or see the upgrade guide in the manual}{}%
         }%
     }%
 \fi
-- 
cgit v1.2.3

