def print_calendar(year, month)
first = Date.new(year, month, 1)
end_of_month = ((first >> 1) - 1).day
start = 6 - first.wday
work_date = AlmanacDateTime.new(year,month,1,12,0,0,Rational(3,8))
oriental_zodiac = AlmanacOrientalZodiac.new
oriental_zodiac_year \
= AlmanacOrientalZodiac::ORIENTAL_ZODIAC_NAME_J[
oriental_zodiac.get_oriental_zodiac_of_year_number(work_date)]
oriental_zodiac_month \
= AlmanacOrientalZodiac::ORIENTAL_ZODIAC_NAME_J[
oriental_zodiac.get_oriental_zodiac_of_month_number(work_date)]
Curses::init_screen
title_string = " " + year.to_s + "年(" + oriental_zodiac_year + ") " \
+ month.to_s + "月(" + oriental_zodiac_month + ") " + "\n"
Curses::addstr(title_string)
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
work_oriental_zodiac_string \
= AlmanacOrientalZodiac::ORIENTAL_ZODIAC_NAME_J[
oriental_zodiac.get_oriental_zodiac_of_day_number(work_date)] + " "
oriental_zodiac_buf << work_oriental_zodiac_string
work_date = work_date + 1
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