| 1 |
%% |
| 2 |
%% Copyright (C) 2011 by Martin Scharrer <[email protected]> |
| 3 |
%% ---------------------------------------------------------- |
| 4 |
%% This work may be distributed and/or modified under the |
| 5 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 6 |
%% of this license or (at your option) any later version. |
| 7 |
%% The latest version of this license is in |
| 8 |
%% http://www.latex-project.org/lppl.txt |
| 9 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 10 |
%% version 2005/12/01 or later. |
| 11 |
%% |
| 12 |
%% This work has the LPPL maintenance status `maintained'. |
| 13 |
%% |
| 14 |
%% The Current Maintainer of this work is Martin Scharrer. |
| 15 |
%% |
| 16 |
%% This work consists of the files filemod.dtx and filemod.ins |
| 17 |
%% and the derived files filemod.sty, filemod-expmin.sty, |
| 18 |
%% filemod.tex and filemod-expmin.tex. |
| 19 |
%% |
| 20 |
\input filemod-expmin |
| 21 |
\expandafter\edef\csname filemod@cat\endcsname{\noexpand\catcode`\noexpand\@=\the\catcode`\@\relax} |
| 22 |
\catcode`\@=11 |
| 23 |
\iffilemod@direct |
| 24 |
\def\filemodparse#1#2{% |
| 25 |
\expandafter\filemod@parse\pdffilemoddate{#2}\relax{#1}% |
| 26 |
} |
| 27 |
\else |
| 28 |
\def\filemodparse#1#2{% |
| 29 |
\expandafter\expandafter |
| 30 |
\expandafter\filemod@parse\pdf@filemoddate{#2}\relax{#1}% |
| 31 |
} |
| 32 |
\fi |
| 33 |
\def\filemod@parse#1\relax#2{% |
| 34 |
\ifx\relax#1\relax |
| 35 |
\expandafter\@firstoftwo |
| 36 |
\else |
| 37 |
\expandafter\@secondoftwo |
| 38 |
\fi |
| 39 |
{\filemodnotexists{#2}}% |
| 40 |
{\filemod@parse@#1\empty{#2}\relax}% |
| 41 |
} |
| 42 |
\begingroup |
| 43 |
\catcode`\D=12 |
| 44 |
\catcode`\Z=12 |
| 45 |
\catcode`\:=12 |
| 46 |
\gdef\filemod@parse@ D:#1#2#3#4#5#6#7#8#9\relax{% |
| 47 |
\filemod@parse@@{{#1#2#3#4}{#5#6}{#7#8}}#9\relax |
| 48 |
} |
| 49 |
\gdef\filemodnotexists#1{% |
| 50 |
#1{0000}{00}{00}{00}{00}{00}{Z}% |
| 51 |
} |
| 52 |
\endgroup |
| 53 |
\def\filemod@parse@@#1#2#3#4#5#6#7#8\empty#9\relax{% |
| 54 |
#9#1{#2#3}{#4#5}{#6#7}{#8}% |
| 55 |
} |
| 56 |
\def |
| 57 |
\filemodnumdate{\filemodparse\filemod@numdate} |
| 58 |
\def\filemod@numdate#1#2#3#4#5#6#7{#1#2#3} |
| 59 |
\def |
| 60 |
\filemodnumtime{\filemodparse\filemod@numtime} |
| 61 |
\def\filemod@numtime#1#2#3#4#5#6#7{#4#5#6} |
| 62 |
\def\filemod@opt#1#2#3{% |
| 63 |
\expandafter |
| 64 |
\remove@to@nnil@exec |
| 65 |
\ifx[#3\@nnil\remove@to@nnil |
| 66 |
\expandafter#1% |
| 67 |
\else\@nnil\empty |
| 68 |
\expandafter#2% |
| 69 |
\expandafter\filemodoptdefault |
| 70 |
\fi |
| 71 |
{#3}% |
| 72 |
} |
| 73 |
\def\remove@to@nnil@exec#1\@nnil#2{% |
| 74 |
\ifx\@nnil#1\@nnil\else |
| 75 |
\expandafter#2 |
| 76 |
\fi |
| 77 |
} |
| 78 |
\def |
| 79 |
\filemodcmp{% |
| 80 |
\filemod@opt\filemod@cmp@opt\filemod@cmp |
| 81 |
} |
| 82 |
\def |
| 83 |
\filemodoptdefault{1} |
| 84 |
\def\filemod@cmp@opt#1#2]{% |
| 85 |
\filemod@cmp{#2}% |
| 86 |
} |
| 87 |
\def\filemod@cmp{\filemod@@cmp>} |
| 88 |
\def\filemod@@cmp#1#2#3#4{% |
| 89 |
\ifcase0% |
| 90 |
\ifnum\filemodnumdate{#4}#1\filemodnumdate{#3} 1\else |
| 91 |
\ifnum\filemodnumdate{#4}=\filemodnumdate{#3} % |
| 92 |
\ifnum\filemodnumtime{#4}#1\filemodnumtime{#3} 1\else |
| 93 |
\ifnum\filemodnumtime{#4}=\filemodnumtime{#3} 2\fi |
| 94 |
\fi |
| 95 |
\fi |
| 96 |
\fi |
| 97 |
\space |
| 98 |
\csname @firstoft\ifnum#2>2 hree\else wo\fi\expandafter\endcsname |
| 99 |
\or |
| 100 |
\csname @secondoft\ifnum#2>2 hree\else wo\fi\expandafter\endcsname |
| 101 |
\else |
| 102 |
\csname @% |
| 103 |
\ifcase#2% |
| 104 |
gobbletwo% |
| 105 |
\or |
| 106 |
firstoftwo% |
| 107 |
\or |
| 108 |
secondoftwo% |
| 109 |
\else |
| 110 |
thirdofthree% |
| 111 |
\fi |
| 112 |
\expandafter |
| 113 |
\endcsname |
| 114 |
\fi |
| 115 |
} |
| 116 |
\long\def\@firstofthree#1#2#3{#1} |
| 117 |
\long\def\@secondofthree#1#2#3{#2} |
| 118 |
\long\def\@thirdofthree#1#2#3{#3} |
| 119 |
\long\def\@gobble#1{} |
| 120 |
\long\def\@gobbletwo#1#2{} |
| 121 |
\def\remove@to@nnil#1\@nnil{} |
| 122 |
\def |
| 123 |
\filemodnewest{% |
| 124 |
\filemod@opt\filemod@newest@opt\filemod@newest |
| 125 |
} |
| 126 |
\def\filemod@newest@opt#1#2]{% |
| 127 |
\filemod@newest{#2}% |
| 128 |
} |
| 129 |
\def\filemod@newest#1#2#3{% |
| 130 |
\filemod@@cmp>{#1}{#2}{#3}{#2}{#3}% |
| 131 |
} |
| 132 |
\def |
| 133 |
\filemodoldest{% |
| 134 |
\filemod@opt\filemod@oldest@opt\filemod@oldest |
| 135 |
} |
| 136 |
\def\filemod@oldest@opt#1#2]{% |
| 137 |
\filemod@oldest{#2}% |
| 138 |
} |
| 139 |
\def\filemod@oldest#1#2#3{% |
| 140 |
\filemod@@cmp<{#1}{#2}{#3}{#2}{#3}% |
| 141 |
} |
| 142 |
\def\filemodNewest#1#{% |
| 143 |
\expandafter\expandafter |
| 144 |
\expandafter\@filemodNewest |
| 145 |
\csname |
| 146 |
@% |
| 147 |
\ifx\@nnil#1\@nnil |
| 148 |
first% |
| 149 |
\else |
| 150 |
second% |
| 151 |
\fi |
| 152 |
oftwo% |
| 153 |
\endcsname |
| 154 |
{[\filemodoptdefault]}% |
| 155 |
{#1}% |
| 156 |
} |
| 157 |
\def\filemodOldest#1#{% |
| 158 |
\expandafter\expandafter |
| 159 |
\expandafter\@filemodOldest |
| 160 |
\csname |
| 161 |
@% |
| 162 |
\ifx\@nnil#1\@nnil |
| 163 |
first% |
| 164 |
\else |
| 165 |
second% |
| 166 |
\fi |
| 167 |
oftwo% |
| 168 |
\endcsname |
| 169 |
{[\filemodoptdefault]}% |
| 170 |
{#1}% |
| 171 |
} |
| 172 |
\def\@filemodNewest[#1]#2{% |
| 173 |
\@@filemodNewest{#1}#2\filemod@end |
| 174 |
} |
| 175 |
\def\@filemodOldest[#1]#2{% |
| 176 |
\@@filemodOldest{#1}#2\filemod@end |
| 177 |
} |
| 178 |
\def\@@filemodNewest#1#2{% |
| 179 |
\filemod@Newest{#2}{#1}% |
| 180 |
} |
| 181 |
\def\@@filemodOldest#1#2{% |
| 182 |
\filemod@Oldest{#2}{#1}% |
| 183 |
} |
| 184 |
\def\filemod@Newest#1#2#3{% |
| 185 |
\iffilemod@end{#3}% |
| 186 |
{#1}% |
| 187 |
{% |
| 188 |
\expandafter\expandafter |
| 189 |
\expandafter\expandafter |
| 190 |
\expandafter\expandafter |
| 191 |
\expandafter\filemod@Newest |
| 192 |
\expandafter\expandafter |
| 193 |
\expandafter\expandafter |
| 194 |
\expandafter\expandafter |
| 195 |
\expandafter{% |
| 196 |
\expandafter\expandafter |
| 197 |
\expandafter\@gobble |
| 198 |
\expandafter\string\csname\filemod@@cmp>{#2}{#1}{#3}{#1}{#3}\endcsname}{#2}}% |
| 199 |
} |
| 200 |
\def\filemod@Oldest#1#2#3{% |
| 201 |
\iffilemod@end{#3}% |
| 202 |
{#1}% |
| 203 |
{% |
| 204 |
\expandafter\expandafter |
| 205 |
\expandafter\expandafter |
| 206 |
\expandafter\expandafter |
| 207 |
\expandafter\filemod@Oldest |
| 208 |
\expandafter\expandafter |
| 209 |
\expandafter\expandafter |
| 210 |
\expandafter\expandafter |
| 211 |
\expandafter{% |
| 212 |
\expandafter\expandafter |
| 213 |
\expandafter\@gobble |
| 214 |
\expandafter\string\csname\filemod@@cmp<{#2}{#1}{#3}{#1}{#3}\endcsname}{#2}}% |
| 215 |
} |
| 216 |
\def\iffilemod@end#1{% |
| 217 |
\ifx\filemod@end#1% |
| 218 |
\expandafter\@firstoftwo |
| 219 |
\else |
| 220 |
\expandafter\@secondoftwo |
| 221 |
\fi |
| 222 |
} |
| 223 |
\def\filemod@end{\@gobble{filemod@end}} |
| 224 |
\def |
| 225 |
\Filemodgetnum{\filemodparse\Filemod@getnum} |
| 226 |
\def\Filemod@getnum#1#2#3#4#5#6#7{% |
| 227 |
\def\filemoddate{#1#2#3}% |
| 228 |
\def\filemodtime{#4#5#6}% |
| 229 |
\def\filemodtz{#7}% |
| 230 |
} |
| 231 |
\def\Filemod@cmp#1#2#3{% |
| 232 |
\Filemodgetnum{#2}% |
| 233 |
\let\filemoddatea\filemoddate |
| 234 |
\let\filemodtimea\filemodtime |
| 235 |
\Filemodgetnum{#3}% |
| 236 |
\ifcase0% |
| 237 |
\ifnum\filemoddate>\filemoddatea\space1\else |
| 238 |
\ifnum\filemoddate=\filemoddatea\space |
| 239 |
\ifnum\filemodtime>\filemodtimea\space1\else |
| 240 |
\ifnum\filemodtime=\filemodtimea\space2\fi |
| 241 |
\fi |
| 242 |
\fi |
| 243 |
\fi |
| 244 |
\relax |
| 245 |
\def\filemodresultfile{#1}% |
| 246 |
\ifnum#1>2\relax |
| 247 |
\def\filemodcmpresult##1##2##3{##1}% |
| 248 |
\else |
| 249 |
\let\filemodcmpresult\@firstoftwo |
| 250 |
\fi |
| 251 |
\or |
| 252 |
\def\filemodresultfile{#2}% |
| 253 |
\ifnum#1>2\relax |
| 254 |
\def\filemodcmpresult##1##2##3{##2}% |
| 255 |
\else |
| 256 |
\let\filemodcmpresult\@secondoftwo |
| 257 |
\fi |
| 258 |
\else |
| 259 |
\ifcase#1\relax |
| 260 |
\let\filemodresultfile\empty |
| 261 |
\let\filemodcmpresult\@gobbletwo |
| 262 |
\or |
| 263 |
\def\filemodresultfile{#1}% |
| 264 |
\let\filemodcmpresult\@firstoftwo |
| 265 |
\or |
| 266 |
\def\filemodresultfile{#2}% |
| 267 |
\let\filemodcmpresult\@secondoftwo |
| 268 |
\else |
| 269 |
\let\filemodresultfile\empty |
| 270 |
\let\filemodcmpresult\@thirdofthree |
| 271 |
\fi |
| 272 |
\fi |
| 273 |
\filemod@next |
| 274 |
} |
| 275 |
\def\filemod@chkopt#1{% |
| 276 |
\def\filemod@optcmd{#1}% |
| 277 |
\futurelet\filemod@tok\filemod@@chkopt |
| 278 |
} |
| 279 |
\def\filemod@@chkopt{% |
| 280 |
\ifx[\filemod@tok |
| 281 |
\expandafter\filemod@readopt |
| 282 |
\else |
| 283 |
\expandafter\filemod@optcmd |
| 284 |
\expandafter\filemodoptdefault |
| 285 |
\fi |
| 286 |
} |
| 287 |
\def\filemod@readopt[#1]{% |
| 288 |
\filemod@optcmd{#1}% |
| 289 |
} |
| 290 |
\def\Filemodnewest{\filemod@chkopt\Filemod@newest} |
| 291 |
\def\Filemod@newest#1#2#3{\Filemod@Newest{#1}{{#2}{#3}}} |
| 292 |
\def\Filemodoldest{\filemod@chkopt\Filemod@oldest} |
| 293 |
\def\Filemod@oldest#1#2#3{\Filemod@Oldest{#1}{{#2}{#3}}} |
| 294 |
\def\FilemodNewest{\filemod@chkopt\Filemod@Newest} |
| 295 |
\def\Filemod@Newest#1#2% |
| 296 |
{% |
| 297 |
\def\filemode@tie{#1}% |
| 298 |
\def\filemod@gl{>}% |
| 299 |
\Filemod@est#2\filemod@end |
| 300 |
} |
| 301 |
\def\FilemodOldest{\filemod@chkopt\Filemod@Oldest} |
| 302 |
\def\Filemod@Oldest#1#2% |
| 303 |
{% |
| 304 |
\def\filemode@tie{#1}% |
| 305 |
\def\filemod@gl{<}% |
| 306 |
\Filemod@est#2\filemod@end |
| 307 |
} |
| 308 |
\def\Filemod@est#1{% |
| 309 |
\def\filemodresultfile{#1}% |
| 310 |
\Filemodgetnum{#1}% |
| 311 |
\let\filemodresultdate\filemoddate |
| 312 |
\let\filemodresulttime\filemodtime |
| 313 |
\Filemod@@est |
| 314 |
} |
| 315 |
\def\Filemod@@est#1{% |
| 316 |
\iffilemod@end{#1}{}{% |
| 317 |
\Filemodgetnum{#1}% |
| 318 |
\ifcase0% |
| 319 |
\ifnum\filemoddate\filemod@gl\filemodresultdate\space1\else |
| 320 |
\ifnum\filemoddate=\filemodresultdate\space |
| 321 |
\ifnum\filemodtime\filemod@gl\filemodresulttime\space1\else |
| 322 |
\ifnum\filemodtime=\filemodresulttime\space |
| 323 |
\ifnum\filemode@tie=1\else 1\fi |
| 324 |
\fi |
| 325 |
\fi |
| 326 |
\fi |
| 327 |
\fi |
| 328 |
\else |
| 329 |
\def\filemodresultfile{#1}% |
| 330 |
\let\filemodresultdate\filemoddate |
| 331 |
\let\filemodresulttime\filemodtime |
| 332 |
\fi |
| 333 |
\Filemod@@est |
| 334 |
}% |
| 335 |
} |
| 336 |
\def\filemod@gl{>} |
| 337 |
\def\Filemodtoday#1% |
| 338 |
{{% |
| 339 |
\def\thefilemod##1##2##3##4##5##6##7{\year##1 \month##2 \day##3 \today}% |
| 340 |
\filemodprint{#1}% |
| 341 |
}} |
| 342 |
\def\FilemodToday#1% |
| 343 |
{{% |
| 344 |
\def\thefilemoddate##1##2##3{\year##1 \month##2 \day##3 \today}% |
| 345 |
\filemodprint{#1}% |
| 346 |
}} |
| 347 |
\def |
| 348 |
\filemodprint{\filemodparse\thefilemod} |
| 349 |
\def |
| 350 |
\filemodprintdate{\filemodparse\the@filemoddate} |
| 351 |
\def |
| 352 |
\filemodprinttime{\filemodparse\the@filemodtime} |
| 353 |
\def\thefilemod#1#2#3#4#5#6#7% |
| 354 |
{% |
| 355 |
\thefilemoddate{#1}{#2}{#3}% |
| 356 |
\filemodsep |
| 357 |
\thefilemodtime{#4}{#5}{#6}{#7}% |
| 358 |
} |
| 359 |
\let\filemodsep\space |
| 360 |
\def\thefilemoddate#1#2#3% |
| 361 |
{#1/#2/#3} |
| 362 |
\def\thefilemodtime#1#2#3#4% |
| 363 |
{% |
| 364 |
#1:#2:#3~#4% |
| 365 |
} |
| 366 |
\def\the@filemoddate#1#2#3#4#5#6#7{% |
| 367 |
\thefilemoddate{#1}{#2}{#3}% |
| 368 |
} |
| 369 |
\def\the@filemodtime#1#2#3{% |
| 370 |
\thefilemodtime |
| 371 |
} |
| 372 |
\begingroup |
| 373 |
\catcode`\D=12 |
| 374 |
\expandafter\gdef\csname filemodZ\endcsname{Z}% |
| 375 |
\let\filemodz=Z\relax |
| 376 |
\endgroup |
| 377 |
\filemod@cat |
| 378 |
\expandafter\let\csname filemod@cat\endcsname\relax |
| 379 |
\endinput |
| 380 |
%% |
| 381 |
%% End of file `filemod.tex'. |