%% %% This is file `dates.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% dates.dtx (with options: `style') %% %% This file is part of the Dates package. %% Copyright (C) 1996 Frank Bennett, Jr. %% All rights reserved. %% ------------------------------------------ %% This is a generated file. %% %% IMPORTANT NOTICE: %% %% You are not allowed to change this file. You may however copy %% this file to a file with a different name and then change the %% copy if (a) you do not charge for the modified code, (b) you %% acknowledge the author(s) in the new file, if it %% is distributed to others, and (c) you attach these same %% conditions to the new file. %% %% You are not allowed to distribute this file alone. You are not %% allowed to take money for the distribution or use of this file %% (or a changed version) except for a nominal charge for copying %% etc. %% %% You are allowed to distribute this file under the condition that %% it is distributed with all of its contents, intact. %% %% For error reports, or offers to help make this a more powerful, %% friendlier, and better package, please contact me on %% `fb' at soas.ac.uk %% \NeedsTeXFormat{LaTeX2e}[1995/06/01] \ProvidesPackage{dates} [1996/12/27 v1.1 Dates parsing support (Frank Bennett)] \RequirePackage{overword} \long\gdef\dateread#1{% \csname dates@reset@longtext\endcsname% \let\dates@read\dates@read@default% \gdef\dates@action{#1}% \def\dates@subranges{}% \dates@subrange@start=0% \dates@subrange@end=0% \dates@read} \long\gdef\dates@read@default{% \dates@time@start=0% \dates@time@end=0% \setyear{1900}% \dates@month=0% \dates@day=0% \dates@weekd@target=7% \def\theshorttext{}% \def\thelongtext{}% \dates@suppressfalse% \let\dates@@@read=\dates@@@read@default% \let\dates@@@@read=\dates@@@@read@default% \let\dates@read@exit=\dates@read@exit@default% \bgroup% \dates@capsdown% \dates@@read} \long\def\dates@@read#1#{% \egroup% \dates@@@read #1 \enditall} \def\dates@@@read@default{% \@ifoverword\enditall% {\expandafter\dates@analyze\@overword{}% \@gobble@enditalls}% {\expandafter\dates@analyze\@overword{}% \dates@@@read}% {\expandafter\dates@analyze\@overword{}% \ifnum\dates@year>0% If date exists, process \let\dates@read\relax% ... and expire \dates@read@exit% May be a range, so not default \fi% \expandafter\end\@gobbletwo}}% \def\@gobble@enditalls#1{% \@ifnextnparchar\enditall% {\let\next\@gobble@enditalls% \next}% {\dates@@@@read}% {\message{This can't happen}}} \bgroup \catcode`\[=1 \global\let\dates@funny@brace=[ \gdef\dates@@@@read@default#1{% \def\theshorttext{#1}% \bgroup% \catcode`\[=1\catcode`\]=2\relax% \bgroup% \dates@capsdown% \@ifnextnparchar\dates@funny@brace% {\egroup% \dates@@@@@read}% {\egroup% \egroup% \dates@read@exit}% {\egroup% \egroup% \dates@read@exit}} \egroup \def\dates@@@@@read#1{% \egroup% \iflongtext% \def\thelongtext{#1}% \fi% \dates@read@exit} \def\dates@read@exit@default{% \dates@fix% \caldate% \dates@lastdate\dates@date% \ifdates@suppress@global% \else% \ifdates@suppress% \else% \dates@action% \fi% \fi% \dates@read} \def\dates@read@exit@range{% \dates@fix% \caldate% \dates@subrange@end\dates@date% \dates@reg=\expandafter{\dates@subranges}% \edef\dates@subranges{% \the\dates@reg% \noexpand\delim{\the\dates@subrange@start}% {\the\dates@date}}% \let\dates@read@exit\dates@read@exit@default% \dates@read@exit} \def\dates@read@exit@recurse{% \expandafter\ifcat\expandafter$\dates@subranges$% \PackageError{dates}{No range given}% {You need to specify a range before % recursive entries and formulae}% \fi% \let\delim\dates@read@exit@@recurse% \dates@subranges% \dates@read} \def\dates@read@exit@@recurse#1#2{% \dates@subrange@start#1\relax% \dates@subrange@end#2\relax% \global\dates@date=\dates@subrange@start\relax% \caldate% \dates@init% \caldate% \ifdates@suppress@global% \else% \ifdates@suppress% \else% \dates@action% \fi% \fi% \let\next\dates@read@exit@@@recurse% \dates@read@exit@@@recurse} \def\dates@read@exit@@@recurse{% \dates@increment\relax% \ifnum\dates@date<\dates@subrange@end\relax% \caldate% \ifdates@suppress@global% \else% \ifdates@suppress% \else% \dates@action% \fi% \fi% \else% \let\next\relax% \fi% \next} \def\dates@init@weekly{% \mod7\dates@date\dates@weekd% \dates@three=\dates@weekd@target\relax% \advance\dates@three by -\dates@weekd\relax% \ifnum\dates@three<0\relax% \advance\dates@three by7% \fi% \global\advance\dates@date by \dates@three\relax} \def\dates@increment@weekly{% \global\advance\dates@date by7\relax} \def\dates@init@monthly{% \let\dates@init@monthly@recurse\relax% \nextday\dates@weekd@target% \caldate% \dates@one\dates@day% \divide\dates@one by 7\relax% \multiply\dates@one by 7\relax% \ifnum\dates@modulo>\dates@one\relax% \dates@two\dates@modulo% \advance\dates@two by -\dates@one% \global\advance\dates@date by \dates@two% \else% \ifnum\dates@modulo<\dates@one\relax% \dates@next@month% \let\dates@init@monthly@recurse\dates@init@monthly% \fi% \fi% \dates@init@monthly@recurse} \def\dates@increment@monthly{% \dates@next@month% \dates@init@monthly} \long\def\dates@@@@read@function#1#2{% \def\dates@init{#1}% \def\dates@increment{#2}% \@ifnextnparchar\enditall% {\bgroup% \makeatletter% \expandafter\dates@@@@read@@function\@gobble}% {\PackageError% {dates}% {Extra text after function names}% {The third argument must be in curly braces.}}% {\relax}} \long\def\dates@@@@read@@function#1{% \long\gdef\dates@temp{#1}% \egroup% \dates@temp% \let\dates@temp\relax% \dates@@@@read@default} \long\def\dates@analyze#1#2#{% \ifcat\noexpand#11% \def\dates@zero{0}% \expandafter\dates@check@hyphen\@overword-{}% \ifx\dates@arg@b\dates@zero% \expandafter\dates@check@colon\@overword:{}% \ifx\dates@arg@b\dates@zero% \expandafter\ifnum\@overword>31% \setyear{\dates@arg@a}% \else% \ifnum\dates@day>0% \dates@dayerror% \else% \global\dates@day=\dates@arg@a% \fi% \fi% \else% \expandafter\dates@strip@colon\dates@arg@b% \global\dates@time@start=\dates@arg@a% \multiply\dates@time@start by 60% \advance\dates@time@start by \dates@arg@b% \global\dates@time@end=\dates@time@start% \fi% \else% \expandafter\dates@strip@hyphen\dates@arg@b% \let\dates@temp\dates@arg@b% \expandafter\dates@check@colon\dates@arg@a:{}% \ifx\dates@arg@b\dates@zero% \else% \expandafter\dates@strip@colon\dates@arg@b% \fi% \dates@time@start=\dates@arg@a\relax% \multiply\dates@time@start by 60\relax% \global\advance\dates@time@start by \dates@arg@b\relax% \expandafter\dates@check@colon\dates@temp:{}% \ifx\dates@arg@b\dates@zero% \else% \expandafter\dates@strip@colon\dates@arg@b% \fi% \dates@time@end=\dates@arg@a\relax% \multiply\dates@time@end by 60\relax% \global\advance\dates@time@end by \dates@arg@b% \fi% \else% \dates@execute#1#2XXX{}% \fi} \def\dates@execute#1#2#3#4#{% \ifcat#1\relax% \expandafter\csname% \string#1#2#3mac\endcsname% \else% \expandafter\csname#1#2#3mac\endcsname% \fi}% \def\evemac{% \global\let\dates@read@exit=\dates@read@exit@recurse% \global\let\dates@increment=\dates@increment@weekly% \global\let\dates@init=\dates@init@weekly} \def\othmac{% \global\let\dates@increment=\dates@increment@semiweekly} \def\firmac{% \dates@modulo=0% \global\let\dates@init=\dates@init@monthly% \global\let\dates@increment=\dates@increment@monthly}% \def\secmac{% \dates@modulo=7% \global\let\dates@init=\dates@init@monthly% \global\let\dates@increment=\dates@increment@monthly}% \def\thimac{% \dates@modulo=14% \global\let\dates@init=\dates@init@monthly% \global\let\dates@increment=\dates@increment@monthly}% \expandafter\let\csname1stmac\endcsname=\firmac% \expandafter\let\csname2ndmac\endcsname=\secmac% \expandafter\let\csname3rdmac\endcsname=\thimac% \def\toXmac{\relax% \ifnum\dates@year=0% \dates@subrange@start\dates@lastdate% \else% \dates@fix% \dates@subrange@start\dates@date% \dates@month=0% \dates@day=0% \setyear{1900}% \fi% \let\dates@read@exit\dates@read@exit@range}% % \end{macrocode} \def\funmac{% \global\let\dates@read@exit=\dates@read@exit@recurse% \global\let\dates@@@read=\dates@@@@read@function} \def\remmac{% \global\dates@suppresstrue} \bgroup \def\monthdata#1#2#3#4#5\end{% \expandafter\gdef\csname#2#3#4mac\endcsname{% \ifnum\dates@month>0% \dates@montherror% \else% \global\dates@month=#1% \fi}% \ifcat$#5$\let\next\@gobble\else\let\next\monthdata\fi% \next#5\end}% \monthdata1jan2feb3mar4apr5may6jun% 7jul8aug9sep{10}oct{11}nov{12}dec\end \egroup \bgroup \def\weekdata#1#2#3#4#5\end{% \expandafter\gdef\csname #2#3#4mac\endcsname{% \ifnum\dates@weekd@target<7\relax% \dates@weekerror% \else% \global\dates@weekd@target=#1\relax% \fi}% \ifcat$#5$\let\next\@gobble\else\let\next\weekdata\fi% \next#5\end} \weekdata0sun1mon2tue3wed4thu5fri6sat\end \egroup \def\dates@montherror{% \PackageError{dates}{Month multiply defined}{% You have set the month more than once here.}} \def\dates@dayerror{% \PackageError{dates}{Day multiply defined}{% You have set the day more than once here.}} \def\dates@weekerror{% \PackageError{dates}{Week multiply defined}{% You have set the day of the week more than once here.}} \bgroup \newtoks\dates@reg \dates@reg={} \def\dates@capsdown{} \def\dates@capsup{} \def\dates@capsactive#1{% \ifx#1\end% \let\next\relax% \else% \catcode`#1=13% \let\next\dates@@capsactive% \fi% \next} \def\dates@@capsactive#1#2{% \dates@reg=\expandafter{% \dates@capsdown\catcode`#1=13\gdef#1{#2}}% \xdef\dates@capsdown{\the\dates@reg}% \dates@reg=\expandafter{% \dates@capsup\edef#1{\string#1}}% \xdef\dates@capsup{\the\dates@reg}% \let\next\dates@capsactive% \next} \dates@capsactive% AAaBBbCCcDDdEEeFFfGGgHHhIIiJJjKKk% LLlMMmNNnOOoPPpQQqRRrSSsTTtUUuVVv% WWwXXxYYyZZz\end \egroup \def\dates@check@colon#1:#2#{% \def\dates@arg@a{#1}% \def\dates@arg@b{0#2}} \def\dates@strip@colon#1:{% \def\dates@arg@b{#1}} \def\dates@check@hyphen#1-#2#{% \def\dates@arg@a{#1}% \def\dates@arg@b{0#2}} \def\dates@strip@hyphen#1-{% \def\dates@arg@b{#1}} \expandafter\expandafter\expandafter\def% \expandafter\csname% \string\relaxXXmac\endcsname{% \let\dates@@@@read\relax} \def\theyear{\the\dates@year@full} \def\themonth{\the\dates@monthname} \def\theshortmonth{\the\dates@monthname} \def\themonthnumber{\the\dates@month} \def\theday{\the\dates@day} \def\theweekday{\the\dates@dayname} \def\theshortweekday{\the\dates@shortweekday} \def\thelongdate{\the\dates@date} \def\themonthdays{\the\dates@days} \def\setyear#1{\dates@year=#1% \advance\dates@year by -1900\calculateyearbase} \def\nextyear{\advance\dates@year by1% \calculateyearbase} \def\dates@next@month{% \ifnum\dates@month=12% \advance\dates@year by 1\calculateyearbase% \dates@month=1% \dates@day=1% \else% \advance\dates@month by 1% \dates@day=1% \fi% \dates@fix\caldate} \def\settimezone#1{\dates@timezone=#1% \multiply\dates@timezone by 1000% \divide\dates@timezone by24} \def\calculateyearbase{% \dates@yearbase=-1% {\count0=\dates@year\divide\count0 by4% \multiply\count0 by4\relax% \ifnum\dates@year=\count0% \global\dates@catch=0% \else% \global\dates@catch=1% \fi}% \ifcase\dates@catch \leapyeartrue\or% \leapyearfalse\fi% {\count0=\dates@year\multiply\count0% by1461\advance\count0 by3% \divide\count0 by4% \global\dates@catch=\count0}% \global\advance\dates@yearbase by\dates@catch\relax% \ifnum\dates@year=0\global\dates@yearbase=0\leapyearfalse\fi} \def\monthdays{% \global\dates@catch\ifcase\dates@month% 0\or31\or% 59\or90\or120\or151\or181\or212\or% 243\or273\or304\or334\or365\fi% {\ifleapyear\ifnum\dates@month>1% \global\advance\dates@catch by1\fi\fi}% \dates@day=\dates@catch} \def\dates@fix{% \ifnum\dates@month=0% \ifdates@requiremonth% \PackageError{dates}{Missing month}{% You need to specify a date for the month in this date entry.}% \else% \dates@month=1% \fi% \fi% \ifnum\dates@day=0% \ifdates@requireday% \PackageError{dates}{Missing day of the month}{% You need to specify a day of the month in this date entry.}% \else% \dates@day=1% \fi% \fi% \dates@monthname@get% \ifnum\dates@days<\dates@day% \PackageError{dates}{Day of month out of range}{% There are only \the\dates@days\space days in % \themonth, but you have tried^^J% to specify \the\dates@day.}% \else% \dates@date=\dates@day{\advance\dates@month by-1% \monthdays% \advance\dates@date by\dates@day% \global\advance\dates@date by\dates@yearbase}% \fi} \def\mod#1#2#3{\dates@three=#2\relax% \dates@four=\dates@three% \divide\dates@three by #1% \multiply\dates@three by #1% \advance\dates@four by -\dates@three% #3=\dates@four} \def\dates@year@get{% \dates@year@full\dates@year% \global\advance\dates@year@full by 1900\relax} \def\dates@dayname@get{% \mod7\dates@date\dates@weekd% \ifcase\dates@weekd% \global\dates@dayname{Sunday}% \global\dates@shortweekday{Sun}% \or \global\dates@dayname{Monday}% \global\dates@shortweekday{Mon}% \or \global\dates@dayname{Tuesday}% \global\dates@shortweekday{Tue}% \or \global\dates@dayname{Wednesday}% \global\dates@shortweekday{Wed}% \or \global\dates@dayname{Thursday}% \global\dates@shortweekday{Thu}% \or \global\dates@dayname{Friday}% \global\dates@shortweekday{Fri}% \or \global\dates@dayname{Saturday}% \global\dates@shortweekday{Sat}% \fi} \def\caldate{\dates@year=\dates@date% \multiply\dates@year by4\divide\dates@year by1461% \calculateyearbase% {\advance\dates@date by-\dates@yearbase\dates@month=0% \loop\monthdays\ifnum\dates@day<\dates@date% \global\advance\dates@month by1\repeat% {\advance\dates@month by-1\monthdays% \advance\dates@date by-\dates@day% \global\dates@day=\dates@date}}% \dates@year@get% \dates@monthname@get% \dates@dayname@get} \def\dates@monthname@get{% \ifcase\dates@month% \or \global\dates@monthname{January}% \global\dates@shortmonthname{Jan}% \global\dates@days=31\relax% \or \global\dates@monthname{February}% \global\dates@shortmonthname{Feb}% \ifleapyear% \global\dates@days=29\relax% \else% \global\dates@days=28\relax% \fi% \or \global\dates@monthname{March}% \global\dates@shortmonthname{Mar}% \global\dates@days=31\relax% \or \global\dates@monthname{April}% \global\dates@shortmonthname{Apr}% \global\dates@days=30\relax% \or \global\dates@monthname{May}% \global\dates@shortmonthname{May}% \global\dates@days=31\relax% \or \global\dates@monthname{June}% \global\dates@shortmonthname{Jun}% \global\dates@days=30\relax% \or \global\dates@monthname{July}% \global\dates@shortmonthname{Jul}% \global\dates@days=31\relax% \or \global\dates@monthname{August}% \global\dates@shortmonthname{Aug}% \global\dates@days=31\relax% \or \global\dates@monthname{September}% \global\dates@shortmonthname{Sep}% \global\dates@days=30\relax% \or \global\dates@monthname{October}% \global\dates@shortmonthname{Oct}% \global\dates@days=31\relax% \or \global\dates@monthname{November}% \global\dates@shortmonthname{Nov}% \global\dates@days=30\relax% \or \global\dates@monthname{December}% \global\dates@shortmonthname{Dec}% \global\dates@days=31\relax% \fi} \def\nextday#1{{\count0=#1\mod7\dates@date\dates@weekd% \advance\count0 by-\dates@weekd\relax% \ifnum\count0<0\advance\count0 by7\fi% \global\advance\dates@date by\count0}} \def\prevday#1{\snextday#1% \global\advance\dates@date by-7} \def\snextday#1{\global\advance\dates@date by1% \nextday#1} \def\sprevday#1{\global\advance\dates@date by-1% \prevday#1} \def\jdttol{\advance\dates@date by500% \advance\dates@date by\dates@timezone\divide\dates@date by1000} \def\sintable#1{\ifcase #1 0\or100\or199% \or296\or389\or479\or565\or644\or717% \or783\or841\or891\or932\or964\or985% \or997\or1000\or992\or974\or946\or909% \or863\or808\or746\or675\or598\or516% \or427\or335\or239\or141\or42\or-58% \or-158\fi} \def\twopimod{\count2 =\count1% \divide\count2 by6284 \count3 =1853% \count4 =6283\multiply\count3 by\count2% \multiply\count4 by\count2% \divide\count3 by10000% \advance\count3 by\count4% \advance\count1 by-\count3}% \def\sin{\relax% \ifnum\count1<0 \signtrue% \count1=-\count1\else \signfalse\fi% \loop\ifnum\count1>6284\twopimod\repeat\relax% \ifnum\count1>3142% \advance\count1 by-3142% \ifsign\signfalse\else\signtrue\fi\fi% \multiply\count1 by10\count3=\count1% \divide\count3 by1000\count2=\count3% \multiply\count3 by1000% \advance\count3 by-\count1 % \count5 =\sintable{\count2 }% \count4 =\count5\advance\count2 by1% \advance\count4 by -\sintable{\count2}% \multiply\count4 by\count3% \divide\count4 by1000% \advance\count4 by\count5% \ifsign\count4 =-\count4\fi}% \def\cos{\advance\count1 by-1571% \multiply\count1 by-1\sin}% \def\lin#1.#2.#3+#4.{\count1=#3% \count2=#2\count3=#1% \multiply\count1 by\count0% \multiply\count2 by\count0\relax% \multiply\count3 by\count0% \divide\count1 by1000% \advance\count1 by\count2% \divide\count1 by1000% \advance\count1 by\count3% \advance\count1 by #4\relax} \def\fac#1{\multiply\count4 by #1% \advance\count6 by\count4} \def\id{\count4=\count1} % Identity \def\dates@initialize@longtext{% \ifuselongtext% \def\dates@reset@longtext{% \longtexttrue}% \else% \def\dates@reset@longtext{% \longtextfalse}% \fi} \newcount\dates@year \newcount\dates@timezone \dates@timezone=0 \newcount\dates@catch \newcount\dates@day \newcount\dates@month \newcount\dates@date \newcount\dates@one \newcount\dates@two \newcount\dates@three \newcount\dates@four \newcount\dates@weekd \newcount\dates@time@start \newcount\dates@time@end \newcount\dates@subrange@start \newcount\dates@subrange@end \newcount\dates@days \newcount\dates@lastdate \newcount\dates@yearbase \newcount\dates@weekd@target \newcount\dates@modulo \newcount\dates@year@full \newcount\dates@extra@day \newtoks\dates@reg \newtoks\dates@dayname \newtoks\dates@shortweekday \newtoks\dates@monthname \newtoks\dates@shortmonthname \newif\iflongtext \longtexttrue \newif\ifdates@requiremonth \newif\ifdates@requireday \newif\ifdates@suppress \newif\ifdates@suppress@global \newif\ifleapyear \let\delim\relax \def\enditall{END IT ALL} \def\dates@empty{} \endinput %% %% End of file `dates.sty'.