; TeX output 1997.02.07:1009so-DtGGcmr17User's7tGuidetotheDatespacqkage!", cmsy10gXQ cmr12FVrankG.Bennett,Jr.2K cmsy8y,bFVebruary7,1997.!Kt : cmbx9Abstractэoo cmr9This1pac9k|rageprovidestwolow-levelmacrosfortheparsingoftextusing bL5Aacmr6A TuAEXc.25" cmmi9"u.XK`y cmr10Dates!čI Nff cmbx121aLIntros3ductionIThis[packqageprovidesamacro,!'ExXisalsoIprovided.`EThe handlingofparseddatesisalsowithinusercontrol;2Qitisde nedinIaUUsingleargumentfedto\datereadwhenitisinvokedinfrontofalistofdates.XThisApackqagewasdevelopGedasoneofthebuildingblocksofthecalendarIpackqage,{butDisreleasedasaseparatechunkofcoGdebecausethedateparsingtaskIisafunctiondiscretefromtheworkofbuildingacalendarfromconstituentbloGcksIofIinformation(whichisthemaintaskofthecalendarpackqagepropGer).mIfotherIapplicationsnarefoundforthispackqage,uthatisalltothegoGod.PutnmynameonIit,UUletmeknow,andwe'llhaveadrinktogethersometime.XThistuserguideisbrief,ibGecausetheparseris exibleenoughthatalongIcatalogue~ofstricturesisunnecessary*.BThenextsectiondescribGesthesyntaxforIentering-dates.MdItisfollowedbyabriefdescriptionofhowthemacrocanbGecalledIupGon\Iinanotherpackqage,^andnotesonextendingtheparsertoprovideenhancedIfunctionality*.qIUUhavealsoprovidedguidancenotesinthecoGdeitself.IX-ffr @ -:q% cmsy6L|{Ycmr8ThisX leisvÎersionnumbIfyouwanttocuttothechase,have Ia loGokattheexamplesandexperimentabitwiththedemo le.It'sallprettyIstraightforward.XTheparserisindi erenttoextraspacesandblanklinesindates.OItwillreadaIstringCIwordbyword,zandclassifyeachwordasatime,zadayofthemonth,zthenameIofamonth,ayearoraspGecialfunction.1Withtwoexceptions,stringsbGeginningIinanumbGermustnotmixnumbGersandothercharacters|thiswillproGduceaIlow-level{AerrorfromTU>'ExX,andatthemomentI{8can'tthinkofaneconomicalwayIofUUprotectingagainstthis.XAny=stringbGeginninginanumbGerisinterpretedaseitheratime,adayofIthemmonthorayear.Amstringcontainingacolon(the:character)isassumedtoIbGeatimeofday*.#AMܲandPMarenotrecognized;.Wyoushoulduse24-hourformatIwhen )spGecifyingtimes.BA numericstringcontainingahyphenisassumedtobGeIa)Krangeoftimes.Inthisinstance,^IacolonisnotnecessaryifthetimeisgivenIinowhole-hours. PurenumericstringsareconstruedasadayofthemonthiflessIthanUU32,orasayearifgreaterthan31.XCharacterstringsareinterpretedonthebasisoftheir rstthreecharacters;#theIrest$areignored.3Caseisalsoirrelevqant.Months$anddaysoftheweek(usedforIde ning*recursivedates,describGedbelow)aswellascertainspGecialfunctionsareIspGeci edascharacterstrings.]AnywordthatdoGesnotmatchanexistingfunctionIwillUUbGeignored.XDatesarealwaysterminatedbyashortdescriptionofthedate,whichmustbGeIincurlybraces.CThedescriptionshouldcontainplaintextonly;donotputmacrosI(likeUU\LaTeX)here.XDatesSwillbGeprocesseduntil\datereadencounters\end{< !", cmsy10h#': cmti10envir}'onmentIname[ie&>},K8orHthestring\relax{}.mAtthe\endofanenvironment,K8theproGcessingIofthecurrentdatewillbGecompleted,andthe\endwillbeexecuted.\relax{}Iwill^causeproGcessingtoendsilentlywithoutdoinganythingonthelastitem(whichIisUUthe\relax{}itself).6I2.2gSp`eci cDatesIApplyingbtheabGovebrules,/thefollowingisavqalidlistofdates. TheuseofI\datereadUUisexplainedbGelow.f$ߤN cmtt9\begin{quote} f\dateread{\message{\theshorttext}}fJan11996{NewYear'sDay}~Y1XJanuary1996at10:00?{NewYearBash}"\\f1996yjan18-20:30y{NewYearCleaning.Rats.}"f\end{quote}26soXNote!thattheparserisindi erenttowordorder,+andthatcommasshouldnot IbGeUUusedtoseparatewords.^16I2.3gRecursiveDatesuTI%"V cmbx102.3.1l#RangesIAnyIMrecursivedates(suchasEveryMonday)mustbGeprecededbyoneormoreIrangespGeci cations,(which xthetimeperiodorperiodswithinwhichtorecurse.IA rangeissimplytwospGeci cdatesseparatedbythewordto.CY*oumayspGecifyImultipleUUranges;e ectwillbGegiventoeachofthemindividually*.XTheUUfollowingisavqalidrangespGeci cation:tZFebruary s,11996{StartFirstPeriod} ftoApril11996{EndFirstPeriod}tZNovember s,31996{StartSecondPeriod}ftoDecember241996{EndSecondPeriod}6I2.3.2l#ShorthandTDatesuTITwoJtypGesofrecursivedatecanbGeenteredinahuman-readablesyntax.+EntriesIofabGothtypesbeginwiththewordevery.iT*oputaneventoneveryoGccurenceofIadayoftheweekwithinaspGeci edsetofsubranges,simplyindicatethedayofItheUUweek,followedbyashortdescriptionincurlybraces.fEveryMonday{Monday!}XT*o3putanevent3at14-dayintervqals,bGeginningwiththe rstoccurrenceofaIspGeci edUUdayoftheweekwithineachsubrange,addthewordother.fEveryotherMonday7:00{MondayMorningExercise}XT*ob placeaneventb ontheNthoGccurrenceofaspeci eddayoftheweekwithinIeachUUmonth,withinsubrange,addfirst,secondorthird.fEverythirdMonday8:00-9:00p,{MondayMorningMeeting}6I2.3.3l#SuppressingTtheActionuTITherearetwowaysofsuppressingtheuser-de nedaction.T*oquicklycommentIoutuanentry*,putthewordreminfrontofit.ThedatewillbGeread,buttheIactionwintheargumentto\datereadwillnotbGeperformed.X,Thiscanbeused,IforUUexample,tosuppresstheappGearanceofarangeintheoutputtext.XTheusecondmethoGdusesatoggle,}andismeantforusebystyleauthors.Set-Iting:IX-ffr J= "5-:1LܿInǬfact,hcommasdonoharmiftheyfolloÎwastringofthreeormoreletters,butitisb'ExXcodeincurlybraces,9andtheusualshortdescription,alsoIinUUcurlybraces.XThe rstcontrolstringisthenameofauser-de nedmacrothatwill ndtheIpGosition+ofthe rstdesireddateafterthestartoftherange.9HThesecondistheIname'ofamacrotouseinincrementingafterward.=ThebloGckofL5ffA͉TU>'ExXcoGdeIcontainsUUthede nitionsoftheseandanysubsidiarymacros.XThefollowingwillplaceanentryoneverydatewithinthespGeci edsubranges.fFunction\myinit\myincrement ks.{\def\myinit{%tZ\dates@date=\dates@subrange@start}p,\def\myincrement{%tZ\advance\dates@dateby1\relax}ks.}ks.{ADay}XSeethecoGdecommentarysectionoftheDatespackqageforinformationon ImacrosUUthatcanbGeusedformanipulatingdates.!čI3aLCallingfftheParserIAsvmentionedabGove,gtheshortdescriptionincurlybracescanonlycontainplainItext.oPrintingofvqariabletext(suchasthetextofthedate)isdonethroughItheargumenttothe\datereadmacro.ThisargumentisanactionthatwillbGeIpGerformedonceaftereachdateinthelistisread.ThedateandthedescriptionItextUUmaybGeincludedbyusingtheappropriatecommands.qTheseare:SqǍd^\theyearҲTheUUyear(fourdigits).^\themonthҲTheUUfullnameofthemonth.^\theshortmonthҲTheUUnameofthemonth(3characters).^\themonthnumberҲTheUUnumbGerofthemonth.^\thedayҲTheUUdayofthemonth.^\thetimestartҲStartingUUtimeforanitem.^\thetimeendҲEndingUUtimeforanitem.^\theweekdayҲTheUUnameofthedayoftheweek.^\theshortweekdayҲAbbreviatedUUdayoftheweek(3characters).^\theshorttextҲTheUUtextdescribingthedate.^\thelongtextҲAUUlongerdescriptionofthedate.^\thelongdateҲTheUUlongdate(aninteger).^\thedaysҲTheUUmaximumnumbGerofdaysthismonth.4&soXY*oucanalsocallupinformationusinglower-levelregistersandmacrosthat Icontain"date-relatedinformation.F.GotothecoGdeandcommentarysectionforIfurtherUUdetails.XThedemonstration leincludedinthispackqagelistsdatesontheterminalIusing the\messagecommand.XInamoreseriousapplication,textcanbGeprinted,IstoredUUtoregistersorbGoxes,orsentinpre-proGcessedformtoanexternal le.XTheUUfollowingisavqalidinvoGcationofthemacro:؍f\dateread{% p,\message{%y\theweekday,%y\theday\space%y\themonthname\space%y\theyear}}f%f%Thelistofdatestobeparsedf%fJune151997{SummerHolidayBegins}fSeptember251997{SummerHolidayEnds}fJanuary11997{FirstdayofJanuary}fFebruary181997{Frank'sBirthday}fEveryMondayat2:00{GototheBeach}f%f%Theendofthelist.f%f\relax{}؍XA)style)packqagethatusesthedateparsershouldofcourseconcealstretchesof IcoGde'likethatabove'fromtheenduser.NbIflistsofdatesaremaintainedinseparateI les,UUyoucandosomethinglikethefollowing,f\def\readinput{% p,\dateread{\message{\theweekday^^J}}}f\def\inputandread{%p,\expandafter\readinput%y\@@input\filename\relax{}p,}؍Iwhere<\filenamecontainsthenameofa letobGeread.iOnewouldthencon rm ItheUUexistenceofthe le,thenrun\inputandread. I4aLExtendingfftheParserIWhentheparserisusedinapackqage,itmaybGenecessarytomodifyitsbehaviourItoapGerformspecialactionsinthecourseofprocessing.FF*orexample,,youmaywantIto provideafacilityforsettingtherangein lescontainingrecursivedatesfromIagsingle lesothat,lBsay*,angacademicschedulecanbGemovedforwardtothenextIyear-withoutalotoftyping.Thiskindofe ectcanbGeachievedbyde ningaIword8whichdivertsproGcessingtoamacrothatperformsthedesiredactionbeforeIcontinuingUUtodigestthelistofdates.51soXTheUU owofproGcessingcanbedivertedattwopGoints:U81.bImmediatelyUUafterawordisread;orU82.bImmediatelyUUafteradateanditstexthaveUUbGeendigested.XTheUUparsercanbGere-enteredinanyofthreestates:U81.bOneUUthatloGoksforthenextwordinadatestring;U82.bOneUUthatdigeststhedescriptiontext;orU83.bOneUUthatcompletestheproGcessingofadateentryanditstext.XEachNoftheexitpGointsandreentrystatesisassoGciatedwithamacroname. IDiversiondisaccomplishedbyde ningawordthat\letstheexitmacronamebGeItheώuser'sownmacro.E0Reentryisaccomplishedintheuser'smacrobyendingwithIthemdappropriatemacroname.ThenamesthemacrostouseasexitpGointsare,shinItheUUorderofthe rstlistabGove:U81.b\dates@@@readU82.b\dates@read@exitXTheUUnamesofmacrostouseforreentrystatesare:U81.b\dates@@@read@defaultU82.b\dates@@@@read@defaultU83.b\dates@read@exit@defaultXAnextensionthereforeconsistsofauser-de nedmacro,}andauser-de ned Iword'ExXexits.2.Innormaluse,eventsshouldbGesortedandselected rst,inthepackqageIthatgcallsdates.sty.TheargumentcanbGeusedtochoGosebetweengmodesofIL5ffA͉TU>'ExXDhandling, however.'F*orexample, youmightwanttoexpGortthetexttoaI le,Gor_storeitdirectlyintoalistmacro.Byinsertinga\letintothehoGokinI\dates@analyze, youcanputtogglesintotheevent lesthemselves.SThisisusedIincalendartoprovidefortheselective\freezing"ofevents lesinapre-proGcessedIform.Ls3S\long\gdef\dateread#1{% Ls4]\csnamedates@reset@longtext\endcsname%Ls5]\let\dates@read\dates@read@default%Ls6]\gdef\dates@action{#1}%Ls7]\def\dates@subranges{}%Ls8]\dates@subrange@start=0%Ls9]\dates@subrange@end=0%I10]\dates@read}XThe3`nextmacrocontinues3`withinitialization,:+andmakesuppGercasecharactersIactivekinsideagroup.Squarebracesaremadegroupingcharacters,qdsothatwhenIthe;nextchainedmacrorunsandgrabseverythinguptothenextcurlybrace,@weIwillڧhaveameansofgroupingwithinthegrabbGedtext.HSquarebraceswillbeusedIforUUgroupinginuser-de nedfunctionsfortheautomaticgenerationofdates.I11S\long\gdef\dates@read@default{%I12]\dates@time@start=0%I13]\dates@time@end=0%I14]\setyear{1900}%I15]\dates@month=0%I16]\dates@day=0%I17]\dates@weekd@target=7%I18]\def\theshorttext{}%I19]\def\thelongtext{}%I20]\dates@suppressfalse%I21]\let\dates@@@read=\dates@@@read@default%I22]\let\dates@@@@read=\dates@@@@read@default%I23]\let\dates@read@exit=\dates@read@exit@default%I24]\bgroup%I25f\dates@capsdown%7CsoI26f\dates@@read}XOnce wehavethetextwiththecatcoGdessetappropriately*,{wecuto the IcatcoGdeؤchangeandrunamacroinfrontofthegobbledtextwhichwillchewitIup:whileloGoping.wThe\enditallterminatorisamisnomer,3really;`-itendstheIparsingoHofasingledate,ubutwewillcontinueparsinguntil\endor\relax{}areIencountered.I27S\long\def\dates@@read#1#{% I28]\egroup%I29]\dates@@@read#1\enditall}XThe=followingmacrodoGesthechewing.iThemacro\dates@analyzewillalter Ithe~vqaluesof\dates@@@readandof\dates@read@exittoachieve~spGeciale ects.IAny<hoGoksthatrede nethesefunctionsshouldchaintotheirdefaults,AwhichendIinUU@default.I30S\def\dates@@@read@default{% I31f\@ifoverword\enditall%I32p2{\expandafter\dates@analyze\@overword{}%I33t\@gobble@enditalls}%I34p2{\expandafter\dates@analyze\@overword{}%I35t\dates@@@read}%I36p2{\expandafter\dates@analyze\@overword{}%I37t\ifnum\dates@year>0% s,Ifdateexists,processI38~0\let\dates@read\relax%!...andexpireI39~0\dates@read@exit%,Maybearange,sonotdefaultI40t\fi%I41t\expandafter\end\@gobbletwo}}%XPackqage8extensionsthatimpGort lesonthe ymayproducemultiple\enditalls IinoHthescantextforadate.Thiswillchompallofthem.Thechangeinvolvesin-ItroGducingUUthefollowingmacroviathesecondargumentto\@ifoverword,abGove.I42S\def\@gobble@enditalls#1{% I43]\@ifnextnparchar\enditall%I44ap{\let\next\@gobble@enditalls%I45f\next}%I46ap{\dates@@@@read}%I47ap{\message{Thiscan'thappen}}}6I5.3gSelectiveHandlinguTI5.3.1l#DefaultsIThere)arethreepGointsatwhichspGecialhandlingcanbesplicedintotheparsing Iroutine. 0Below,Othe_defaultsarepresented rst,OfollowedbyalternativesthatIarebuiltintothepackqage.OtherspGecialhandlingroutinescanbesplicedin,asIdiscussedUUbGelowunder5.4. 6\dates@@@@readf\dates@@@@@readITheAfollowingwillreadarguments(onemandatoryargumentincurlybraces,EoneIoptionalloneinsquarebraces)andsavelthemforuseastextdescriptionsapplyingIto Zthedate.XAftertheargumentsarestored,YwechaintotheexitroutinethatwillIpGerformUUtheactionthattheusergaveUUto\dateread.XThereQaresomedirtytrickshereinvolvingthesquarebrace.gW*ede netheImacro=+globallyinsideagroup,w sothatourcatcoGdechangewillnota ectother8 PsoIcoGde.Thenwesettheopenbracetobeagroupingcharacterlike{.W*ecan't Iuse/thisinsidethede nitiondirectly(bGecauseTU>'ExXwilltrytokeepreadingtextIuntil(it ndsthematchingbrace),]sowe\letamacrohavethistoken'svqalue.IThe[\letisglobalbGecausethevqalueof{isglobal.ThenweusethefunnybraceImacroUUinsidethede nitiontoloGokforasquarebracecomingup.XAllUofthisjiggery-pGokeryisnecessarybecausethe\futureletcommand(usedIby\@ifnextchar)willstampacategorycoGdeonthebracewhenitseesit.gTheIend0+result,fthough,isthatTU>'ExXwillreadallthewaytothelastclosingsquareIbrace,_not*tjusttothenextoneit nds.#AnysquarebracesinsidethetextwillIdisappGearuinprintedtext,}butatleasttheuserwillnot ndthestyleblowingupIinUUhisface.XW*eFalsomakecapitallettersactive,Iwith\dates@capsdown.lThisisdoneinaIseparatelyXnestedgroup,YsothatitcanbGeturnedo beforereadinganysquare-IbracedUUtext,withouta ectingthecatcoGdeofthebraces.tI48S\bgroup I49]\catcode`\[=1I50]\global\let\dates@funny@brace=[I51]\gdef\dates@@@@read@default#1{%I52ap\def\theshorttext{#1}%I53ap\bgroup%I54kJ\catcode`\[=1\catcode`\]=2\relax%I55kJ\bgroup%I56t\dates@capsdown%I57t\@ifnextnparchar\dates@funny@brace%I58~0{\egroup%I59\dates@@@@@read}%I60~0{\egroup%I61\egroup%I62\dates@read@exit}%I63~0{\egroup%I64\egroup%I65\dates@read@exit}}I66S\egrouptXTheoptionalargumentusesbGog-standardL5ffA͉TU>'ExXoptionsyntax.+Theonlywrin- IkleisinthecatcoGdechangesinvokedwithinagroupinthemacroabGove.kTheseIareUUcuto here.I67S\def\dates@@@@@read#1{% I68]\egroup%I69]\iflongtext%I70f\def\thelongtext{#1}%I71]\fi%I72]\dates@read@exit}/XThe=followingisthedefaultvqalueof\dates@read@exit.iIt xesthedateand Irationalizestheregisterscontaininghuman-readabledateinformation,pandsavesIthedateforfuturereference(i.e.incaseweneeditasthebGottomendofarange).IItthenpGerformstheactiongivenbytheuserintheargumentto\dates@read,IandUUchainsbacktocontinueparsingwithinthepresentedlistofdates.I73S\def\dates@read@exit@default{% I74]\dates@fix%I75]\caldate%9 ]+soI76]\dates@lastdate\dates@date% I77]\ifdates@suppress@global%I78]\else%I79f\ifdates@suppress%I80f\else%I81S%Y\bgroup%I82S%Y\dates@capsup%I83yw^\dates@action%I84S%Y\egroup%I85f\fi%I86]\fi%I87]\dates@read}6I5.3.2l#Recursiv9eTHandlinguTS\dates@read@exit@rangeIThisUUismeanttobGesplicedintotheparserimmediatelybGeforethemacro:b\dates@read@exit@defaultXItxisinvokedxbythewordtointhecurrentdateentry*.mInvokedafterthetext IargumentdescribingthecurrentdatehasbGeengrabbed,itbeginsbyrationalizingItheumachineandhumanreadabledates.ҐItthenexpandstheregisterscontainingIthestartingandendinglongdatesdescribingarangeintoalistmacro.TThedatesIare)steppGeddownoneanduponedayrespGectively*,esothatasimple>ortimeitisinvoked.yW*e>thenmove>thedateforward,8ifnecessary,8to ndIthetargetteddayoftheweek.Whenthisisfound,KKwesetthehuman-readableIregisterinformationaccordingtothatlongdate(includingthedayofthemonth).IDividingandmultiplyingby7yieldsthelargestmultipleof7thatisequaltoorIlessthanthedayofthemonth.Ifthisis0,ȭwe'reinthe rstweek,ȭif7we'reinIthesecond,ǽandsoforth.[IfthevqalueofthecurrentdayistoGolow,ǽwemoveupIthe`date.PvIfitistoGohigh,^wemovetothe rstdayofthenextmonth,^andrequestIaUUloGopbackthroughthesameroutines.E152S\def\dates@init@monthly{%E153]\let\dates@init@monthly@recurse\relax%E154]\nextday\dates@weekd@target%E155]\caldate%E156]\dates@one\dates@day%E157]\divide\dates@oneby7\relax%E158]\multiply\dates@oneby7\relax%E159]\ifnum\dates@modulo>\dates@one\relax%E160f\dates@two\dates@modulo%E161f\advance\dates@twoby-\dates@one%E162f\global\advance\dates@dateby\dates@two%E163]\else%E164f\ifnum\dates@modulo<\dates@one\relax%E165p2\dates@next@month%E166p2\let\dates@init@monthly@recurse\dates@init@monthly%E167f\fi%E168]\fi%E169S\dates@init@monthly@recurse}XThis}isthegeneralincrementingmacroformonthlyentries.W*It'sprettysimple;Iwe!justmovetothe rstdayofthenextmonth,,2thenruntheinitializationmacroIagainUUto ndtheappropriatedatewithinthemonth.E170S\def\dates@increment@monthly{%E171]\dates@next@month%E172]\dates@init@monthly}ҙ\dates@@@@read@functionZ\dates@@@@read@@functionIThisUUisdesignedtobGesplicedintotheparserimmediatelybeforethemacro:12 ~Ӡsob\dates@@@@read@default.XItqisinvoked, klikeqtheotherspGecialhandlingroutines,viathe\dates@execute IhoGok inthetextanalyzer(see5.4fordetails).nItreadstwo argumentsimmedi-Iatelyfollowingthewordthattriggersit.~MItstorestheseforreference.ThethirdIargumentisreadaftercheckingtobGesurethatwehavereachedtheendoftheIparsingstring, andareloGokingatthedelimiterthatendsit.R_Thenthisisgobbled,Iand17dumpGedintothedocumentsothatthede nitionsitcontainswilltakee ect.IThe jiggery-pGokerywithgroupinglimitsthee ectof\makeatlettertothescopeIof9thebracesdelimitingtheuser'sfunctionde nition,whilethemacroshede nesIthereUUcanbGede nedlocally*.XThisthirdargumentshouldnotproGduceanyprintedoutput,andshouldde ne,Iat6minimum,31% E199]\setyear{\dates@arg@a}%E200\else%E201]\ifnum\dates@day>0%E202\dates@dayerror%E203]\else%E204\global\dates@day=\dates@arg@a%E205]\fi%E206\fi%ILev9elTThree(again)1IfUUtheitemwasalonetime,wesetvqariablesaccordingly*.iiE207p2\else%E208yw^\expandafter\dates@strip@colon\dates@arg@b%E209yw^\global\dates@time@start=\dates@arg@a%E210yw^\multiply\dates@time@startby60%E211yw^\advance\dates@time@startby\dates@arg@b%E212yw^\global\dates@time@end=\dates@time@start%E213p2\fi%ILev9elTTwo(again)ClIfitwasarangeoftimes,wehavetheextremesoftherange bin \dates@arg@aand\dates@arg@b.W*eproGcesseachsothatacolonde-blimiter)isnotrequired,^butwillbGerecognizedifgiven.yNotethe0inthebde nitionof\dates@check@colonetal.,abGove;thisproducesadefaultofbzeroUUifthisisabarenumbGerUUwithnocolondelimiter.⍑bW*erproGceedby rstsettingasidethecontentsof\dates\arg@bsothattheybwillnotbGeoverwritten.eW*ethencheckfortheexistenceofacolonand,Wifbone"isfound,UthetrailingcolonleftbythetestmacroisstrippGedo .vW*ebthenUUsetthetime.iiE214f\else% E215p2\expandafter\dates@strip@hyphen\dates@arg@b%E216p2\let\dates@temp\dates@arg@b%E217p2\expandafter\dates@check@colon\dates@arg@a:{}%E218p2\ifx\dates@arg@b\dates@zero%14soE219p2\else% E220yw^\expandafter\dates@strip@colon\dates@arg@b%E221p2\fi%E222p2\dates@time@start=\dates@arg@a\relax%E223p2\multiply\dates@time@startby60\relax%E224p2\global\advance\dates@time@startby\dates@arg@b\relax%ѽILev9elTTwo(continued)vW*ethendoexactlythesamethingforthesecondtime bgiven.ѽE225p2\expandafter\dates@check@colon\dates@temp:{}%E226p2\ifx\dates@arg@b\dates@zero%E227p2\else%E228yw^\expandafter\dates@strip@colon\dates@arg@b%E229p2\fi%E230p2\dates@time@end=\dates@arg@a\relax%E231p2\multiply\dates@time@endby60\relax%E232p2\global\advance\dates@time@endby\dates@arg@b%E233f\fi%ILev9elTone(again)If9\dates@worddoGesnotlooklikeanumbGer,thenitishan- bdledoastext.SW*epasscontroltoamacrothatwillsimplyexecuteamacrobnamederivedfromthe rstthreecharactersoftheword.Ifit'sunknownbcha ,7it/kwillthereforee ectivelybGeignored.e$Thiscanbeusedasahookforbde ningDoptionsnotincludedinthedatespackqagepropGer.l0ThedescriptionbofUUthehoGoksusedbythevqanillaversionofdatesisgivenbGelow.ѽE234]\else% E235p2\dates@execute#1#2XXX{}%E236]\fi}q 6\dates@executeIUsedasthedefaultactionintheanalyzer,thisjustblindlyexecutesamacro Ithat-Vmaymatchaday*,cVmonthoroptionname.IfthedatestringislimitedbyI\relax{},themacroname\relaxwillbGereadinasatokenforinterpretation.IT*o,preventunexpGectedresults,4wethereforeconvertaleadingcontrolsequencetoIastringwithin\csname\endcsname.v_W*emustnotgivethesametreatmenttoInon-control-sequenceElitems,qhowever,bGecauseElthiswouldpreventtheexpansionIofcuppGercasecharacters,whichchavebGeenreadinasactivecharacters,totheirIlowercase9counterparts.h_An\ifcatisusedtochoGosewhichactionisappropriate.IThe<macrosinvoked<by\dates@executenevertakearguments,usotheycanbGeIexpandedUUwithinthescopGeof\ifcat.LE237S\def\dates@execute#1#2#3#4#{% E238]\ifcat#1\relax%E239f\expandafter\csname%E240p2\string#1#2#3mac\endcsname%E241]\else%E242f\expandafter\csname#1#2#3mac\endcsname%E243]\fi}%qI5.5gFo`dderfortheAnalyzeruTIAs%canbGegleanedfromanexaminationof\dates@execute,Xawordisreadby Iexecutingamacronamedusingits rstthreeletters._SW*eprovidede nitionsforaInumbGerUUofsuchmacroshere.15so3P\evemacIEvery@^setsupforrecursion,{ andforadefaultofincrementingoverdaysofthe Iweek.E244S\def\evemac{% E245XdD\global\let\dates@read@exit=\dates@read@exit@recurse%E246XdD\global\let\dates@increment=\dates@increment@weekly%E247XdD\global\let\dates@init=\dates@init@weekly}I%3P\othmacIOtherHwillmoGdifythee ectofeverytochooseeveryotherdatewithintherange.IY*ouN5can'tchoGosethestartingdateswithinthesubrange|butsomeautomationIisUUbGetterthannone.E248S\def\othmac{%E249]\global\let\dates@increment=\dates@increment@semiweekly}I%3P\firmac3P\secmac3P\thimacIFirst,secondRandthirdwillsetacounterthancontrolswhichinstanceofadayIofAtheweekwithinamonthshouldbGechosen,EandmoGdi esthee ectofeverytoIrecurseUUonthatinstancewithineverymonth,withinthesubrange. E250S\def\firmac{%E251]\dates@modulo=0%E252]\global\let\dates@init=\dates@init@monthly%E253]\global\let\dates@increment=\dates@increment@monthly}%E254S%E255S\def\secmac{%E256]\dates@modulo=7%E257]\global\let\dates@init=\dates@init@monthly%E258]\global\let\dates@increment=\dates@increment@monthly}%E259S%E260S\def\thimac{%E261]\dates@modulo=14%E262]\global\let\dates@init=\dates@init@monthly%E263]\global\let\dates@increment=\dates@increment@monthly}%I%3P\1stmac3P\2ndmac3P\3rdmacITheseUUarejustaliasesofthemacrosabGove.E264S\expandafter\let\csname1stmac\endcsname=\firmac%E265S\expandafter\let\csname2ndmac\endcsname=\secmac%E266S\expandafter\let\csname3rdmac\endcsname=\thimac%I%3P\toXmacITheUfollowingrespGondstotointheparsedtext.EIftheyeariszero,"itsetsthebGot-Itomofarangetothelastdateencountered,andletstheexitmacroforproGcessingIa nisheddatebGeonewhichwillsetthetopoftherangebeforeperformingtheIactiontspGeci edbytheuser.AIftheyearisgreaterthanzero,|wegrabthecurr}'entIdate,ereseteverythingtozero,andcontinueparsing.7ThispGermits\nofrills"rangeIdesignations,UUasinthecalendarpackqage.XTheJXisappGendedto llouttothreecharacters.F*orreasonsthatIdonotIfully#understand,thiswasnecessarytopreventthepackqagefromexitingwithinItheUUscopGeofagroup.E267S\def\toXmac{\relax%E268]\ifnum\dates@year=0%E269f\dates@subrange@start\dates@lastdate%E270]\else%E271f\dates@fix%E272f\dates@subrange@start\dates@date%E273f\dates@month=0%16/soE274f\dates@day=0% E275f\setyear{1900}%E276]\fi%E277]\let\dates@read@exit\dates@read@exit@range}%E278Y 3P\funmacIThefollowingcausesafunctionde nitiontobGereadimmediatelyaftertheword IfunctionUUinthedatetext.E279S\def\funmac{%E280]\global\let\dates@read@exit=\dates@read@exit@recurse%E281]\global\let\dates@@@read=\dates@@@@read@function}XThefollowingcausesthesuppressionofanyactioninrespGectoftheentryin IwhichUUitisfound.E282S\def\remmac{%E283]\global\dates@suppresstrue}3P\janmac b\jancheckmacIThemonthsarede nedgloballyusingarecursiveenginethatisdiscardedwhen ItheDmacroshaveDbGeende ned.ٓEachmonthmacro rstsetsacountertotheInumbGer0ofdaysinthemonth,gsothatarangecheckcanbGeperformedwhentheIdateisinterpreted.EItthencheckstoseeifamonthhasalreadybGeenselected,wandIifGsoitforcesafatalerror;L&otherwise,JPthemonthcounterissettotheappropriateIvqalue.E284S\bgroup E285]\def\monthdata#1#2#3#4#5\end{%E286f\expandafter\gdef\csname#2#3#4mac\endcsname{%E287yw^\ifnum\dates@month>0%E288\dates@montherror%E289yw^\else%E290\global\dates@month=#1%E291yw^\fi}%E292f\ifcat$#5$\let\next\@gobble\else\let\next\monthdata\fi%E293f\next#5\end}%XTheUUfollowingdoGestheactiongenerationofmonthmacros. YE294]\monthdata1jan2feb3mar4apr5may6jun%E295]7jul8aug9sep{10}oct{11}nov{12}dec\endE296S\egroup3P\monmacIDaysUUoftheweekarespGeci edinasimilarfashion.E297S\bgroupE298]\def\weekdata#1#2#3#4#5\end{%E299f\expandafter\gdef\csname#2#3#4mac\endcsname{%E300p2\ifnum\dates@weekd@target<7\relax%E301yw^\dates@weekerror%E302p2\else%E303yw^\global\dates@weekd@target=#1\relax%E304p2\fi}%E305f\ifcat$#5$\let\next\@gobble\else\let\next\weekdata\fi%E306f\next#5\end}E307E308]\weekdata0sun1mon2tue3wed4thu5fri6sat\endE309S\egroup17sot\dates@montherror \dates@weekerror f\dates@dayerrorIThese3threemacrosareusedintheabGove3de nitionstoproduceerrormessagesif IsomethingUUiswrongwithadate.E310S\def\dates@montherror{% E311]\PackageError{dates}{Monthmultiplydefined}{%E312fYouhavesetthemonthmorethanoncehere.}}E313S%E314S\def\dates@dayerror{%E315]\PackageError{dates}{Daymultiplydefined}{%E316fYouhavesetthedaymorethanoncehere.}}E317S%E318S\def\dates@weekerror{%E319]\PackageError{dates}{Weekmultiplydefined}{%E320fYouhavesetthedayoftheweekmorethanoncehere.}}6I5.6gLow-levelBitsandPiecesuTf\dates@capsdownITheG\lowercasefunctionprovidedinTU>'ExXdoGesnotoperateinTU>'ExX'smouth,Iand]xsocannotbGeusedtocreatelowercase]xstringsforexporttoanon-DVI]4 leIor8ofordisplayontheterminal.W*ecangetaroundthisproblembymakingallIuppGer-casecharactersactive,andde ningthemtolowercasethemselves. TheIopGerative~de nitionis\dates@capsdown.AThegroupingcullsthebootstrappingIde nitionsusedtocreatethesemacrosfrommemory*.0AdetailedexplanationtheseImacrosQisnotgivenhere,Rvbuttheydowork.pEssentially*,RvtheyfunctionbyloGopingIoversetsofthreecharacters,twouppGercaseandonelowercase,buildingamacroI(\dates@capsdown)thatwillmaketheuppGercasecharactersinthelistloGcallyIactive,[withYtheappropriatede nition.TwouppGercasecharactersarerequiredinItheYSlistbGecauseonisreadtoidentifythecharactersothatitcanbGemadeactiveIinUUorder,onthesecondread,totakeitsactiveformandde neit.E321S\bgroupE322S\newtoks\dates@regE323S\dates@reg={}E324S\def\dates@capsdown{}E325S\def\dates@capsup{}E326S\def\dates@capsactive#1{%E327]\ifx#1\end%E328f\let\next\relax%E329]\else%E330f\catcode`#1=13%E331f\let\next\dates@@capsactive%E332]\fi%E333]\next}E334S\def\dates@@capsactive#1#2{%E335]\dates@reg=\expandafter{%E336f\dates@capsdown\catcode`#1=13\gdef#1{#2}}%E337]\xdef\dates@capsdown{\the\dates@reg}%E338]\dates@reg=\expandafter{%E339f\dates@capsup\edef#1{\string#1}}%E340]\xdef\dates@capsup{\the\dates@reg}%E341]\let\next\dates@capsactive%E342]\next}E343S\dates@capsactive%E344]AAaBBbCCcDDdEEeFFfGGgHHhIIiJJjKKk%18soE345]LLlMMmNNnOOoPPpQQqRRrSSsTTtUUuVVv% E346]WWwXXxYYyZZz\endE347S\egroup6XF*or͊parsingstrings,weusesomelittlemacrostoidentifystringsthathavea Icoloninthem(whichwillbGeassumedtobeatime)orahyphen(assumedtobeIaUUrangeoftimes),andtostripthoseo wherenecessary*.$E348S\def\dates@check@colon#1:#2#{% E349]\def\dates@arg@a{#1}%E350]\def\dates@arg@b{0#2}}E351S\def\dates@strip@colon#1:{%E352]\def\dates@arg@b{#1}}E353S\def\dates@check@hyphen#1-#2#{%E354]\def\dates@arg@a{#1}%E355]\def\dates@arg@b{0#2}}E356S\def\dates@strip@hyphen#1-{%E357]\def\dates@arg@b{#1}}$XTheUUfollowingmacroisusedtoterminateproGcessing.E358S\expandafter\expandafter\expandafter\def%E359]\expandafter\csname%E360f\string\relaxXXmac\endcsname{%E361p2\let\dates@@@@read\relax}I5.7gInterfaceMacrosforDateInfouTy\theyear $\themonth 6\theshortmonth f\themonthnumber 3P\theday L\theweekday \theshortweekday b\thelongdate \themonthdays \theshorttext b\thelongtextITheseRmacroscanbGeusedtoincludedateinformationinthetextfedto\dateread. ITheydonotcontainunprintableopGerations,CandsocanbeusedtodisplaytextonIthe6@terminalaswellasinadoGcument.gkAllareupGdatedfromthelongdatebytheI\caldatebcommand.gThemacros\theshorttextand\thelongtextarede nedIelsewhereonthe y;QtokenregisterscannotbGeusedforthesebecausetheymustIbGeUUallowedtoexpandfullyontheterminal.E362S\def\theyear{\the\dates@year@full} E363S\def\themonth{\the\dates@monthname}E364S\def\theshortmonth{\the\dates@monthname}E365S\def\themonthnumber{\the\dates@month}E366S\def\theday{\the\dates@day}E367S\def\theweekday{\the\dates@dayname}E368S\def\theshortweekday{\the\dates@shortweekday}E369S\def\thelongdate{\the\dates@date}E370S\def\themonthdays{\the\dates@days}I5.8gMathsFunctionsforDatesuTIThe(followingcoGdeisanalmostdirectrip-o ofthecalendarmacrosforplain ITU>'ExXthatarestoredonCT*AN.Ifanyoneknowswhotheauthoris,IwillbGehappyIto includeacredithere.MIhave madescante orttodoGcumentthecoGde,butitIworksUUwell.6y\setyearISetUUthecurrentyear.E371S\def\setyear#1{\dates@year=#1% E372XdD\advance\dates@yearby-1900\calculateyearbase}19Yso$\nextyearIAdvqanceUUbyoneyearE373S\def\nextyear{\advance\dates@yearby1% E374XdD\calculateyearbase}t\dates@next@monthIAdvqanceUUbyonemonth.E375S\def\dates@next@month{%E376]\ifnum\dates@month=12%E377f\advance\dates@yearby1\calculateyearbase%E378f\dates@month=1%E379f\dates@day=1%E380]\else%E381f\advance\dates@monthby1%E382f\dates@day=1%E383]\fi%E384]\dates@fix\caldate}XSetUUthecurrenttimezone.b\settimezoneE385S\def\settimezone#1{\dates@timezone=#1%E386XdD\multiply\dates@timezoneby1000%E387XdD\divide\dates@timezoneby24}9\calculateyearbaseISet+`the\ifleapyeartoggle.cSet\dates@yearbasetothenumbGer+`ofdayspassed IfromUU1900,Jan0toNewyear'sdateinthetargetyear.E388S\def\calculateyearbase{%E389XdD\dates@yearbase=-1%E390XdD{\count0=\dates@year\divide\count0by4%E391XdD\multiply\count0by4\relax%E392XdD\ifnum\dates@year=\count0%E393ap\global\dates@catch=0%E394XdD\else%E395ap\global\dates@catch=1%E396XdD\fi}%E397XdD\ifcase\dates@catch\leapyeartrue\or%E398]\leapyearfalse\fi%E399XdD{\count0=\dates@year\multiply\count0%E400XdDby1461\advance\count0by3%E401XdD\divide\count0by4%E402XdD\global\dates@catch=\count0}%E403XdD\global\advance\dates@yearbaseby\dates@catch\relax%E404XdD\ifnum\dates@year=0\global\dates@yearbase=0\leapyearfalse\fi}\monthdaysISetUUthenumbGerUUofdayspassedattheendofeachmonthin\dates@day.E405S\def\monthdays{%E406S\global\dates@catch\ifcase\dates@month%E407]0\or31\or%E408]59\or90\or120\or151\or181\or212\or%E409]243\or273\or304\or334\or365\fi%E410XdD{\ifleapyear\ifnum\dates@month>1%E411]\global\advance\dates@catchby1\fi\fi}%E412XdD\dates@day=\dates@catch}20so\dates@fixIReturnthelongdateof\dates@month,\dates@dayintheyear\dates@yearin I\dates@dateaftercheckingtobGesurethatthemonthandthedayhavebGeenset,Iifcon rmationhasbGeentoggledon,andthatthenumberofdaysinthemonthIconformsUUtotheconstraintsofreality*.UE413S\def\dates@fix{% E414XdD\ifnum\dates@month=0%E415ap\ifdates@requiremonth%E416kJ\PackageError{dates}{Missingmonth}{%E417tYouneedtospecifyadateforthemonthinthisdateentry.}%E418ap\else%E419kJ\dates@month=1%E420ap\fi%E421XdD\fi%E422XdD\ifnum\dates@day=0%E423ap\ifdates@requireday%E424kJ\PackageError{dates}{Missingdayofthemonth}{%E425tYouneedtospecifyadayofthemonthinthisdateentry.}%E426ap\else%E427kJ\dates@day=1%E428ap\fi%E429XdD\fi%E430XdD\dates@monthname@get%E431XdD\ifnum\dates@days<\dates@day%E432ap\PackageError{dates}{Dayofmonthoutofrange}{%E433kJThereareonly\the\dates@days\spacedaysin%E434kJ\themonth,butyouhavetried^^J%E435kJtospecify\the\dates@day.}%E436XdD\else%E437ap\dates@date=\dates@day{\advance\dates@monthby-1%E438f\monthdays%E439f\advance\dates@dateby\dates@day%E440f\global\advance\dates@dateby\dates@yearbase}%E441XdD\fi},`\modILongdateMOD7willgivetheweekday*.WSundayis0andSaturdayis6.WThe IbaseUUnumbGerisreturnedin\dates@three.E442S\def\mod#1#2#3{\dates@three=#2\relax%E443XdD\dates@four=\dates@three%E444XdD\divide\dates@threeby#1%E445XdD\multiply\dates@threeby#1%E446S\advance\dates@fourby-\dates@three%E447XdD#3=\dates@four}E448E449S\def\dates@year@get{%E450]\dates@year@full\dates@year%E451]\global\advance\dates@year@fullby1900\relax} L\theweekdayISetUUthenamesofweekday(LoGcal).E452S\def\dates@dayname@get{%E453]\mod7\dates@date\dates@weekd%E454]\ifcase\dates@weekd%E455yw^\global\dates@dayname{Sunday}%E456yw^\global\dates@shortweekday{Sun}%21OsoE457f\or\global\dates@dayname{Monday}% E458yw^\global\dates@shortweekday{Mon}%E459f\or\global\dates@dayname{Tuesday}%E460yw^\global\dates@shortweekday{Tue}%E461f\or\global\dates@dayname{Wednesday}%E462yw^\global\dates@shortweekday{Wed}%E463f\or\global\dates@dayname{Thursday}%E464yw^\global\dates@shortweekday{Thu}%E465f\or\global\dates@dayname{Friday}%E466yw^\global\dates@shortweekday{Fri}%E467f\or\global\dates@dayname{Saturday}%E468yw^\global\dates@shortweekday{Sat}%E469]\fi}y\caldateIGiveslrtheusualcalendardateforalongdateincounter\dates@date.Returned Iinڼ\dates@day,<\dates@monthand\dates@yearandotherregisters. SeetheIinterfaceUUmacrosabGoveunder5.7.E470S\def\caldate{\dates@year=\dates@date% E471XdD\multiply\dates@yearby4\divide\dates@yearby1461%E472XdD\calculateyearbase%E473XdD{\advance\dates@dateby-\dates@yearbase\dates@month=0%E474XdD\loop\monthdays\ifnum\dates@day<\dates@date%E475XdD\global\advance\dates@monthby1\repeat%E476XdD{\advance\dates@monthby-1\monthdays%E477XdD\advance\dates@dateby-\dates@day%E478XdD\global\dates@day=\dates@date}}%E479XdD\dates@year@get%E480XdD\dates@monthname@get%E481XdD\dates@dayname@get}Ʋ\dates@monthname@getIThisUUstoresthenamesofthemonthstoregisters.qItisrunby\caldate.E482S\def\dates@monthname@get{%E483]\ifcase\dates@month%E484f\or\global\dates@monthname{January}%E485yw^\global\dates@shortmonthname{Jan}%E486yw^\global\dates@days=31\relax%E487f\or\global\dates@monthname{February}%E488yw^\global\dates@shortmonthname{Feb}%E489yw^\ifleapyear%E490\global\dates@days=29\relax%E491yw^\else%E492\global\dates@days=28\relax%E493yw^\fi%E494f\or\global\dates@monthname{March}%E495yw^\global\dates@shortmonthname{Mar}%E496yw^\global\dates@days=31\relax%E497f\or\global\dates@monthname{April}%E498yw^\global\dates@shortmonthname{Apr}%E499yw^\global\dates@days=30\relax%E500f\or\global\dates@monthname{May}%E501yw^\global\dates@shortmonthname{May}%E502yw^\global\dates@days=31\relax%E503f\or\global\dates@monthname{June}%22ΠsoE504yw^\global\dates@shortmonthname{Jun}% E505yw^\global\dates@days=30\relax%E506f\or\global\dates@monthname{July}%E507yw^\global\dates@shortmonthname{Jul}%E508yw^\global\dates@days=31\relax%E509f\or\global\dates@monthname{August}%E510yw^\global\dates@shortmonthname{Aug}%E511yw^\global\dates@days=31\relax%E512f\or\global\dates@monthname{September}%E513yw^\global\dates@shortmonthname{Sep}%E514yw^\global\dates@days=30\relax%E515f\or\global\dates@monthname{October}%E516yw^\global\dates@shortmonthname{Oct}%E517yw^\global\dates@days=31\relax%E518f\or\global\dates@monthname{November}%E519yw^\global\dates@shortmonthname{Nov}%E520yw^\global\dates@days=30\relax%E521f\or\global\dates@monthname{December}%E522yw^\global\dates@shortmonthname{Dec}%E523yw^\global\dates@days=31\relax%E524]\fi}y\nextdayIFindUUthenext(previous)dayafter(bGefore)\dates@datewith\mod7=#1.E525S\def\nextday#1{{\count0=#1\mod7\dates@date\dates@weekd%E526XdD\advance\count0by-\dates@weekd\relax%E527XdD\ifnum\count0<0\advance\count0by7\fi%E528XdD\global\advance\dates@dateby\count0}}y\prevdayE529S\def\prevday#1{\snextday#1%E530XdD\global\advance\dates@dateby-7}$\snextdayE531S\def\snextday#1{\global\advance\dates@dateby1%E532XdD\nextday#1}$\sprevdayE533S\def\sprevday#1{\global\advance\dates@dateby-1%E534XdD\prevday#1}XConvertUUfromJuliandateandtimeinolongdate(inloGcaltime)E535S\def\jdttol{\advance\dates@dateby500%E536XdD\advance\dates@dateby\dates@timezone\divide\dates@dateby1000}6I5.9gTrigonometricFunctionsuTE537S\def\sintable#1{\ifcase#10\or100\or199%E538XdD\or296\or389\or479\or565\or644\or717%E539XdD\or783\or841\or891\or932\or964\or985%E540XdD\or997\or1000\or992\or974\or946\or909%E541XdD\or863\or808\or746\or675\or598\or516%E542XdD\or427\or335\or239\or141\or42\or-58%E543XdD\or-158\fi}23ɠsoXReducesmoGdulo2\pi(requirespositiveargumenttheta):theta?:=theta IMOD?2\pi,UUwheretheta=count1*10^(-3) E544S\def\twopimod{\count2=\count1%E545XdD\divide\count2by6284\count3=1853%E546XdD\count4=6283\multiply\count3 s,by\count2%E547XdD\multiply\count4 s,by\count2%E548XdD\divide\count3 s,by10000%E549XdD\advance\count3 s,by\count4%E550XdD\advance\count1 s,by-\count3}%mXv?:=sin(theta),[wherev=count4*10^(-3);`theta=count1*10^(-3)Itheta.isreducedMOD?2\pitobGe0<=theta<2\piby\TWOPIMOD,thenlinearin-IterpGolationUUisperformedusing\SINTABLE.E551S\def\sin{\relax%E552XdD\ifnum\count1<0\signtrue%E553XdD\count1=-\count1\else\signfalse\fi%E554XdD\loop\ifnum\count1>6284\twopimod\repeat\relax%E555XdD\ifnum\count1>3142%E556XdD\advance\count1by-3142%E557XdD\ifsign\signfalse\else\signtrue\fi\fi%E558XdD\multiply\count1 s,by10\count3=\count1%E559XdD\divide\count3 s,by1000\count2=\count3%E560XdD\multiply\count3 s,by1000%E561XdD\advance\count3 s,by-\count1%E562XdD\count5=\sintable{\count2}%E563XdD\count4=\count5\advance\count2 s,by1%E564XdD\advance\count4 s,by-\sintable{\count2}%E565XdD\multiply\count4 s,by\count3%E566XdD\divide\count4 s,by1000%E567XdD\advance\count4 s,by\count5%E568XdD\ifsign\count4=-\count4\fi}%mXv?:=cos(theta),RwhereJ v=count4*10^(-3);Dtheta=count1*10^(-3).I\SINUUisevqaluatedonpi/2-theta.E569S\def\cos{\advance\count1 s,by-1571%E570XdD\multiply\count1 s,by-1\sin}%ۍILinear :transformationofT (givingtheta?:=a*T+b,where :T=count0*10^(-6);Itheta?=count1*10^(-3);UUa=#1*10^3+#2+#3*10^(-3);b=#4*10^(-3)E571S\def\lin#1.#2.#3+#4.{\count1=#3%E572XdD\count2=#2\count3=#1%E573XdD\multiply\count1by\count0%E574XdD\multiply\count2by\count0\relax%E575XdD\multiply\count3by\count0%E576XdD\divide\count1by1000%E577XdD\advance\count1by\count2%E578XdD\divide\count1by1000%E579XdD\advance\count1by\count3%E580XdD\advance\count1by#4\relax}mXAccumulate8vqaluereturnedbyatrigonometricfunction,0scaledbyfactorf,Iinto count6:8ac?:=ac+f*v,P;whereac=count6*10^(-7)v=valueofSINڲorICOS?=count4*10^(-3)UUf=#1*10^(-4)E581S\def\fac#1{\multiply\count4 s,by#1%E582XdD\advance\count6 s,by\count4}E583S\def\id{\count4=\count1} s,%Identity24soI5.10nInitializationuTIThisy|initializes\uselongtexttothevqalueselectedbytheuserinthepackqage IcallingUUdates.E584S\def\dates@initialize@longtext{% E585]\ifuselongtext%E586f\def\dates@reset@longtext{%E587p2\longtexttrue}%E588]\else%E589f\def\dates@reset@longtext{%E590p2\longtextfalse}%E591]\fi}XBeforeanythingfurtherisexecuted,&OthefollowingregistersandmacrosneedItoUUbGeinplace.E592S\newcount\dates@yearE593S\newcount\dates@timezoneE594S\dates@timezone=0E595S\newcount\dates@catchE596S\newcount\dates@dayE597S\newcount\dates@monthE598S\newcount\dates@dateE599S\newcount\dates@oneE600S\newcount\dates@twoE601S\newcount\dates@threeE602S\newcount\dates@fourE603S\newcount\dates@weekdE604S\newcount\dates@time@startE605S\newcount\dates@time@endE606S\newcount\dates@subrange@startE607S\newcount\dates@subrange@endE608S\newcount\dates@daysE609S\newcount\dates@lastdateE610S\newcount\dates@yearbaseE611S\newcount\dates@weekd@targetE612S\newcount\dates@moduloE613S\newcount\dates@year@fullE614S\newcount\dates@extra@dayE615S\newtoks\dates@regE616S\newtoks\dates@daynameE617S\newtoks\dates@shortweekdayE618S\newtoks\dates@monthnameE619S\newtoks\dates@shortmonthnameE620S\newif\iflongtextE621S\longtexttrueE622S\newif\ifdates@requiremonthE623S\newif\ifdates@requiredayE624S\newif\ifdates@suppressE625S\newif\ifdates@suppress@globalE626S\newif\ifleapyearE627S\let\delim\relaxE628S\def\enditall{ENDITALL}E629S\def\dates@empty{}E630Sh=st9yle[i25soI6aLTheffDemoFileE631Shdemo|ei E632S\documentclass{minimal}E633S\usepackage{dates}E634S\begin{document}E635E636S\makeatletterE637E638Shdemogi+