%%
%% This is file `texdepends.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% texdepends.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from texdepends.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file texdepends.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% File: texdepends.dtx Copyright (C) 2004--2011 V. Danjean
%%    Vincent.Danjean@ens-lyon.org
%% Modified by Matthieu Gallet
%%    Matthieu.Gallet@ens-lyon.org
%%
%% This program is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License
%% as published by the Free Software Foundation; either version 2
%% of the License, or (at your option) any later version.
%%
%% This program 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.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
%%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{texdepends}%
[2021/10/26 v2.4.3 No changes in texdepends.dtx]
\RequirePackage{ifthen}
\newboolean{TD@debug}
\newcommand{\TD@option@debug}[1][true]{%
  %\PackageWarningNoLine{texdepends}{Setting debug to #1}
  \setboolean{TD@debug}{#1}%
}%
\def\TD@option@extension[#1]{%
  %\PackageWarningNoLine{texdepends}{Using extention #1}
  \def\TD@extention{#1}%
}%
\def\TD@option@split#1=#2=#3\relax{%
  \def\TD@option@name{#1}%
  \ifx\TD@option@name\@empty\else
    \expandafter\let\expandafter\TD@option@cmd
      \csname TD@option@\TD@option@name\endcsname
    %\PackageWarningNoLine{texdepends}{1: '#1', 2: '#2', 3: '#3'}
    \ifx\TD@option@cmd\relax
      \@unknownoptionerror%
    \else
      \ifx\@empty#3\@empty
         \TD@option@cmd\relax%
      \else
        \def\TD@option@value{#2}%
        \TD@option@cmd[\TD@option@value]%
      \fi
    \fi
  \fi
}%
\DeclareOption*{%
  %\PackageWarningNoLine{texdepends}{Option \CurrentOption}%
  \expandafter\TD@option@split\CurrentOption==\relax%
}%
\ProcessOptions
\ifthenelse{\isundefined{\TD@extention}}{%
  \PackageWarningNoLine{texdepends}{No extension given: detecting it}%
  \RequirePackage{ifxetex,ifpdf}%
  \ifxetex%
    \PackageWarningNoLine{textdepends}{Detected XeTeX: using .pdf}%
    \def\TD@extention{.pdf}%
  \else\ifpdf%
    \PackageWarningNoLine{texdepends}{Detected PDF mode: using .pdf}%
    \def\TD@extention{.pdf}%
  \else%
    \PackageWarningNoLine{texdepends}{Detected DVI mode. Using .dvi}%
    \def\TD@extention{.dvi}%
  \fi\fi%
}{}%
\RequirePackage{xstring}%
\newcommand{\TD@warning}[1]{%
  \PackageWarningNoLine{texdepends}{#1}%
}%
\newcommand{\TD@warningLine}[1]{%
  \PackageWarning{texdepends}{#1}%
}%
\newcommand{\TD@info}[1]{%
  \ifthenelse{\boolean{TD@debug}}{%
    \PackageWarningNoLine{texdepends}{#1}%
  }{%
    \PackageInfo{texdepends}{#1}%
  }%
}%
\newcommand{\TD@debug}[1]{%
  \ifthenelse{\boolean{TD@debug}}{%
    \PackageWarningNoLine{texdepends}{#1}%
  }{%
  }%
}%
\newwrite\TD@write
\TD@info{Writing info in '\jobname\TD@extention.mk'}
\immediate\openout\TD@write\jobname\TD@extention.mk%
\def\TD@print#1{%
  {%
    % TODO: fix pb when #1 contains '#'
    %\noexpandarg%
    \StrSubstitute{#1}{//}{/}[\TD@write@text]%
    \immediate\write\TD@write{\TD@write@text}%
    %\immediate\write\TD@write{#1}%
  }
}%
\def\TD@printClass#1{%
  \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1.cls}%
}%
\def\TD@printPackage#1{%
  \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1.sty}%
}%
\def\TD@printInput#1{%
  \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1}%
}%
\def\TD@printNoDependsFile#1{%
  \TD@print{TD_\jobname\TD@extention _DEPENDS_EXCLUDE\space += #1}%
}%
\def\TD@printFig#1{%
  \TD@print{TD_\jobname\TD@extention _FIGURES\space += #1}%
}%
\def\TD@printSubfig#1{%
  \TD@print{TD_\jobname\TD@extention _SUBFIGS\space += #1}%
}%
\def\TD@printRequiredFile#1#2{%
  \TD@print{TD_\jobname\TD@extention _REQUIRED\space += #1}%
}%
\def\RequireFile#1{%
  \TD@printRequiredFile{#1}{User}%
}%
\def\TD@printOut#1{%
  \TD@print{TD_\jobname\TD@extention _OUTPUTS\space += #1}%
}%
\def\TD@printGraphicspath#1{%
  \TD@print{TD_\jobname\TD@extention _GRAPHICSPATH\space := #1}%
}%
\def\TD@printBibfile#1{%
  \TD@print{TD_\jobname\TD@extention _BIBFILES\space += #1.bib}%
}%
\def\TD@printBibstyle#1{%
  \TD@print{TD_\jobname\TD@extention _BIBSTYLES\space += #1.bst}%
}%
\def\TD@printBblfile#1{%
  \TD@print{TD_\jobname\TD@extention _BBLFILES\space += #1.bbl}%
}%
\def\TD@printRebuildRule#1{%
  \TD@print{TD_\jobname\TD@extention _REBUILD_RULES\space += #1}%
}%
\def\TD@printIndex#1{%
  \TD@print{TD_\jobname\TD@extention _INDEXES\space += INDEX}%
  \TD@print{TD_\jobname\TD@extention _INDEXES_INDEX\space += #1}%
}%
\def\TD@printIndexSource#1#2{%
  \TD@print{TD_\jobname\TD@extention _INDEX_#1_SRC\space = #2}%
}%
\def\TD@printIndexTarget#1#2{%
  \TD@print{TD_\jobname\TD@extention _INDEX_#1_TARGET\space = #2}%
}%
\def\TD@printIndexStyle#1#2{%
  \TD@print{TD_\jobname\TD@extention _INDEX_#1_STYLE\space = #2}%
}%
\def\TD@printGlossary#1{%
  \TD@print{TD_\jobname\TD@extention _INDEXES += GLOSS}%
  \TD@print{TD_\jobname\TD@extention _INDEXES_GLOSS\space += #1}%
}%
\def\TD@printGlossarySource#1#2{%
  \TD@print{TD_\jobname\TD@extention _GLOSS_#1_SRC\space = #2}%
}%
\def\TD@printGlossaryTarget#1#2{%
  \TD@print{TD_\jobname\TD@extention _GLOSS_#1_TARGET\space = #2}%
}%
\def\TD@printGlossaryStyle#1#2{%
  \TD@print{TD_\jobname\TD@extention _GLOSS_#1_STYLE\space = #2}%
}%
\def\TD@switch#1{%
  \expandafter\let\expandafter\TD@local@old\csname#1\endcsname%
  \expandafter\let\expandafter\TD@local@new\csname TD@#1\endcsname%
  \ifx\TD@local@old\TD@local@new
    \PackageWarning{texdepends}{#1 already redefined. Skipping it.}%
  \else
    \ifx\TD@local@old\relax
      \TD@warning{Diverting empty macro '#1' \MessageBreak%
        Probably a bug in texdepends.sty}%
    \else
      \TD@info{Diverting macro '#1'}%
    \fi
    \expandafter\let\csname TD@orig@#1\endcsname\TD@local@old%
    \expandafter\let\csname#1\endcsname\TD@local@new%
  \fi
}%
\def\TD@docswitchlist{}%
\def\TD@docswitch#1{%
  \TD@info{Registering macro '#1' for diversion}%
  \ifx\TD@docswitchlist\@empty%
    \xdef\TD@docswitchlist{#1}%
  \else%
    \xdef\TD@docswitchlist{\TD@docswitchlist,#1}%
  \fi%
}%
\AtBeginDocument{%
  \TD@info{Diverting registered macros...}%
  \@for\TD@cmd:=\TD@docswitchlist\do{%
    \TD@switch{\TD@cmd}%
  }%
  \TD@info{Divertions done}%
}%
\def\TD@PackagePreDivert#1{%
  \expandafter\def\csname TD@PackageStart@#1\endcsname ##1##2##3##4%
}%
\def\TD@PackagePostDivert#1{%
  \expandafter\def\csname TD@PackageEnd@#1\endcsname ##1##2##3##4%
}%
\ifx\documentclass\@twoclasseserror
  \PackageError{texdepends}{texdepends needs to be loaded BEFORE
	\string\documentclass \MessageBreak
	Use \string\RequirePackage\space instead of \string\usepackage
	\MessageBreak as the later is not allowed before
	\string\documentclass}
\fi
\TD@printPackage{texdepends}
\TD@printGraphicspath{{.}}
\def\TD@depends{}%
\def\TD@dependsWarning{%
  \PackageWarningNoLine{texdepends}{Figure(s) missing. Check
    dependencies again}%
}%
\def\TD@missingDepends{%
  \global\let\TD@depends\TD@dependsWarning%
}%
\AtEndDocument{%
  \TD@depends%
}%
\def\TD@@fileswith@pti@ns#1[#2]#3[#4]{%
  \ifx#1\@clsextension
    \TD@printClass{#3}
  \fi
  \TD@orig@@fileswith@pti@ns{#1}[#2]{#3}[#4]%
}%
\let\TD@@@fileswith@pti@ns\TD@@fileswith@pti@ns
\TD@switch{@fileswith@pti@ns}%
\TD@switch{@@fileswith@pti@ns}%
\def\TD@@onefilewithoptions#1[#2][#3]#4{%
  \TD@printPackage{#1}%
  \ifthenelse{\equal{#1}{texdepends}}{%
    \TD@debug{Package '#1' detected}
    \@for\TD@package@option:=#2\do{%
      \ifthenelse{\expandafter\isundefined\csname TD@option@\TD@package@option\endcsname}{
        \TD@warningLine{Ignoring unknown option '\TD@package@option'}
      }{
        \ifthenelse{%
          \equal{\TD@package@option}{debug}%
          %\OR\equal{\TD@package@option}{debug}%
        }{
          \csname TD@option@\TD@package@option\endcsname%
        }{
          \TD@warningLine{Ignoring option '\TD@package@option'
            \MessageBreak #1 already loaded
          }
        }
      }
    }
  }{%
    \expandafter\let\expandafter\TD@divert
    \csname TD@PackageStart@#1\endcsname
    \ifx\TD@divert\relax
      \TD@debug{No preamble for package #1}
    \else
      \TD@info{Preamble for package #1}
      \TD@divert{#1}{#2}{#3}{#4}%
    \fi
    \TD@orig@@onefilewithoptions{#1}[#2][#3]{#4}%
    \expandafter\let\expandafter\TD@divert
    \csname TD@PackageEnd@#1\endcsname
    \ifx\TD@divert\relax
      \TD@debug{No postamble for package #1}
    \else
      \TD@info{Postamble for package #1}
      \TD@divert{#1}{#2}{#3}{#4}%
    \fi
  }%
}%
\TD@switch{@onefilewithoptions}%
\def\TD@@iinput#1{%
  \TD@printInput{#1}%
  \TD@orig@@iinput{#1}}%
\def\TD@@input@#1{%
  \IfFileExists{#1}{%
    \TD@printInput{#1}%
  }{}%
  \TD@orig@@input@{#1}}%
\TD@switch{@iinput}%
\TD@switch{@input@}%
\def\TD@verbatiminput#1{%
  \TD@printInput{#1}%
  \TD@orig@verbatiminput{#1}}%
\TD@PackagePostDivert{verbatim}{%
  \TD@switch{verbatiminput}}%
\let\TD@orig@openout\openout
\def\TD@openout#1{%
  \@ifnextchar={\TD@openout@eq#1}{\TD@openout@noeq#1}}
\def\TD@openout@eq#1=#2.#3{%
  \TD@printOut{#2.#3}%
  \TD@orig@openout#1=#2.#3%
}%
\def\TD@openout@noeq#1#2.#3{%
  \TD@printOut{#2.#3}%
  \TD@orig@openout#1#2.#3%
}%
 %\TD@switch{openout}
\def\TD@bibli@bbl{%
    \TD@printBblfile{\jobname}%
    \global\let\TD@bibli@bbl\relax%
}%
\def\TD@bibli@files#1{%
  \TD@bibli@bbl%
  \@for\TD@bibfile:=#1\do{%
    \TD@printBibfile{\TD@bibfile}%
  }%
}
\def\TD@bibli@style#1{%
  \TD@bibli@bbl%
  %\@for\TD@bibstyle:=#1\do{%
  %  \TD@printBibstyle{\TD@bibstyle}%
  %}
  \TD@printBibstyle{#1}%
}
\def\TD@bibliography#1{%
  \TD@bibli@files{#1}%
  \TD@orig@bibliography{#1}%
}%
\def\TD@bibliographystyle#1{%
  \TD@bibli@style{#1}%
  \TD@orig@bibliographystyle{#1}%
}%
\TD@docswitch{bibliography}%
\TD@switch{bibliographystyle}%
\def\TD@makeindex{%
  \TD@printIndex{\jobname}%
  \TD@printIndexSource{\jobname}{\jobname.idx}%
  \TD@orig@makeindex%
}%
\def\TD@makeglossary{%
  \TD@printGlossary{\jobname}%
  \TD@printGlossarySource{\jobname}{\jobname.glo}%
  \TD@orig@makeglossary%
}%
\TD@switch{makeindex}%
\TD@switch{makeglossary}%
\def\TD@Gin@getbase#1{%
  \TD@orig@Gin@getbase{#1}%
  \ifx\Gin@ext\relax%
  \else%
  \TD@printFig{\Gin@base\Gin@ext}%
  \fi%
}%
\def\TD@Ginclude@eps#1{%
  \IfFileExists{#1}{%
    \TD@orig@Ginclude@eps{#1}%
  }{%
    \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak
      Skipping it this time (the last one however)\MessageBreak}%
    \TD@missingDepends%
    \TD@printRequiredFile{#1}{eps}%
  }%
}%
\def\TD@Ginclude@pdf#1{%
  \IfFileExists{#1}{%
    \TD@orig@Ginclude@pdf{#1}%
  }{%
    \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak
      Skipping it this time (the last one however)\MessageBreak}%
    \TD@missingDepends%
    \TD@printRequiredFile{#1}{pdf}%
  }%
}%
\def\TD@graphicspath#1{%
  \TD@printGraphicspath{#1}%
  \TD@orig@graphicspath{#1}%
}%
\def\TD@Gread@eps#1{%
  \IfFileExists{#1}{%
    %\PackageWarning{texdepends}{Gread File '#1' exists}%
    \TD@orig@Gread@eps{#1}%
  }{%
    \PackageWarning{texdepends}{No '#1' file \MessageBreak
      using 1 for graphic dimensions}%
    \setbox\@tempboxa\hbox{\relax}%
    \def\Gin@llx{1}\let\Gin@lly\Gin@llx
    \Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
    \Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
  }%
}%
\def\TD@Gread@pdf#1{%
  \IfFileExists{#1}{%
    %\PackageWarning{texdepends}{Gread File '#1' exists}%
    \TD@orig@Gread@pdf{#1}%
  }{%
    \PackageWarning{texdepends}{No '#1' file \MessageBreak
      using 1 for graphic dimensions}%
    \setbox\@tempboxa\hbox{\relax}%
    \def\Gin@llx{1}\let\Gin@lly\Gin@llx
    \Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
    \Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
  }%
}%
\TD@PackagePostDivert{graphics}{%
  \TD@switch{graphicspath}%
  \TD@docswitch{Gin@getbase}%
  \TD@docswitch{Ginclude@eps}%
  \TD@docswitch{Ginclude@pdf}%
  \TD@docswitch{Gread@eps}%
  \TD@docswitch{Gread@pdf}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\TD@FL@includerawtexgraphics[#1]#2{%
  \IfFileExists{#2}{%
    \TD@orig@FL@includerawtexgraphics[#1]{#2}%
  }{%
    \PackageWarning{texdepends}{Figure '#2' needed\MessageBreak
      Skipping it this time (the last one however)\MessageBreak}%
    \TD@missingDepends%
    \TD@printRequiredFile{#2}{rawtexgraphics}%
  }%
}%

\def\TD@Ginclude@rawtex#1{%
  \IfFileExists{#1}{%
    \TD@orig@Ginclude@rawtex{#1}%
  }{%
    \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak
      Skipping it this time (the last one however)\MessageBreak}%
    \TD@missingDepends%
    \TD@printRequiredFile{#1}{rawtex}%
  }%
}%

\def\TD@Ginclude@figtex#1{%
  \IfFileExists{#1}{%
    %\PackageWarning{texdepends}{Ginclude File '#1' exists}%
    \TD@orig@Ginclude@figtex{#1}%
  }{%
    \ifthenelse{\isundefined{\FL@subfig@mainfigname}}{%
      \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak
        Skipping it this time (the last one however)\MessageBreak}%
    }{%
      \PackageWarning{texdepends}{SubFigure '#1' from
        \FL@subfig@mainfigname needed\MessageBreak
        Skipping it this time (the last one however)\MessageBreak}%
    }
    \TD@missingDepends%
    \TD@printRequiredFile{#1}{figtex}%
  }%
}%
\def\TD@Ginclude@svgtex#1{%
  \IfFileExists{#1}{%
    %\PackageWarning{texdepends}{Ginclude File '#1' exists}%
    \TD@orig@Ginclude@svgtex{#1}%
  }{%
    \ifthenelse{\isundefined{\FL@subfig@mainfigname}}{%
      \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak
        Skipping it this time (the last one however)\MessageBreak}%
    }{%
      \PackageWarning{texdepends}{SubFigure '#1' from
        \FL@subfig@mainfigname needed\MessageBreak
        Skipping it this time (the last one however)\MessageBreak}%
    }
    \TD@missingDepends%
    \TD@printRequiredFile{#1}{svgtex}%
  }%
}%

\def\TD@Gread@figtex#1{%
  \IfFileExists{#1}{%
    %\PackageWarning{texdepends}{Gread File '#1' exists}%
    \TD@orig@Gread@figtex{#1}%
  }{%
    \PackageWarning{texdepends}{No '#1' file \MessageBreak
      using 1 for graphic dimensions}%
    \setbox\@tempboxa\hbox{\relax}%
    \def\Gin@llx{1}\let\Gin@lly\Gin@llx
    \Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
    \Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
  }%
}%

\def\TD@Gread@svgtex#1{%
  \IfFileExists{#1}{%
    %\PackageWarning{texdepends}{Gread File '#1' exists}%
    \TD@orig@Gread@svgtex{#1}%
  }{%
    \PackageWarning{texdepends}{No '#1' file \MessageBreak
      using 1 for graphic dimensions}%
    \setbox\@tempboxa\hbox{\relax}%
    \def\Gin@llx{1}\let\Gin@lly\Gin@llx
    \Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
    \Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
  }%
}%
\def\TD@FL@subfig@check#1{%
  \TD@printRequiredFile{#1}{subfigcheck}%
  \TD@printSubfig{#1}%
}%
\TD@PackagePostDivert{figlatex}{%
  \TD@docswitch{FL@includerawtexgraphics}%
  \TD@docswitch{Ginclude@rawtex}%
  \TD@docswitch{Ginclude@figtex}%
  \TD@docswitch{Ginclude@svgtex}%
  \TD@docswitch{Gread@figtex}%
  \TD@docswitch{Gread@svgtex}%
  \TD@docswitch{FL@subfig@check}%
}%
\def\TD@PrintIndex{%
  \TD@printIndexStyle{\jobname}{gind.ist}
  \TD@printIndexTarget{\jobname}{\jobname.ind}
  \TD@orig@PrintIndex%
}%
\def\TD@PrintChanges{%
  \TD@printGlossaryStyle{\jobname}{gglo.ist}
  \TD@printGlossaryTarget{\jobname}{\jobname.gls}
  \TD@orig@PrintChanges%
}%
\TD@PackagePostDivert{doc}{%
  \TD@docswitch{PrintIndex}%
  \TD@docswitch{PrintChanges}%
}%
\def\TD@def@index#1#2#3#4{%
  \TD@printIndex{#2}%
  \TD@printIndexSource{#2}{\jobname.#3}%
  \TD@printIndexTarget{#2}{\jobname.#4}
  \TD@orig@def@index{#1}{#2}{#3}{#4}%
}%
\TD@PackagePostDivert{index}{%
  \TD@switch{def@index}%
}%
\def\TD@printindex{%
  \TD@printIndexTarget{\jobname}{\jobname.ind}
  \TD@orig@printindex%
}%
\TD@PackagePostDivert{makeidx}{%
  \TD@docswitch{printindex}%
}%
\def\TD@printglossary{%
  \TD@printGlossaryTarget{\jobname}{\jobname.gls}
  \TD@orig@printglossary%
}%
\TD@PackagePostDivert{nomencl}{%
  \TD@docswitch{printglossary}%
  \TD@switch{makeglossary}%
  \TD@printGlossaryStyle{\jobname}{nomencl.ist}
}%
\def\TD@btSect{%
  \@ifnextchar[{\TD@btSect@opt}{\TD@btSect@noopt}}
\def\TD@btSect@opt[#1]#2{%
  \TD@bibli@files{#2}%
  \TD@bibli@style{#1}%
  \TD@orig@btSect[#1]{#2}}
\def\TD@btSect@noopt#1{%
  \TD@bibli@files{#1}%
  \TD@orig@btSect{#1}}

\def\TD@@bt@write@auxfile{%
  \TD@printBblfile{\thebtauxfile}%
  \TD@orig@@bt@write@auxfile%
}%
\TD@PackagePostDivert{bibtopic}{%
  \global\let\TD@bibli@bbl\relax%
  \global\let\TD@biblio@rules@package\TD@biblio@rules@package@bibtopic%
  \TD@switch{@bt@write@auxfile}%
  \TD@printOut{btbbl.aux}%
  \TD@printRebuildRule{bibtopic}%
  \TD@docswitch{btSect}%
}%
\TD@PackagePostDivert{comment}{%
  \TD@printNoDependsFile{comment.cut}%
}%
\endinput
%%
%% End of file `texdepends.sty'.
