diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:46:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:46:03 +0000 |
commit | 873660d1a83ece926fe7206288dda9c36b349c1b (patch) | |
tree | a48f77125c309a355b5d0eb58d6b24446abe9d62 /Master/texmf-dist/tex/generic/genmisc/dow.tex | |
parent | 2939242967231097459df0fc3150fabc2f639111 (diff) |
generic 1
git-svn-id: svn://tug.org/texlive/trunk@613 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc/dow.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/genmisc/dow.tex | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/dow.tex b/Master/texmf-dist/tex/generic/genmisc/dow.tex new file mode 100644 index 00000000000..ea504ba375b --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/dow.tex @@ -0,0 +1,44 @@ +%%%------------Start Cutting------------------------------------------ +% \dowcomp returns integer day of week in \dow with Sunday=0. +% \downame returns the name of the day of the week. +% E.g., if \year=1963 \month=11 \day=22, +% then \dowcomp ==> \dow=5 and \downame ==> Friday which happened +% to be the day President John F. Kennedy was assasinated. + +% Converted from the lisp function DOW by Jon L. White given in +% the file LIBDOC DOW JONL3 on MIT-MC (which follows). + +%(defun dow (year month day) +% (and (and (fixp year) (fixp month) (fixp day)) +% ((lambda (a) +% (declare (fixnum a)) +% (\ (+ (// (1- (* 13. (+ month 10. +% (* (// (+ month 10.) -13.) 12.)))) +% 5.) +% day +% 77. +% (// (* 5. (- a (* (// a 100.) 100.))) 4.) +% (// a -2000.) +% (// a 400.) +% (* (// a -100.) 2.)) +% 7.)) +% (+ year (// (+ month -14.) 12.))))) + +\newcount\dow +\def\dowcomp{{\count3 \month \advance\count3 -14 \divide\count3 12 + \advance\count3 \year \count4 \month \advance\count4 10 + \divide\count4 -13 \multiply\count4 12 \advance\count4 10 + \advance\count4 \month \multiply\count4 13 \advance\count4 -1 + \divide\count4 5 \advance\count4 \day \advance\count4 77 + \count2 \count3 \divide\count2 100 \multiply\count2 -100 + \advance\count2 \count3 \multiply\count2 5 \divide\count2 4 + \advance\count4 \count2 \count2 \count3 \divide\count2 -2000 + \advance\count4 \count2 \count2 \count3 \divide\count2 400 + \advance\count4 \count2 \count2 \count3 \divide\count2 -100 + \multiply\count2 2 \advance\count4 \count2 \count2 \count4 + \divide\count2 7 \multiply\count2 -7 \advance\count4 \count2 + \global\dow \count4}} + +\def\dayname{\dowcomp \ifcase\dow Sunday\or Monday\or Tuesday\or + Wednesday\or Thursday\or Friday\else Saturday\fi} +%%%--------------Stop cutting----------------------------------------- |