annotate lisp/calendar/cal-mayan.el @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents 376386a54a3c
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; cal-mayan.el --- calendar functions for the Mayan calendars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: Stewart M. Clamen <clamen@cs.cmu.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Edward M. Reingold <reingold@cs.uiuc.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Keywords: calendar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Human-Keywords: Mayan calendar, Maya, calendar, diary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
25 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; This collection of functions implements the features of calendar.el and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; diary.el that deal with the Mayan calendar. It was written jointly by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; Stewart M. Clamen School of Computer Science
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; clamen@cs.cmu.edu Carnegie Mellon University
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; 5000 Forbes Avenue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; Pittsburgh, PA 15213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; Edward M. Reingold Department of Computer Science
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; Urbana, Illinois 61801
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; Comments, improvements, and bug reports should be sent to Reingold.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; Technical details of the Mayan calendrical calculations can be found in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; ``Calendrical Calculations, Part II: Three Historical Calendars''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; by E. M. Reingold, N. Dershowitz, and S. M. Clamen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; Software--Practice and Experience, Volume 23, Number 4 (April, 1993),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; pages 383-404.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (require 'calendar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (defun mayan-adjusted-mod (m n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 "Non-negative remainder of M/N with N instead of 0."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (1+ (mod (1- m) n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defconst calendar-mayan-days-before-absolute-zero 1137140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "Number of days of the Mayan calendar epoch before absolute day 0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 According to the Goodman-Martinez-Thompson correlation. This correlation is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 not universally accepted, as it still a subject of astro-archeological
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 research. Using 1232041 will give you Spinden's correlation; using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 1142840 will give you Hochleitner's correlation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defconst calendar-mayan-haab-at-epoch '(8 . 18)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 "Mayan haab date at the epoch.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defconst calendar-mayan-haab-month-name-array
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ["Pop" "Uo" "Zip" "Zotz" "Tzec" "Xul" "Yaxkin" "Mol" "Chen" "Yax"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "Zac" "Ceh" "Mac" "Kankin" "Muan" "Pax" "Kayab" "Cumku"])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (defconst calendar-mayan-tzolkin-at-epoch '(4 . 20)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "Mayan tzolkin date at the epoch.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defconst calendar-mayan-tzolkin-names-array
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ["Imix" "Ik" "Akbal" "Kan" "Chicchan" "Cimi" "Manik" "Lamat" "Muluc" "Oc"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 "Chuen" "Eb" "Ben" "Ix" "Men" "Cib" "Caban" "Etznab" "Cauac" "Ahau"])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defun calendar-mayan-long-count-from-absolute (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 "Compute the Mayan long count corresponding to the absolute DATE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (let ((long-count (+ date calendar-mayan-days-before-absolute-zero)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (let* ((baktun (/ long-count 144000))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (remainder (% long-count 144000))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (katun (/ remainder 7200))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (remainder (% remainder 7200))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (tun (/ remainder 360))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (remainder (% remainder 360))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (uinal (/ remainder 20))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (kin (% remainder 20)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (list baktun katun tun uinal kin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defun calendar-mayan-long-count-to-string (mayan-long-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 "Convert MAYAN-LONG-COUNT into traditional written form."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (apply 'format (cons "%s.%s.%s.%s.%s" mayan-long-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (defun calendar-string-to-mayan-long-count (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 "Given STR, a string of format \"%d.%d.%d.%d.%d\", return list of nums."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (let ((rlc nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (c (length str))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (cc 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (condition-case condition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (while (< cc c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (let* ((start (string-match "[0-9]+" str cc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (end (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 datum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (setq datum (read (substring str start end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (setq rlc (cons datum rlc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (setq cc end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (if (not (= (length rlc) 5)) (signal 'invalid-read-syntax nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (invalid-read-syntax nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (reverse rlc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (defun calendar-mayan-haab-from-absolute (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "Convert absolute DATE into a Mayan haab date (a pair)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (let* ((long-count (+ date calendar-mayan-days-before-absolute-zero))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (day-of-haab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (% (+ long-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (car calendar-mayan-haab-at-epoch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (* 20 (1- (cdr calendar-mayan-haab-at-epoch))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 365))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (day (% day-of-haab 20))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (month (1+ (/ day-of-haab 20))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (cons day month)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (defun calendar-mayan-haab-difference (date1 date2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 "Number of days from Mayan haab DATE1 to next occurrence of haab date DATE2."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (mod (+ (* 20 (- (cdr date2) (cdr date1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (- (car date2) (car date1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 365))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (defun calendar-mayan-haab-on-or-before (haab-date date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 "Absolute date of latest HAAB-DATE on or before absolute DATE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (- date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (% (- date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (calendar-mayan-haab-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (calendar-mayan-haab-from-absolute 0) haab-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 365)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (defun calendar-next-haab-date (haab-date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 "Move cursor to next instance of Mayan HAAB-DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 Echo Mayan date if NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (interactive (list (calendar-read-mayan-haab-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (calendar-goto-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (calendar-mayan-haab-on-or-before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 haab-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (+ 365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (calendar-absolute-from-gregorian (calendar-cursor-to-date))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (or noecho (calendar-print-mayan-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (defun calendar-previous-haab-date (haab-date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 "Move cursor to previous instance of Mayan HAAB-DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 Echo Mayan date if NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (interactive (list (calendar-read-mayan-haab-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (calendar-goto-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (calendar-mayan-haab-on-or-before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 haab-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (1- (calendar-absolute-from-gregorian (calendar-cursor-to-date))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (or noecho (calendar-print-mayan-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defun calendar-mayan-haab-to-string (haab)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "Convert Mayan haab date (a pair) into its traditional written form."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (let ((month (cdr haab))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (day (car haab)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; 19th month consists of 5 special days
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (if (= month 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (format "%d Uayeb" day)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (format "%d %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (aref calendar-mayan-haab-month-name-array (1- month))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (defun calendar-mayan-tzolkin-from-absolute (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 "Convert absolute DATE into a Mayan tzolkin date (a pair)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (let* ((long-count (+ date calendar-mayan-days-before-absolute-zero))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (day (mayan-adjusted-mod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (+ long-count (car calendar-mayan-tzolkin-at-epoch))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 13))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (name (mayan-adjusted-mod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (+ long-count (cdr calendar-mayan-tzolkin-at-epoch))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 20)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (cons day name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (defun calendar-mayan-tzolkin-difference (date1 date2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "Number of days from Mayan tzolkin DATE1 to next occurrence of tzolkin DATE2."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (let ((number-difference (- (car date2) (car date1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (name-difference (- (cdr date2) (cdr date1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (mod (+ number-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (* 13 (mod (* 3 (- number-difference name-difference))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 20)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 260)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (defun calendar-mayan-tzolkin-on-or-before (tzolkin-date date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "Absolute date of latest TZOLKIN-DATE on or before absolute DATE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (- date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (% (- date (calendar-mayan-tzolkin-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (calendar-mayan-tzolkin-from-absolute 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 tzolkin-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 260)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (defun calendar-next-tzolkin-date (tzolkin-date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "Move cursor to next instance of Mayan TZOLKIN-DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 Echo Mayan date if NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (interactive (list (calendar-read-mayan-tzolkin-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (calendar-goto-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (calendar-mayan-tzolkin-on-or-before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 tzolkin-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (+ 260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (calendar-absolute-from-gregorian (calendar-cursor-to-date))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (or noecho (calendar-print-mayan-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (defun calendar-previous-tzolkin-date (tzolkin-date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 "Move cursor to previous instance of Mayan TZOLKIN-DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Echo Mayan date if NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (interactive (list (calendar-read-mayan-tzolkin-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (calendar-goto-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (calendar-mayan-tzolkin-on-or-before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 tzolkin-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (1- (calendar-absolute-from-gregorian (calendar-cursor-to-date))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (or noecho (calendar-print-mayan-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (defun calendar-mayan-tzolkin-to-string (tzolkin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 "Convert Mayan tzolkin date (a pair) into its traditional written form."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (format "%d %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (car tzolkin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (aref calendar-mayan-tzolkin-names-array (1- (cdr tzolkin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (defun calendar-mayan-tzolkin-haab-on-or-before (tzolkin-date haab-date date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 "Absolute date that is Mayan TZOLKIN-DATE and HAAB-DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 Latest such date on or before DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 Returns nil if such a tzolkin-haab combination is impossible."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (let* ((haab-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (calendar-mayan-haab-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (calendar-mayan-haab-from-absolute 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 haab-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (tzolkin-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (calendar-mayan-tzolkin-difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (calendar-mayan-tzolkin-from-absolute 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 tzolkin-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (difference (- tzolkin-difference haab-difference)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (if (= (% difference 5) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (- date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (mod (- date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (+ haab-difference (* 365 difference)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 18980))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defun calendar-read-mayan-haab-date ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "Prompt for a Mayan haab date"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (let* ((completion-ignore-case t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (haab-day (calendar-read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "Haab kin (0-19): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 '(lambda (x) (and (>= x 0) (< x 20)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (haab-month-list (append calendar-mayan-haab-month-name-array
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (and (< haab-day 5) '("Uayeb"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (haab-month (cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (assoc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (capitalize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (completing-read "Haab uinal: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (mapcar 'list haab-month-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (calendar-make-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 haab-month-list 1 'capitalize)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (cons haab-day haab-month)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (defun calendar-read-mayan-tzolkin-date ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 "Prompt for a Mayan tzolkin date"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (let* ((completion-ignore-case t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (tzolkin-count (calendar-read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "Tzolkin kin (1-13): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 '(lambda (x) (and (> x 0) (< x 14)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (tzolkin-name-list (append calendar-mayan-tzolkin-names-array nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (tzolkin-name (cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (assoc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (capitalize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (completing-read "Tzolkin uinal: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (mapcar 'list tzolkin-name-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (calendar-make-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 tzolkin-name-list 1 'capitalize)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (cons tzolkin-count tzolkin-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (defun calendar-next-calendar-round-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (tzolkin-date haab-date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 "Move cursor to next instance of Mayan HAAB-DATE TZOKLIN-DATE combination.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 Echo Mayan date if NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (interactive (list (calendar-read-mayan-tzolkin-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (calendar-read-mayan-haab-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (let ((date (calendar-mayan-tzolkin-haab-on-or-before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 tzolkin-date haab-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (+ 18980 (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (calendar-cursor-to-date))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (if (not date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (error "%s, %s does not exist in the Mayan calendar round"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (calendar-mayan-tzolkin-to-string tzolkin-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (calendar-mayan-haab-to-string haab-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (calendar-goto-date (calendar-gregorian-from-absolute date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (or noecho (calendar-print-mayan-date)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (defun calendar-previous-calendar-round-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (tzolkin-date haab-date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 "Move to previous instance of Mayan TZOKLIN-DATE HAAB-DATE combination.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 Echo Mayan date if NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (interactive (list (calendar-read-mayan-tzolkin-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (calendar-read-mayan-haab-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (let ((date (calendar-mayan-tzolkin-haab-on-or-before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 tzolkin-date haab-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (1- (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (calendar-cursor-to-date))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (if (not date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (error "%s, %s does not exist in the Mayan calendar round"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (calendar-mayan-tzolkin-to-string tzolkin-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (calendar-mayan-haab-to-string haab-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (calendar-goto-date (calendar-gregorian-from-absolute date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (or noecho (calendar-print-mayan-date)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (defun calendar-absolute-from-mayan-long-count (c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 "Compute the absolute date corresponding to the Mayan Long Count C.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 Long count is a list (baktun katun tun uinal kin)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (+ (* (nth 0 c) 144000) ; baktun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (* (nth 1 c) 7200) ; katun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (* (nth 2 c) 360) ; tun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (* (nth 3 c) 20) ; uinal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (nth 4 c) ; kin (days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (- ; days before absolute date 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 calendar-mayan-days-before-absolute-zero)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (defun calendar-mayan-date-string (&optional date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 "String of Mayan date of Gregorian DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 Defaults to today's date if DATE is not given."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (let* ((d (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (or date (calendar-current-date))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (tzolkin (calendar-mayan-tzolkin-from-absolute d))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (haab (calendar-mayan-haab-from-absolute d))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (long-count (calendar-mayan-long-count-from-absolute d)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (format "Long count = %s; tzolkin = %s; haab = %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (calendar-mayan-long-count-to-string long-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (calendar-mayan-tzolkin-to-string tzolkin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (calendar-mayan-haab-to-string haab))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (defun calendar-print-mayan-date ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 "Show the Mayan long count, tzolkin, and haab equivalents of date."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (message "Mayan date: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (calendar-mayan-date-string (calendar-cursor-to-date t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (defun calendar-goto-mayan-long-count-date (date &optional noecho)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "Move cursor to Mayan long count DATE. Echo Mayan date unless NOECHO is t."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (let (lc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (while (not lc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (let ((datum
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (calendar-string-to-mayan-long-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (read-string "Mayan long count (baktun.katun.tun.uinal.kin): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (calendar-mayan-long-count-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (calendar-mayan-long-count-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (calendar-current-date))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (if (calendar-mayan-long-count-common-era datum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (setq lc datum))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (list lc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (calendar-goto-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (calendar-absolute-from-mayan-long-count date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (or noecho (calendar-print-mayan-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (defun calendar-mayan-long-count-common-era (lc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 "T if long count represents date in the Common Era."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (let ((base (calendar-mayan-long-count-from-absolute 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (while (and (not (null base)) (= (car lc) (car base)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq lc (cdr lc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 base (cdr base)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (or (null lc) (> (car lc) (car base)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defun diary-mayan-date ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 "Show the Mayan long count, haab, and tzolkin dates as a diary entry."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (format "Mayan date: %s" (calendar-mayan-date-string date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (provide 'cal-mayan)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;;; cal-mayan.el ends here