def print_calendar(year, month)
first = Date.new(year, month, 1)
end_of_month = ((first >> 1) - 1).day
start = 6 - first.wday
Curses::init_screen
title_string = " " + year.to_s + "年 " + month.to_s + "月" + "\n"
Curses::addstr(title_string)
solar_term = AlmanacSolarTerm.new
setsu_no = 99
cyuu_no = 99
if 1 == month
setsu_no = 22
cyuu_no = 23
else
setsu_no = 2 * (month - 2)
cyuu_no = 2 * (month -2) + 1
end
setsu_day = solar_term.get_sekki_date_time(year, Rational(3,8), setsu_no).day
cyuu_day = solar_term.get_sekki_date_time(year, Rational(3,8), cyuu_no).day
Curses::addstr(" 日 月 火 水 木 金 土 " + "\n")
WEEK_TABLE.each{|week|
week_buf = ""
oriental_zodiac_buf = ""
week[start, 7].each{|day|
if day > end_of_month
week_buf << " "
oriental_zodiac_buf << " "
else
work_week = sprintf("%3d", day) + " "
week_buf << work_week
if day == setsu_day or day == cyuu_day
if day == setsu_day
work_solar_term_string \
= AlmanacSolarTerm::SOLAR_TERM_NAME_J[setsu_no].to_s + " "
elsif
work_solar_term_string \
= AlmanacSolarTerm::SOLAR_TERM_NAME_J[cyuu_no].to_s + " "
end
oriental_zodiac_buf << work_solar_term_string
else
oriental_zodiac_buf << " "
end
end
}
week_buf = week_buf +"\n"
Curses::addstr(week_buf)
oriental_zodiac_buf = oriental_zodiac_buf +"\n"
Curses::addstr(oriental_zodiac_buf)
}
Curses::refresh
Curses::getch
Curses::close_screen
end