diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/fink/fink.sty | 105 |
1 files changed, 59 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/fink/fink.sty b/Master/texmf-dist/tex/latex/fink/fink.sty index fc68b5da015..b628b16d57d 100644 --- a/Master/texmf-dist/tex/latex/fink/fink.sty +++ b/Master/texmf-dist/tex/latex/fink/fink.sty @@ -8,7 +8,7 @@ %% -%% Copyright (C) 1999-2002 Didier Verna +%% Copyright (C) 1999, 2000, 2001, 2002, 2007 Didier Verna %% This file is part of FiNK. @@ -38,65 +38,78 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} - -\ProvidesPackage{fink}[2002/04/03 v1.2 +\ProvidesPackage{fink}[2007/06/11 2.0 Keep track of the current filename] -\newcommand\finkfile{} -\def\fink@extension#1{\xdef\finkfile{\jobname#1}} -\newcommand\finkextension[1]{ - \fink@extension{#1} - \PackageInfo{FiNK}{main filename switched to `\finkfile'} - \renewcommand\finkextension[1]{ - \PackageError{FiNK}{\protect\finkextension\space can only be used once}{% - You seem to have called \protect\finkextension\space twice.\MessageBreak - Type X to quit, remove spurious call(s) and rerun LaTeX.}}} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{family=fnk,prefix=fnk@} + +\DeclareStringOption[\@currdir]{maindir} +\DeclareStringOption[tex]{mainext} + +\newcommand*\@fink@mainext[1]{\setkeys{fnk}{mainext={#1}}} +\newcommand*\fink@mainext{% + \expandafter\@fink@mainext\expandafter{\CurrentOption}} +\DeclareVoidOption{tex}{\fink@mainext} +\DeclareVoidOption{ltx}{\fink@mainext} + +\newcommand*\finkextension[1]{% + \PackageError{FiNK}{% + \protect\finkextension\space shouldn't be used anymore.\MessageBreak + Please use the `mainext' package option instead.}{% + No big deal right ?\MessageBreak + Type X to quit and modify your source.}} \@onlypreamble\finkextension -\DeclareOption{tex}{\fink@extension{.tex}} -\DeclareOption{ltx}{\fink@extension{.ltx}} -\AtEndOfPackage{\PackageInfo{FiNK}{main filename is `\finkfile'}} +\ProcessKeyvalOptions* + +\newcommand*\finkdir{\fnk@maindir} +\newcommand*\finkbase{\jobname} +\newcommand*\finkext{\fnk@mainext} -\ExecuteOptions{tex} -\ProcessOptions* +\newcommand*\finkfile{} +\newcommand*\fink@file[2]{#1\ifx\\#2\\\else.#2\fi} +\xdef\finkfile{\fink@file{\jobname}{\fnk@mainext}} -\def\fink@setnewfile#1{% +\newcommand*\finkpath{} +\xdef\finkpath{\finkdir\finkfile} + +\PackageInfo{FiNK}{main file set to "\finkpath"} + +\newcommand*\fink@prepare[1]{% {\filename@parse{#1}% - \xdef\@finkfile{% - \filename@base.\ifx\filename@ext\relax tex\else\filename@ext\fi}}} + \xdef\fink@nextdir{% + \ifx\filename@area\@empty% + \fnk@maindir% + \else% + \fnk@maindir\filename@area% + \fi}% + \xdef\fink@nextbase{\filename@base}% + \xdef\fink@nextext{\ifx\filename@ext\relax tex\else\filename@ext\fi}% + \xdef\fink@nextfile{\fink@file{\fink@nextbase}{\fink@nextext}}% + \xdef\fink@nextpath{\fink@nextdir\fink@nextfile}}} -\def\fink@input{% - \xdef\finkfile{\@finkfile}% +\newcommand*\fink@input{% + \xdef\finkdir{\fink@nextdir}% + \xdef\finkbase{\fink@nextbase}% + \xdef\finkext{\fink@nextext}% + \xdef\finkfile{\fink@nextfile}% + \xdef\finkpath{\fink@nextpath}% \@@input\@filef@und} -\def\fink@restore{\xdef\finkfile} - -\long\def\IfFileExists#1#2#3{% - \openin\@inputcheck#1 % - \ifeof\@inputcheck - \ifx\input@path\@undefined - \def\reserved@a{#3}% - \else - \def\reserved@a{\@iffileonpath{#1}{#2}{#3}}% - \fi - \else - \closein\@inputcheck - \edef\@filef@und{#1 }% - \fink@setnewfile{#1}% - \def\reserved@a{#2}% - \fi - \reserved@a} +\newcommand*\fink@restore[1]{% + {\filename@parse{#1}% + \xdef\finkdir{\filename@area}% + \xdef\finkbase{\filename@base}% + \xdef\finkext{\filename@ext}% + \xdef\finkfile{\fink@file{\finkbase}{\finkext}} + \xdef\finkpath{\finkdir\finkfile}}} \long\def\InputIfFileExists#1#2{% \IfFileExists{#1}{% #2\@addtofilelist{#1}% + \fink@prepare{#1}% \expandafter\fink@input% - \expandafter\fink@restore\expandafter{\finkfile}}} -\def\@input#1{% - \IfFileExists{#1}{% - \expandafter\fink@input% - \expandafter\fink@restore\expandafter{\finkfile}}{% - %% else - \GenericWarning{}{no file #1.}}} + \expandafter\fink@restore\expandafter{\finkpath}}} \endinput %% |