;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:37:05 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/calendar/cal-iso.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (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 '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) "\211@)\211A@)\211AA@)\306\307\211\211E\211\211AA@)S\310!\311!\312!\n\313S_\\\314V\203X \315\316_\\\317\245Z\320!\203X T-\f\321_\\\f\316\245\\\f\322\245[\\\f\323\245\\*\324\\\"	S\325_\\\n\326U\203 \327\202\201 \nS\\+\207" [date week day year prior-years month calendar-dayname-on-or-before 1 extract-calendar-month extract-calendar-day extract-calendar-year 31 2 23 4 10 calendar-leap-year-p 365 100 400 3 7 0 6 day-of-year] 7 (#$ . 646)])
#@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) "\305\306Z!\211AA@)\211\211\307\310\311\211TE!Y\203& \nTT\202 \n*\\\310\311\211\fE!Z\312\245T\312\246\fE*\207" [date approx sum y year calendar-gregorian-from-absolute 3 0 calendar-absolute-from-iso 1 7] 7 (#$ . 1680)])
#@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) "\206 \305 \306!S\307!\310	_\\	\311\245\\	\312\245[\\	\313\245\\*\211\314\246\315\n!\316\317\320!\2036 \314\2027 \f\211@)\f\211AA@)$+\207" [date prior-years d day iso-date calendar-current-date extract-calendar-year calendar-day-number 365 4 100 400 7 calendar-iso-from-absolute format "Day %s of week %d of %d" zerop] 6 (#$ . 2515)])
#@57 Show equivalent ISO date for the date under the cursor.
(defalias 'calendar-print-iso-date #[nil "\300\301\302\303\304!!\"\207" [message "ISO date: %s" calendar-iso-date-string calendar-cursor-to-date t] 5 (#$ . 3009) nil])
#@60 Move cursor to ISO DATE; echo ISO date unless NOECHO is t.
(defalias 'calendar-goto-iso-date #[(date &optional noecho) "\302\303\304!!!\210	\206 \305 \207" [date noecho calendar-goto-date calendar-gregorian-from-absolute calendar-absolute-from-iso calendar-print-iso-date] 4 (#$ . 3239) (let* ((today (calendar-current-date)) (year (calendar-read "ISO calendar year (>0): " '(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) '(lambda (x) (and (> x 0) (<= x no-weeks))))) (day (calendar-read "ISO day (1-7): " '(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 "\301\302\303!\"\207" [date format "ISO date: %s" calendar-iso-date-string] 4 (#$ . 4075)])
(provide 'cal-iso)
