diff options
author | Karl Berry <karl@freefriends.org> | 2011-03-23 22:59:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-03-23 22:59:55 +0000 |
commit | 83266032c26012f162e65d1177e5d3f77eee458e (patch) | |
tree | 2cdd8e9b26d56930bee05afadc62c902f54762af /Master/texmf-dist/tex/latex/filemod | |
parent | 5b837f1b12aa8f8ef27aa5c080af28e446f97263 (diff) |
new latex package filemod (23mar11)
git-svn-id: svn://tug.org/texlive/trunk@21813 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/filemod')
-rw-r--r-- | Master/texmf-dist/tex/latex/filemod/filemod-expmin.sty | 55 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/filemod/filemod.sty | 334 |
2 files changed, 389 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/filemod/filemod-expmin.sty b/Master/texmf-dist/tex/latex/filemod/filemod-expmin.sty new file mode 100644 index 00000000000..beae7a20b60 --- /dev/null +++ b/Master/texmf-dist/tex/latex/filemod/filemod-expmin.sty @@ -0,0 +1,55 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% --------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files filemod.dtx and filemod.ins +%% and the derived filebase filemod.sty. +\ProvidesPackage{filemod-expmin}[% + 2011/03/23 v1.0 + Get and compare file modification times (expandable; minimal)] +\begingroup +\@makeother\D +\@makeother\Z +\@makeother: +\gdef\filemodNumdate#1{% + \expandafter\filemod@Numdate\pdffilemoddate{#1}D:00000000000000Z\relax +} +\gdef\filemod@Numdate D:#1#2#3#4#5#6#7#8#9\relax{% + #1#2#3#4#5#6#7#8% +} +\gdef\filemodNumtime#1{% + \expandafter\filemod@Numtime\pdffilemoddate{#1}D:00000000000000Z\relax +} +\gdef\filemod@Numtime D:#1#2#3#4#5#6#7#8#9\relax{% + \filemod@@Numtime#9\relax +} +\gdef\filemod@@Numtime#1#2#3#4#5#6#7\relax{% + #1#2#3#4#5#6% +} +\endgroup +\newcommand*\filemodCmp[2]{% + \ifcase0% + \ifnum\filemodNumdate{#2}>\filemodNumdate{#1} 1\else + \ifnum\filemodNumdate{#2}=\filemodNumdate{#1} % + \ifnum\filemodNumtime{#2}>\filemodNumtime{#1} 1\fi + \fi + \fi + \space + \expandafter\@firstoftwo + \or + \expandafter\@secondoftwo + \fi +} +\endinput +%% +%% End of file `filemod-expmin.sty'. diff --git a/Master/texmf-dist/tex/latex/filemod/filemod.sty b/Master/texmf-dist/tex/latex/filemod/filemod.sty new file mode 100644 index 00000000000..cb90336c925 --- /dev/null +++ b/Master/texmf-dist/tex/latex/filemod/filemod.sty @@ -0,0 +1,334 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% --------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files filemod.dtx and filemod.ins +%% and the derived filebase filemod.sty. +\ProvidesPackage{filemod}[% + 2011/03/23 v1.0 + Get and compare file modification times] +\newcommand*\filemodparse[2]{% + \expandafter\filemod@parse\pdffilemoddate{#2}\relax{#1}% +} +\def\filemod@parse#1\relax#2{% + \ifx\relax#1\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\filemodnotexists{#2}}% + {\filemod@parse@#1\empty{#2}\relax}% +} +\begingroup +\@makeother\D +\@makeother\Z +\@makeother: +\gdef\filemod@parse@ D:#1#2#3#4#5#6#7#8#9\relax{% + \filemod@parse@@{{#1#2#3#4}{#5#6}{#7#8}}#9\relax +} +\gdef\filemodnotexists#1{% + #1{0000}{00}{00}{00}{00}{00}{Z}% +} +\endgroup +\def\filemod@parse@@#1#2#3#4#5#6#7#8\empty#9\relax{% + #9#1{#2#3}{#4#5}{#6#7}{#8}% +} +\RequirePackage{filemod-expmin} +\newcommand*\filemodnumdate{\filemodparse\filemod@numdate} +\def\filemod@numdate#1#2#3#4#5#6#7{#1#2#3} +\newcommand*\filemodnumtime{\filemodparse\filemod@numtime} +\def\filemod@numtime#1#2#3#4#5#6#7{#4#5#6} +\def\filemod@opt#1#2#3{% + \expandafter + \remove@to@nnil@exec + \ifx[#3\@nnil\remove@to@nnil + \expandafter#1% + \else\@nnil\empty + \expandafter#2% + \expandafter\filemodoptdefault + \fi + {#3}% +} +\def\remove@to@nnil@exec#1\@nnil#2{% + \ifx\@nnil#1\@nnil\else + \expandafter#2 + \fi +} +\newcommand*\filemodcmp{% + \filemod@opt\filemod@cmp@opt\filemod@cmp +} +\newcommand*\filemodoptdefault{1} +\def\filemod@cmp@opt#1#2]{% + \filemod@cmp{#2}% +} +\def\filemod@cmp{\filemod@@cmp>} +\def\filemod@@cmp#1#2#3#4{% + \ifcase0% + \ifnum\filemodnumdate{#4}#1\filemodnumdate{#3} 1\else + \ifnum\filemodnumdate{#4}=\filemodnumdate{#3} % + \ifnum\filemodnumtime{#4}#1\filemodnumtime{#3} 1\else + \ifnum\filemodnumtime{#4}=\filemodnumtime{#3} 2\fi + \fi + \fi + \fi + \space + \csname @firstoft\ifnum#2>2 hree\else wo\fi\expandafter\endcsname + \or + \csname @secondoft\ifnum#2>2 hree\else wo\fi\expandafter\endcsname + \else + \csname @% + \ifcase#2% + gobbletwo% + \or + firstoftwo% + \or + secondoftwo% + \else + thirdofthree% + \fi + \expandafter + \endcsname + \fi +} +\long\def\@firstofthree#1#2#3{#1} +\long\def\@secondofthree#1#2#3{#2} +\newcommand*\filemodnewest{% + \filemod@opt\filemod@newest@opt\filemod@newest +} +\def\filemod@newest@opt#1#2]{% + \filemod@newest{#2}% +} +\def\filemod@newest#1#2#3{% + \filemod@@cmp>{#1}{#2}{#3}{#2}{#3}% +} +\newcommand*\filemodoldest{% + \filemod@opt\filemod@oldest@opt\filemod@oldest +} +\def\filemod@oldest@opt#1#2]{% + \filemod@oldest{#2}% +} +\def\filemod@oldest#1#2#3{% + \filemod@@cmp<{#1}{#2}{#3}{#2}{#3}% +} +\newcommand*\filemodNewest{} +\def\filemodNewest#1#{% + \expandafter\expandafter + \expandafter\@filemodNewest + \csname + @% + \ifx\@nnil#1\@nnil + first% + \else + second% + \fi + oftwo% + \endcsname + {[\filemodoptdefault]}% + {#1}% +} +\newcommand*\filemodOldest{} +\def\filemodOldest#1#{% + \expandafter\expandafter + \expandafter\@filemodOldest + \csname + @% + \ifx\@nnil#1\@nnil + first% + \else + second% + \fi + oftwo% + \endcsname + {[\filemodoptdefault]}% + {#1}% +} +\def\@filemodNewest[#1]#2{% + \@@filemodNewest{#1}#2\filemod@end +} +\def\@filemodOldest[#1]#2{% + \@@filemodOldest{#1}#2\filemod@end +} +\def\@@filemodNewest#1#2{% + \filemod@Newest{#2}{#1}% +} +\def\@@filemodOldest#1#2{% + \filemod@Oldest{#2}{#1}% +} +\def\filemod@Newest#1#2#3{% + \iffilemod@end{#3}% + {#1}% + {% + \expandafter\expandafter + \expandafter\expandafter + \expandafter\expandafter + \expandafter\filemod@Newest + \expandafter\expandafter + \expandafter\expandafter + \expandafter\expandafter + \expandafter{% + \expandafter\expandafter + \expandafter\@gobble + \expandafter\string\csname\filemod@@cmp>{#2}{#1}{#3}{#1}{#3}\endcsname}{#2}}% +} +\def\filemod@Oldest#1#2#3{% + \iffilemod@end{#3}% + {#1}% + {% + \expandafter\expandafter + \expandafter\expandafter + \expandafter\expandafter + \expandafter\filemod@Oldest + \expandafter\expandafter + \expandafter\expandafter + \expandafter\expandafter + \expandafter{% + \expandafter\expandafter + \expandafter\@gobble + \expandafter\string\csname\filemod@@cmp<{#2}{#1}{#3}{#1}{#3}\endcsname}{#2}}% +} +\def\iffilemod@end#1{% + \ifx\filemod@end#1% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +\def\filemod@end{\@gobble{filemod@end}} +\newcommand*\Filemodgetnum{\filemodparse\Filemod@getnum} +\def\Filemod@getnum#1#2#3#4#5#6#7{% + \def\filemoddate{#1#2#3}% + \def\filemodtime{#4#5#6}% + \def\filemodtz{#7}% +} +\newcommand\Filemodcmp[1][1]{% + \def\filemod@next{\filemodcmpresult}% + \Filemod@cmp{#1}% +} +\newcommand\FilemodCmp[1][1]{% + \let\filemod@next\empty + \Filemod@cmp{#1}% +} +\def\Filemod@cmp#1#2#3{% + \Filemodgetnum{#2}% + \let\filemoddatea\filemoddate + \let\filemodtimea\filemodtime + \Filemodgetnum{#3}% + \ifcase0% + \ifnum\filemoddate>\filemoddatea\space1\else + \ifnum\filemoddate=\filemoddatea\space + \ifnum\filemodtime>\filemodtimea\space1\else + \ifnum\filemodtime=\filemodtimea\space2\fi + \fi + \fi + \fi + \relax + \def\filemodresultfile{#1}% + \ifnum#1>2\relax + \def\filemodcmpresult##1##2##3{##1}% + \else + \let\filemodcmpresult\@firstoftwo + \fi + \or + \def\filemodresultfile{#2}% + \ifnum#1>2\relax + \def\filemodcmpresult##1##2##3{##2}% + \else + \let\filemodcmpresult\@secondoftwo + \fi + \else + \ifcase#1\relax + \let\filemodresultfile\empty + \let\filemodcmpresult\@gobbletwo + \or + \def\filemodresultfile{#1}% + \let\filemodcmpresult\@firstoftwo + \or + \def\filemodresultfile{#2}% + \let\filemodcmpresult\@secondoftwo + \else + \let\filemodresultfile\empty + \let\filemodcmpresult\@thirdofthree + \fi + \fi + \filemod@next +} +\newcommand*\Filemodnewest[3][\filemodoptdefault]{\FilemodNewest[{#1}]{{#2}{#3}}} +\newcommand*\Filemodoldest[3][\filemodoptdefault]{\FilemodOldest[{#1}]{{#2}{#3}}} +\newcommand*\FilemodNewest[2][\filemodoptdefault]{% + \def\filemode@tie{#1}% + \def\filemod@gl{>}% + \Filemod@est#2\filemod@end +} +\newcommand*\FilemodOldest[2][\filemodoptdefault]{% + \def\filemode@tie{#1}% + \def\filemod@gl{<}% + \Filemod@est#2\filemod@end +} +\def\Filemod@est#1{% + \def\filemodresultfile{#1}% + \Filemodgetnum{#1}% + \let\filemodresultdate\filemoddate + \let\filemodresulttime\filemodtime + \Filemod@@est +} +\def\Filemod@@est#1{% + \iffilemod@end{#1}{}{% + \Filemodgetnum{#1}% + \ifcase0% + \ifnum\filemoddate\filemod@gl\filemodresultdate\space1\else + \ifnum\filemoddate=\filemodresultdate\space + \ifnum\filemodtime\filemod@gl\filemodresulttime\space1\else + \ifnum\filemodtime=\filemodresulttime\space + \ifnum\filemode@tie=1\else 1\fi + \fi + \fi + \fi + \fi + \else + \def\filemodresultfile{#1}% + \let\filemodresultdate\filemoddate + \let\filemodresulttime\filemodtime + \fi + \Filemod@@est + }% +} +\def\filemod@gl{>} +\newcommand*\filemodprint{\filemodparse\thefilemod} +\newcommand*\filemodprintdate{\filemodparse\the@filemoddate} +\newcommand*\filemodprinttime{\filemodparse\the@filemodtime} +\newcommand*\thefilemod[7]{% + \thefilemoddate{#1}{#2}{#3}% + \filemodsep + \thefilemodtime{#4}{#5}{#6}{#7}% +} +\let\filemodsep\space +\newcommand*\thefilemoddate[3]{% + #1/#2/#3% +} +\newcommand*\thefilemodtime[4]{% + #1:#2:#3~#4% +} +\def\the@filemoddate#1#2#3#4#5#6#7{% + \thefilemoddate{#1}{#2}{#3}% +} +\def\the@filemodtime#1#2#3{% + \thefilemodtime +} +\begingroup +\@makeother\D +\expandafter\gdef\csname filemodZ\endcsname{Z}% +\let\filemodz=Z\relax +\endgroup +\endinput +%% +%% End of file `filemod.sty'. |