]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/cal-mayan.el
(quail-update-leim-list-file): Fix message syntax.
[gnu-emacs] / lisp / calendar / cal-mayan.el
index f1c508a22c2c4fb78b7bf0d38fb90080aebb93c7..6ebc5b2e944a08f0b603ec9e52fff0b8d172ab4e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cal-mayan.el --- calendar functions for the Mayan calendars.
 
-;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
 
 ;; Author: Stewart M. Clamen <clamen@cs.cmu.edu>
 ;;     Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -9,20 +9,20 @@
 
 ;; This file is part of GNU Emacs.
 
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
 ;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY.  No author or distributor
-;; accepts responsibility to anyone for the consequences of using it
-;; or for whether it serves any particular purpose or works at all,
-;; unless he says so in writing.  Refer to the GNU Emacs General Public
-;; License for full details.
-
-;; Everyone is granted permission to copy, modify and redistribute
-;; GNU Emacs, but only under the conditions described in the
-;; GNU Emacs General Public License.   A copy of this license is
-;; supposed to have been given to you along with GNU Emacs so you
-;; can know your rights and responsibilities.  It should be in a
-;; file named COPYING.  Among other things, the copyright notice
-;; and this notice must be preserved on all copies.
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
@@ -44,6 +44,8 @@
 ;; Comments, improvements, and bug reports should be sent to Reingold.
 
 ;; Technical details of the Mayan calendrical calculations can be found in
+;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
+;; Cambridge University Press (1997), and in
 ;; ``Calendrical Calculations, Part II: Three Historical Calendars''
 ;; by E. M. Reingold,  N. Dershowitz, and S. M. Clamen,
 ;; Software--Practice and Experience, Volume 23, Number 4 (April, 1993),
 
 (require 'calendar)
 
-(defun mayan-adjusted-mod (m n)
-  "Non-negative remainder of M/N with N instead of 0."
-  (1+ (mod (1- m) n)))
-
-(defconst calendar-mayan-days-before-absolute-zero 1137140
+(defconst calendar-mayan-days-before-absolute-zero 1137142
   "Number of days of the Mayan calendar epoch before absolute day 0.
-According to the Goodman-Martinez-Thompson correlation.  This correlation is
-not universally accepted, as it still a subject of astro-archeological
-research.  Using 1232041 will give you the correlation used by Spinden.")
+This is the Goodman-Martinez-Thompson correlation used by almost all experts,
+but some use 1137140.  Using 1232041 gives you Spinden's correlation; using
+1142840 gives you Hochleitner's correlation.")
 
 (defconst calendar-mayan-haab-at-epoch '(8 . 18)
   "Mayan haab date at the epoch.")
@@ -175,10 +173,10 @@ Echo Mayan date if NOECHO is t."
 (defun calendar-mayan-tzolkin-from-absolute (date)
   "Convert absolute DATE into a Mayan tzolkin date (a pair)."
   (let* ((long-count (+ date calendar-mayan-days-before-absolute-zero))
-         (day (mayan-adjusted-mod
+         (day (calendar-mod
                (+ long-count (car calendar-mayan-tzolkin-at-epoch))
                13))
-         (name (mayan-adjusted-mod
+         (name (calendar-mod
                 (+ long-count (cdr calendar-mayan-tzolkin-at-epoch))
                 20)))
     (cons day name)))
@@ -286,7 +284,7 @@ Returns nil if such a tzolkin-haab combination is impossible."
 
 (defun calendar-next-calendar-round-date
   (tzolkin-date haab-date &optional noecho)
-  "Move cursor to next instance of Mayan HAAB-DATE TZOKLIN-DATE combination.
+  "Move cursor to next instance of Mayan HAAB-DATE TZOLKIN-DATE combination.
 Echo Mayan date if NOECHO is t."
   (interactive (list (calendar-read-mayan-tzolkin-date)
                      (calendar-read-mayan-haab-date)))
@@ -303,7 +301,7 @@ Echo Mayan date if NOECHO is t."
 
 (defun calendar-previous-calendar-round-date
   (tzolkin-date haab-date &optional noecho)
-  "Move to previous instance of Mayan TZOKLIN-DATE HAAB-DATE combination.
+  "Move to previous instance of Mayan TZOLKIN-DATE HAAB-DATE combination.
 Echo Mayan date if NOECHO is t."
   (interactive (list (calendar-read-mayan-tzolkin-date)
                      (calendar-read-mayan-haab-date)))