Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!reingold From: reingold@m.cs.uiuc.edu Newsgroups: comp.emacs Subject: Re: calendar.el Message-ID: <4300042@m.cs.uiuc.edu> Date: 4 Apr 89 13:24:00 GMT References: <4300041@m.cs.uiuc.edu> Lines: 84 Nf-ID: #R:m.cs.uiuc.edu:4300041:m.cs.uiuc.edu:4300042:000:3177 Nf-From: m.cs.uiuc.edu!reingold Apr 4 08:24:00 1989 It was reported to me that the message was too big and the last few lines were lost. A complete copy can be obtained by anonymous ftp from a.cs.uiuc.edu. In any case, here are the last few lines. (There is some overlap--check!) ---------------------------------------------------------------------- (defun hebrew-calendar-leap-year-p (year) "Returns t if YEAR+3761 is a leap year." (memq (years-into-hebrew-calendar-cycle year) (list 0 3 6 8 11 14 17))) (defun hebrew-calendar-long-heshvan-p (year) "Returns t if Heshvan is long in YEAR+3761." (if (hebrew-calendar-leap-year-p year) (= (- (hebrew-calendar-new-year-day (1+ year)) (hebrew-calendar-new-year-day year)) 385) (= (- (hebrew-calendar-new-year-day (1+ year)) (hebrew-calendar-new-year-day year)) 355))) (defun hebrew-calendar-short-kislev-p (year) "Returns t if Kislev is short in YEAR+3761." (if (hebrew-calendar-leap-year-p year) (= (- (hebrew-calendar-new-year-day (1+ year)) (hebrew-calendar-new-year-day year)) 383) (= (- (hebrew-calendar-new-year-day (1+ year)) (hebrew-calendar-new-year-day year)) 353))) (defun hebrew-calendar-last-day-of-month (month year) "The last day of MONTH in YEAR+3761." (if (or (memq month (list 2 4 6 10 13)) (and (= month 12) (not (hebrew-calendar-leap-year-p year))) (and (= month 8) (not (hebrew-calendar-long-heshvan-p year))) (and (= month 9) (hebrew-calendar-short-kislev-p year))) 29 30)) (defun hebrew-calendar-date-beyond-date (days month year) "Returns the Hebrew date that is DAYS beyond the start of MONTH, YEAR+3761. That date must be in the same year." (let ((len (hebrew-calendar-last-day-of-month month year))) (while (> days len) (setq days (- days len)) (setq month (1+ (% month (hebrew-calendar-last-month-of-year year)))) (setq len (hebrew-calendar-last-day-of-month month year)))) (list days month year)) (defun hebrew-calendar-days-from-tishri (days month year) "Number of days, inclusive, from 1 Tishri to DAYS, MONTH, YEAR+3761." (while (/= month 7) (setq month (if (= month 1) (hebrew-calendar-last-month-of-year year) (1- month))) (setq days (+ days (hebrew-calendar-last-day-of-month month year)))) days) (defun hebrew-calendar-year-length (year) "The number of days in Hebrew calendar YEAR+3761." (- (hebrew-calendar-new-year-day year) (hebrew-calendar-new-year-day (1- year)))) (defun hebrew-calendar-last-month-of-year (year) "The last month of the Hebrew calendar YEAR+3761." (if (hebrew-calendar-leap-year-p year) 13 12)) (defun calendar-absolute-from-hebrew (date) "Absolute date of Hebrew DATE. The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC." (let ((month (extract-calendar-month date)) (day (extract-calendar-day date)) (year (- (extract-calendar-year date) 3761))) (+ -1 (hebrew-calendar-new-year-day year) (hebrew-calendar-days-from-tishri day month year))))