----Next_Part(Sun_Mar_22_23:26:07_1998_30)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
ふなばです。
英国以外での改暦にも対応したカレンダーです。デフォルトでは英国のカレン
ダーになりますが、国コードの指定で切り換えることができます。国コードで
の指定というのはいささか無理があるような気もしますが (歴史的なことです
から)、 あまり細いことをいっていてもしょうがないのでいいでしょう。改暦
の日付のようなものはなかなか資料がなくて難しいのですが、僕が勝手に信用
できだと思ったものを載せました。
印字のサンプル
### -c de 2 1700 ### ### -c de 3 1700 ### ### -c de 4 1700 ###
February 1700 March 1700 April 1700
S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
1 2 3 1 2 3 4 5 6 1 2 3
4 5 6 7 8 9 10 7 8 9 10 11 12 13 4 5 6 7 8 9 10
11 12 13 14 15 16 17 14 15 16 17 18 19 20 11 12 13 14 15 16 17
18 21 22 23 24 25 26 27 18 19 20 21 22 23 24
28 29 30 31 25 26 27 28 29 30
### -c gb 8 1752 ### ### -c gb 9 1752 ### ### -c gb 10 1752 ###
August 1752 September 1752 October 1752
S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
1 1 2 14 15 16 1 2 3 4 5 6 7
2 3 4 5 6 7 8 17 18 19 20 21 22 23 8 9 10 11 12 13 14
9 10 11 12 13 14 15 24 25 26 27 28 29 30 15 16 17 18 19 20 21
16 17 18 19 20 21 22 22 23 24 25 26 27 28
23 24 25 26 27 28 29 29 30 31
30 31
### -c it 9 1582 ### ### -c it 10 1582 ### ### -c it 11 1582 ###
September 1582 October 1582 November 1582
S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
1 1 2 3 4 15 16 1 2 3 4 5 6
2 3 4 5 6 7 8 17 18 19 20 21 22 23 7 8 9 10 11 12 13
9 10 11 12 13 14 15 24 25 26 27 28 29 30 14 15 16 17 18 19 20
16 17 18 19 20 21 22 31 21 22 23 24 25 26 27
23 24 25 26 27 28 29 28 29 30
30
### -c ru 1 1918 ### ### -c ru 2 1918 ### ### -c ru 3 1918 ###
January 1918 February 1918 March 1918
S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S
1 2 3 4 5 6 14 15 16 1 2
7 8 9 10 11 12 13 17 18 19 20 21 22 23 3 4 5 6 7 8 9
14 15 16 17 18 19 20 24 25 26 27 28 10 11 12 13 14 15 16
21 22 23 24 25 26 27 17 18 19 20 21 22 23
28 29 30 31 24 25 26 27 28 29 30
31
--Tadayoshi Funaba
----Next_Part(Sun_Mar_22_23:26:07_1998_30)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: cal.rb
#! /usr/local/bin/ruby
# cal.rb: Written by Tadayoshi Funaba 1998
# $Id: cal.rb,v 1.1 1998/03/21 12:35:27 tadf Exp $
require 'date2'
$tab {
'cn' true, # China
'de' 2342032, # Germany (protestant states)
'dk' 2342032, # Denmark
'es' 2299161, # Spain
'fi' 2361390, # Finland
'fr' 2299227, # France
'gb' 2361222, # United Kingdom
'gr' 2423868, # Greece
'hu' 2301004, # Hungary
'it' 2299161, # Italy
'jp' true, # Japan
'no' 2342032, # Norway
'pl' 2299161, # Poland
'pt' 2299161, # Portugal
'ru' 2421639, # Russia
'se' 2361390, # Sweden
'us' 2361222, # United States
'os' false, # (old style)
'ns' true # (new style)
}
$cc gb'
def usage
$stderr.puts 'usage: cal [-c iso3166] [month [year]]'
exit 1
end
def cal(m, y, gs)
for d in 1..31
begin
fst ur ate.new3(y, m, d, gs)
break
rescue
end
end
puts ((Date::MONTHNAMES[m] + ' ' + y.to_s).center 20)
puts ' S M Tu W Th F S'
print ' ' * (3 * fst.wday)
while cur.mon m
print cur.mday.to_s.rjust 2
print (if (cur + ).wday ! then "\s" else "\n" end)
end
print "\n" * (6 - ((fst.wday + (cur - fst)) / 7))
end
while /^-(.*)$/no $*[0]
if /^c(.+)?$/no $1 then
if $1 then
$cc 1.downcase
elsif $*.length > then
$cc *[1].downcase
$*.shift
else
usage
end
else
usage
end
$*.shift
end
usage if $*.length > 2
usage if (gs tab[$cc]).nil?
now ime.now
m ow.mon
y ow.year
m *[0].to_i if $*.length >
y *[1].to_i if $*.length >
usage unless (1..12) m
usage unless y > 4712
cal(m, y, gs)
----Next_Part(Sun_Mar_22_23:26:07_1998_30)----