%% 
%% This is file `calendar.sty',
%% generated with the docstrip utility.
%% 
%% The original source files were:
%% 
%% calendar.dtx  (with options: `style')
%% 
%% This file is part of the Calendar 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 Calendar a more powerful, 
%% friendlier, and better package, please contact me on 
%% `fb' at soas.ac.uk 
%% 
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{calendar}
          [1996/11/09 v0.01 Calendar engine (Frank Bennett)]
\DeclareOption{highermath}{%
\def\JDTtoL{\advance\date by500
 \advance\date by\timezone\divide\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}
\newif\ifsign
\def\Sin{
 \ifnum\count1<0 \signtrue
 \count1=-\count1\else \signfalse\fi
 \loop\ifnum\count1>6284\twopimod\repeat
 \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
 \multiply\count3 by\count0
 \divide\count1 by1000
 \advance\count1 by\count2
 \divide\count1 by1000
 \advance\count1 by\count3
 \advance\count1 by #4}
\def\fac#1{\multiply\count4  by #1
 \advance\count6  by\count4}
\def\id{\count4=\count1}  % Identity
}
\ProcessOptions
\newif\ifleapyear
\newcounter{date}
\newcounter{weekd}
\newcounter{Year}
\newcounter{yearbase}
\newcounter{Month}
\newcounter{Day}
\newcounter{catch}
\newcounter{timezone}
\def\theyear{19\the\c@Year}
\def\theday{\the\c@Day}
\setcounter{timezone}{0}
\def\setyear#1{\c@Year=#1
 \advance\c@Year by-1900\calculateyearbase}
\def\nextyear{\advance\c@Year by1
 \calculateyearbase}
\def\settimezone#1{\c@timezone=#1
 \multiply\c@timezone by 1000
 \divide\c@timezone by24}
\def\calculateyearbase{%
 \c@yearbase=-1
 {\count0=\c@Year\divide\count0 by4
 \multiply\count0 by4
 \ifnum\c@Year=\count0
 \global\c@catch=0\else\global\c@catch=1\fi}%
 \ifcase\c@catch \leapyeartrue\or
  \leapyearfalse\fi
 {\count0=\c@Year\multiply\count0
 by1461\advance\count0 by3
 \divide\count0 by4
 \global\c@catch=\count0}%
 \advance\c@yearbase by\c@catch
 \ifnum\c@Year=0\c@yearbase=0\leapyearfalse\fi}
\def\monthdays{\global
 \c@catch=\ifcase\c@Month 0\or31\or
  59\or90\or120\or151\or181\or212\or
  243\or273\or304\or334\or365\fi
 {\ifleapyear\ifnum\c@Month>1
  \global\advance\c@catch by1\fi\fi}%
 \c@Day=\c@catch}
\def\dayno{\c@date=\c@Day{\advance
 \c@Month by-1\monthdays
 \advance\c@date by\c@Day
 \global\advance\c@date by\c@yearbase}}
\def\weekday{{\count0=\c@date\relax
 \count1=\count0\divide\count0 by 7
 \multiply\count0 by 7
\advance\count1 by -\count0
 \global\c@weekd=\count1}}
\def\theweekday{\weekday
 \ifcase\c@weekd
 Sunday\or Monday\or Tuesday\or
 Wednesday\or Thursday\or Friday\or
 Saturday\fi}
\def\theshortweekday{\weekday
 \ifcase\c@weekd Sun\or Mon\or Tue\or
  Wed\or Thu\or Fri\or Sat\fi}
\def\caldate{\c@Year=\c@date
 \multiply\c@Year by4\divide\c@Year by1461
 \calculateyearbase
 {\advance\c@date by-\c@yearbase\c@Month=0
 \loop\monthdays\ifnum\c@Day<\c@date
 \global\advance\c@Month by1\repeat
 {\advance\c@Month by-1\monthdays
 \advance\c@date by-\c@Day
 \global\c@Day=\c@date}}}
\def\themonth{\ifcase\c@Month
 \or January\or February\or March\or
 April\or May\or June\or July\or
 August\or September\or October\or
 November\or December\fi}
\def\nextday#1{{\count0=#1\weekday
 \advance\count0 by-\c@weekd
 \ifnum\count0<0\advance\count0 by7\fi
 \global\advance\c@date by\count0}}
\def\prevday#1{\snextday#1
 \advance\c@date by-7}
\def\snextday#1{\advance\c@date by1
 \nextday#1}
\def\sprevday#1{\advance\c@date by-1
 \prevday#1}
\newwrite\evefile
\def\beginevents{%
 \immediate\openout
 \evefile=\jobname.eve\relax}
\def\endevents{\immediate\closeout
 \evefile\end}
\newtoks\evetext
\def\event#1/#2[#3]{\evetext={#3}%
 \c@Day=#1\c@Month=#2\dayno
 \evday[\the\evetext]}
\def\evday[#1]{\immediate\write\evefile{%
 \string\evententry{\the\c@date}{#1}}}
\def\thecaldate{\the\c@Day/\the\c@Month}
\def\mute{\def\thecaldate{}}
\newcount\currentdate
\newcount\lastdate
\newcount\nextdate
\newif\ifdoing@day
\newif\ifholy
\def\holy{\global\holytrue}
\def\upto#1{\nextdate=#1
 \loop\advance\currentdate by1\relax
  \ifnum\currentdate<\nextdate
  \begin@day\end@day\repeat}
\def\evententry#1#2{\unskip
 \ifnum#1>\lastdate\else
  \ifnum\currentdate<#1
   \ifdoing@day\end@day\fi
  \upto{#1}\fi
 \ifnum\currentdate=#1
  \ifdoing@day\else\begin@day\fi
  #2\par\fi\fi}
\def\begin@day{\doing@daytrue
 \c@date=\currentdate\caldate
 \message{<\thecaldate}\beginday}
\def\end@day{\endday\doing@dayfalse
 \global\holyfalse\message{>}}
\def\makeagenda#1{\input #1.sty\relax
 \begin@day\input\jobname.eve\relax
 \evententry{\the\lastdate}{}\end@day
 \epilog\end}
\def\makeempty{\begin@day
 \evententry{\the\lastdate}{}\end@day}
\def\ParseDate#1{\@ParseDate#1\end}
\def\@ParseDate#1/#2/#3\end{\setyear{#1}\c@Month=#2\c@Day=#3\dayno}
\def\everyday#1#2#3{\ParseDate{#1}\currentdate=\c@date%
  \ParseDate{#2}\lastdate=\c@date%
  \def\beginday{#3}%
  \def\endday{}\makeempty}
\endinput
%% 
%% End of file `calendar.sty'.
