comparison lisp/calendar/cal-french.el @ 1338:3ea4e9dc49b2

Dox fixes.
author Richard M. Stallman <rms@gnu.org>
date Mon, 05 Oct 1992 06:25:46 +0000
parents 2619b7a9c11e
children 2c7997f249eb
comparison
equal deleted inserted replaced
1337:ab589b426055 1338:3ea4e9dc49b2
69 (zerop (% year 4)) 69 (zerop (% year 4))
70 (not (memq (% year 400) '(100 200 300))) 70 (not (memq (% year 400) '(100 200 300)))
71 (not (zerop (% year 4000)))))) 71 (not (zerop (% year 4000))))))
72 72
73 (defun french-calendar-last-day-of-month (month year) 73 (defun french-calendar-last-day-of-month (month year)
74 "Last day of MONTH, YEAR on the French Revolutionary calendar. 74 "Return last day of MONTH, YEAR on the French Revolutionary calendar.
75 The 13th month is not really a month, but the 5 (6 in leap years) day period of 75 The 13th month is not really a month, but the 5 (6 in leap years) day period of
76 `sansculottides' at the end of the year." 76 `sansculottides' at the end of the year."
77 (if (< month 13) 77 (if (< month 13)
78 30 78 30
79 (if (french-calendar-leap-year-p year) 79 (if (french-calendar-leap-year-p year)
80 6 80 6
81 5))) 81 5)))
82 82
83 (defun calendar-absolute-from-french (date) 83 (defun calendar-absolute-from-french (date)
84 "Absolute date of French Revolutionary DATE. 84 "Compute absolute date from French Revolutionary date DATE.
85 The absolute date is the number of days elapsed since the (imaginary) 85 The absolute date is the number of days elapsed since the (imaginary)
86 Gregorian date Sunday, December 31, 1 BC." 86 Gregorian date Sunday, December 31, 1 BC."
87 (let ((month (extract-calendar-month date)) 87 (let ((month (extract-calendar-month date))
88 (day (extract-calendar-day date)) 88 (day (extract-calendar-day date))
89 (year (extract-calendar-year date))) 89 (year (extract-calendar-year date)))
99 (* 30 (1- month));; Days in prior months this year 99 (* 30 (1- month));; Days in prior months this year
100 day;; Days so far this month 100 day;; Days so far this month
101 654414)));; Days before start of calendar (September 22, 1792). 101 654414)));; Days before start of calendar (September 22, 1792).
102 102
103 (defun calendar-french-from-absolute (date) 103 (defun calendar-french-from-absolute (date)
104 "Compute the French Revolutionary date (month day year) corresponding to 104 "Compute the French Revolutionary equivalent for absolute date DATE.
105 absolute DATE. The absolute date is the number of days elapsed since the 105 The result is a list of the form (MONTH DAY YEAR).
106 The absolute date is the number of days elapsed since the
106 (imaginary) Gregorian date Sunday, December 31, 1 BC." 107 (imaginary) Gregorian date Sunday, December 31, 1 BC."
107 (if (< date 654415) 108 (if (< date 654415)
108 (list 0 0 0);; pre-French Revolutionary date 109 (list 0 0 0);; pre-French Revolutionary date
109 (let* ((approx (/ (- date 654414) 366));; Approximation from below. 110 (let* ((approx (/ (- date 654414) 366));; Approximation from below.
110 (year ;; Search forward from the approximation. 111 (year ;; Search forward from the approximation.
124 (- date 125 (- date
125 (1- (calendar-absolute-from-french (list month 1 year)))))) 126 (1- (calendar-absolute-from-french (list month 1 year))))))
126 (list month day year)))) 127 (list month day year))))
127 128
128 (defun calendar-print-french-date () 129 (defun calendar-print-french-date ()
129 "Show the French Revolutionary calendar equivalent of the date under the 130 "Show the French Revolutionary calendar equivalent of the selected date."
130 cursor."
131 (interactive) 131 (interactive)
132 (let* ((french-date (calendar-french-from-absolute 132 (let* ((french-date (calendar-french-from-absolute
133 (calendar-absolute-from-gregorian 133 (calendar-absolute-from-gregorian
134 (or (calendar-cursor-to-date) 134 (or (calendar-cursor-to-date)
135 (error "Cursor is not on a date!"))))) 135 (error "Cursor is not on a date!")))))
147 (aref french-calendar-day-name-array (% (1- d) 10)) 147 (aref french-calendar-day-name-array (% (1- d) 10))
148 (aref french-calendar-month-name-array (1- m)) 148 (aref french-calendar-month-name-array (1- m))
149 y))))) 149 y)))))
150 150
151 (defun calendar-goto-french-date (date &optional noecho) 151 (defun calendar-goto-french-date (date &optional noecho)
152 "Move cursor to French Revolutionary DATE. 152 "Move cursor to French Revolutionary date DATE.
153 Echo French Revolutionary date unless NOECHO is t." 153 Echo French Revolutionary date unless NOECHO is t."
154 (interactive 154 (interactive
155 (let* ((year (calendar-read 155 (let* ((year (calendar-read
156 "Anne'e de la Revolution (>0): " 156 "Anne'e de la Revolution (>0): "
157 '(lambda (x) (> x 0)) 157 '(lambda (x) (> x 0))