;ELC ;;; compiled by kwzh@churchy.gnu.ai.mit.edu on Thu Feb 15 20:11:16 1996 ;;; from file /gd/gnu/emacs/19.0/lisp/cal-iso.el ;;; emacs version 19.30.91.1. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`cal-iso.el' was compiled for Emacs 19.29 or later")) (require (quote calendar)) #@503 The number of days elapsed between the Gregorian date 12/31/1 BC and DATE. The `ISO year' corresponds approximately to the Gregorian year, but weeks start on Monday and end on Sunday. The first week of the ISO year is the first such week in which at least 4 days are in a year. The ISO commercial DATE has the form (week day year) in which week is in the range 1..52 and day is in the range 0..6 (1 = Monday, 2 = Tuesday, ..., 0 = Sunday). The Gregorian date Sunday, December 31, 1 BC is imaginary. (defalias 'calendar-absolute-from-iso #[(date) "@)A@)AA@)ʼn EAA@)S@)A@)AA@)\nS_\\ V| _\\ͥZ ˦Us ϦU?s ЦU)| T  -_\\˥\\ϥ[\\Х\\*\\\" S_\\\nUԂ\nS\\+" [date week day year calendar-dayname-on-or-before 1 prior-years month 31 day-of-year 2 4 23 10 0 100 400 365 3 7 6] 8 (#$ . 505)]) #@549 Compute the `ISO commercial date' corresponding to the absolute DATE. The ISO year corresponds approximately to the Gregorian year, but weeks start on Monday and end on Sunday. The first week of the ISO year is the first such week in which at least 4 days are in a year. The ISO commercial date has the form (week day year) in which week is in the range 1..52 and day is in the range 0..6 (1 = Monday, 2 = Tuesday, ..., 0 = Sunday). The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC. (defalias 'calendar-iso-from-absolute #[(date) " Z!AA@) ȉTE!Y+ \\T *\\ ȉ E!ZʥT ʦ E*" [calendar-gregorian-from-absolute date 3 approx 0 sum y calendar-absolute-from-iso 1 year 7] 7 (#$ . 1380)]) #@86 String of ISO date of Gregorian DATE. Defaults to today's date if DATE is not given. (defalias 'calendar-iso-date-string #[(&optional date) " AA@)S@)A@)AA@)\f S_\\ Vb _\\˥Z ɦUY ͦU?Y ΦU)bT-\n_\\\nɥ\\\nͥ[\\\nΥ\\*Ѧ!\fUт\f@)AA@)$+" [date calendar-current-date prior-years month day year 31 day-of-year 2 4 23 10 0 100 400 365 d 7 calendar-iso-from-absolute iso-date format "Day %s of week %d of %d"] 6 (#$ . 2163)]) #@57 Show equivalent ISO date for the date under the cursor. (defalias 'calendar-print-iso-date #[nil "!!\"" [message "ISO date: %s" calendar-iso-date-string calendar-cursor-to-date t] 5 (#$ . 2670) nil]) #@60 Move cursor to ISO DATE; echo ISO date unless NOECHO is t. (defalias 'calendar-goto-iso-date #[(date &optional noecho) " !!!\f " [calendar-goto-date calendar-gregorian-from-absolute calendar-absolute-from-iso date noecho calendar-print-iso-date] 4 (#$ . 2882) (let* ((today (calendar-current-date)) (year (calendar-read "ISO calendar year (>0): " (quote (lambda (x) (> x 0))) (int-to-string (extract-calendar-year today)))) (no-weeks (extract-calendar-month (calendar-iso-from-absolute (1- (calendar-dayname-on-or-before 1 (calendar-absolute-from-gregorian (list 1 4 (1+ year)))))))) (week (calendar-read (format "ISO calendar week (1-%d): " no-weeks) (quote (lambda (x) (and (> x 0) (<= x no-weeks)))))) (day (calendar-read "ISO day (1-7): " (quote (lambda (x) (and (<= 1 x) (<= x 7))))))) (list (list week day year)))]) #@46 ISO calendar equivalent of date diary entry. (defalias 'diary-iso-date #[nil " !\"" [format "ISO date: %s" calendar-iso-date-string date] 4 (#$ . 3719)]) (provide (quote cal-iso))