カレンダー操作プログラム [詳細]
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "number_set.h"
関数 | |
int | judge_month (int year, int month, char holiday_name[HOLY_MAX][HOLY_NAME], int holiday_days[HOLY_MAX]) |
void | month_print_calendar (int year, int month) |
void | month_print_calendar_today (int year, int month, int day) |
void | input_year_cal (int year) |
void | input_fiscal_cal (int year) |
DAY_DATE | get_today () |
void | row_calendar_main (int cal_buf[COL_CAL][WEEK_ROW][WEEK_COL], int week_max, int holiday_num[COL_CAL][HOLY_MAX]) |
void | row_calendar_main_today (int cal_buf[COL_CAL][WEEK_ROW][WEEK_COL], int week_max, int holiday_num[COL_CAL][HOLY_MAX], int month, int day, int arr_month[COL_CAL]) |
void | input_ym_three (int year, int month) |
void | input_ym_three_today (int year, int month, DAY_DATE today) |
void | print_calendar_three (int year[COL_CAL], int month[COL_CAL]) |
void | make_array (int arr_year[COL_CAL], int arr_month[COL_CAL], int year, int month) |
void | row_holiday (char holiday_name[COL_CAL][HOLY_MAX][HOLY_NAME], int hol_max) |
void | this_month_cal () |
void | next_month_cal () |
void | before_month_cal () |
void | this_year_cal () |
void | next_year_cal () |
void | before_year_cal () |
void | this_fiscal_cal () |
void | next_fiscal_cal () |
void | before_fiscal_cal () |
void | this_three_month () |
カレンダー操作プログラム
void before_fiscal_cal | ( | ) |
機能
前年度のカレンダーを表示する
処理詳細
(1) システム上の年と月を取得する
(2) 年をマイナス1する。 (3) 取得した月が1月〜3月の間であったら、年を1年マイナス
(4) 取得した年をinput_year_cal関数で処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数get_today<br? ファイルopreate_calendar.c内 関数input_fiscal_cal
void before_month_cal | ( | ) |
機能
先月のカレンダーを表示する
処理詳細
(1) システム上の年月を取得する。
(2) 取得した年月を関数month_print_calendarで処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数month_print_calendar
ファイルopreate_calendar.c内 関数get_today
void before_year_cal | ( | ) |
機能
昨年の年間カレンダーを表示する
処理詳細
(1) システム上の年を取得する
(2) 取得した年から1を引いた年をinput_year_cal関数で処理
被参照自作関数
ファイルhcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数input_year_cal
ファイルopreate_calendar.c内 関数get_today
DAY_DATE get_today | ( | ) |
機能
システム上の年月日を取得する
today | 本日の日付が入った構造体型変数 |
被参照自作関数
ファイルopreate_calendar.c内 関数this_month_cal
ファイルopreate_calendar.c内 関数next_month_cal
ファイルopreate_calendar.c内 関数before_month_cal
ファイルopreate_calendar.c内 関数this_year_cal
ファイルopreate_calendar.c内 関数next_year_cal
ファイルopreate_calendar.c内 関数before_year_cal
ファイルopreate_calendar.c内 関数this_fiscal_cal
ファイルopreate_calendar.c内 関数next_fiscal_cal
ファイルopreate_calendar.c内 関数before_fiscal_cal
ファイルopreate_calendar.c内 関数this_three_month
ファイルopreate_calendar_gengoh.c内 関数this_month_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数next_month_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数before_month_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数this_year_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数next_year_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数before_year_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数this_fiscal_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数next_fiscal_cal_gengoh
ファイルopreate_calendar_gengoh.c内 関数before_year_cal_gengoh
参照自作関数
なし
void input_fiscal_cal | ( | int | year | ) |
機能
入力された年の年度カレンダーを表示させる
year | 年 |
被参照自作関数
ファイルghcal.c内 関数argcheck
ファイルopreate_calendar.c内 関数next_fiscal_cal
ファイルopreate_calendar.c内 関数before_fiscal_cal
参照自作関数
ファイルopreate_calendar.c内 関数input_ym_three
void input_year_cal | ( | int | year | ) |
機能
入力された年の年間カレンダーを表示させる
処理詳細
横に3ヶ月分のカレンダーを表示する。
year | 年 |
被参照自作関数
ファイルghcal.c内 関数argcheck
ファイルopreate_calendar.c内 関数next_year_cal
ファイルopreate_calendar.c内 関数before_year_cal
参照自作関数
ファイルopreate_calendar.c内 関数input_ym_three
void input_ym_three | ( | int | year, | |
int | month | |||
) |
機能 先月、今月、来月の3ヶ月カレンダーを表示する
処理詳細 (1) 入力/システムから獲得した月によって以下の処理をする。
(1.1) 月が1月なら、前年の12月からシステム上の年の2月までのカレンダーを作る。
(1.2) 月が12月なら、11月から翌年の1月までのカレンダーを作る。
(1.3) それ以外の月なら、前の月から翌月までのカレンダーを作る。
(2) 3ヶ月分のカレンダーが作成したら、横にカレンダーを表示する
year | 年 | |
month | 年 |
被参照自作関数
ファイルghcal.c内 関数argcheck
ファイルoutput_calendar内 関数input_year_cal
ファイルoutput_calendar内 関数input_fiscal_cal
参照自作関数
ファイルopreate_calendar.c内 関数make_array
ファイルcalendar_main.c内 関数make_three_calendar
ファイルcalendar_main.c内 関数make_holiday
ファイルoutput_calendar.c内 関数print_calendar_three
ファイルoutput_calendar.c内 関数row_calendar_main
ファイルoutput_calendar.c内 関数row_holiday
void input_ym_three_today | ( | int | year, | |
int | month, | |||
DAY_DATE | today | |||
) |
機能 先月、今月、来月の3ヶ月カレンダーを表示する
処理詳細 (1) 入力/システムから獲得した月によって以下の処理をする。
(1.1) 月が1月なら、前年の12月からシステム上の年の2月までのカレンダーを作る。
(1.2) 月が12月なら、11月から翌年の1月までのカレンダーを作る。
(1.3) それ以外の月なら、前の月から翌月までのカレンダーを作る。
(2) 3ヶ月分のカレンダーが作成したら、横にカレンダーを表示する
year | 年 | |
month | 月 | |
today | システム上の日付 |
被参照自作関数
ファイルghcal.c内 関数argcheck
ファイルopreate_calendar内 関数this_three_month
参照自作関数
ファイルopreate_calendar.c内 関数make_array
ファイルcalendar_main.c内 関数make_three_calendar
ファイルcalendar_main.c内 関数make_holiday
ファイルoutput_calendar.c内 関数print_calendar_three
ファイルoutput_calendar.c内 関数row_calendar_main
ファイルoutput_calendar.c内 関数row_holiday
int judge_month | ( | int | year, | |
int | month, | |||
char | holiday_name[HOLY_MAX][HOLY_NAME], | |||
int | holiday_num[HOLY_MAX] | |||
) |
機能
入力された月による祝日有無を判定する
year | 年 | |
month | 月 | |
holiday_name[][] | 祝日名代入する配列 | |
holiday_num[][] | 祝日日付代入配列(Ver1.1) |
m_holidays | 月ごとの祝日日数を返す |
被参照自作関数
ファイルcalendar_main.c内 関数make_calendar
ファイルoutput_calendar.c内 関数month_print_calendar
ファイルoutput_calendar.c内 関数month_print_calendar_today
参照自作関数
ファイルinsert_holidays.c内 関数Jan_holiday
ファイルinsert_holidays.c内 関数Feb_holiday
ファイルinsert_holidays.c内 関数Mar_holiday
ファイルinsert_holidays.c内 関数Api_holiday
ファイルinsert_holidays.c内 関数May_holiday
ファイルinsert_holidays.c内 関数Jul_holiday
ファイルinsert_holidays.c内 関数Sep_holiday
ファイルinsert_holidays.c内 関数Oct_holiday
ファイルinsert_holidays.c内 関数Nov_holiday
ファイルinsert_holidays.c内 関数Dec_holiday
void make_array | ( | int | arr_year[COL_CAL], | |
int | arr_month[COL_CAL], | |||
int | year, | |||
int | month | |||
) |
機能
配列にデータを入れる
arr_year[] | 3ヶ月分の年 | |
arr_month[] | 3ヶ月分の月 | |
year | 基準年 | |
month | 基準月 |
被参照自作関数
ファイルopreate_calendar内 関数input_ym_three
ファイルopreate_calendar内 関数input_ym_three_today
参照自作関数
なし
void month_print_calendar | ( | int | year, | |
int | month | |||
) |
機能
year年month月のカレンダーを祝日とともに表示する
処理詳細
(1) year年month月の初日の曜日を算出
(2) year年month月の月日数を取得
(3) 初日から月末までのカレンダーを表示
(3.1) 日曜日なら赤で表示
(3.2) 土曜日なら青で表示
(3.3) それ以外の曜日は黒で表示
(4) 祝日名を表示する
year | 年 | |
month | 月 |
被参照自作関数
ファイルopreate_calendar.c内 関数next_month_cal
ファイルopreate_calendar.c内 関数before_month_cal
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルcalendar_main.c内 関数day_of_week
ファイルcalendar_main.c内 関数month_days
ファイルinsert_holidays.c内 関数judge_month
void month_print_calendar_today | ( | int | year, | |
int | month, | |||
int | day | |||
) |
機能
year年month月のカレンダーを祝日とともに表示し、システム上の日付の日を白抜きにする
処理詳細
(1) year年month月の初日の曜日を算出
(2) year年month月の月日数を取得
(3) 初日から月末までのカレンダーを表示
(3.1) 日曜日なら赤で表示
(3.2) 土曜日なら青で表示
(3.3) それ以外の曜日は黒で表示
(3.4) システム上の日付なら文字色と背景色を反転
(4) 祝日名を表示する
year | 年 | |
month | 月 | |
day | 日 |
被参照自作関数
ファイルopreate_calendar.c内 関数this_month_cal
参照自作関数
ファイルcalendar_main.c内 関数day_of_week
ファイルcalendar_main.c内 関数month_days
void next_fiscal_cal | ( | ) |
機能
翌年度のカレンダーを表示する
処理詳細
(1) システム上の年と月を取得する
(2) 年をプラス1する。
(3) 取得した月が1月〜3月の間であったら、年を1年マイナス
(4) 取得した年をinput_year_cal関数で処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数input_fiscal_cal
ファイルopreate_calendar.c内 関数get_today
void next_month_cal | ( | ) |
機能
来月のカレンダーを表示する
処理詳細
(1) システム上の年月を取得する。
(2) 取得した年月を関数month_print_calendarで処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数month_print_calendar
ファイルopreate_calendar.c内 関数get_today
void next_year_cal | ( | ) |
機能
翌年の年間カレンダーを表示する
処理詳細
(1) システム上の年を取得する
(2) 取得した年+1をinput_year_cal関数で処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数input_year_cal
ファイルopreate_calendar.c内 関数get_today
void print_calendar_three | ( | int | year[COL_CAL], | |
int | month[COL_CAL] | |||
) |
機能 指定された3ヶ月分の年と月を表示する
処理詳細
(1) 指定された3ヶ月分の年と月をバッファに入れる
(2) バッファを横に表示する
year[] | 年 | |
month[] | 月 |
被参照自作関数
ファイルopreate_calendar.c 関数input_ym_three
ファイルorpeate_calendar.c 関数input_ym_three_today
参照自作関数
なし
void row_calendar_main | ( | int | cal_buf[COL_CAL][WEEK_ROW][WEEK_COL], | |
int | week_max, | |||
int | holiday_num[COL_CAL][HOLY_MAX] | |||
) |
機能
カレンダーを横に表示させる
処理詳細
(1) 曜日を表示
(2) 日付を曜日ごと、祝日ごとに色分けする
cal_buf[][][] | カレンダーバッファ | |
week_max | 最大週数 | |
holiday_num[][] | 日付代入配列 |
被参照自作関数
ファイルopreate_calendar.c内 関数input_ym_three
ファイルopreate_calendar.c内 関数input_ym_three_gengoh
ファイルopreate_calendar_gengoh.c内 関数input_1989_1to3
ファイルopreate_calendar_gengoh.c内 関数input_1989_three
参照自作関数
なし
void row_calendar_main_today | ( | int | cal_buf[COL_CAL][WEEK_ROW][WEEK_COL], | |
int | week_max, | |||
int | holiday_num[COL_CAL][HOLY_MAX], | |||
int | month, | |||
int | day, | |||
int | arr_month[COL_CAL] | |||
) |
機能
カレンダーを横に表示させる
処理詳細
(1) 曜日を表示
(2) 日付を曜日ごと、祝日ごとに色分けする
(3) システム上の日付を文字色と背景色と反転
(4) 祝日を表示する
cal_buf[][][] | カレンダーバッファ | |
week_max | 最大週数 | |
holiday_num[][] | 日付代入配列 | |
month | システム上の月 | |
day | システム上の年 | |
arr_month | 3ヶ月分の月 |
被参照自作関数
ファイルorpeate_calendar.c内 関数input_ym_three_today
ファイルopreate_calendar_gengoh.c内 関数input_ym_three_today_gengoh
参照自作関数
なし
void row_holiday | ( | char | holiday_name[COL_CAL][HOLY_MAX][HOLY_NAME], | |
int | hol_max | |||
) |
機能
3ヶ月分の祝日を横に表示させる
holiday_name[][][] | 祝日 | |
hol_max | 最大祝日日数 |
被参照自作関数
ファイルopreate_calendar.c内 関数input_ym_three
ファイルopreate_calendar.c内 関数input_ym_three_today
参照自作関数
なし
void this_fiscal_cal | ( | ) |
機能
今年度のカレンダーを表示する
処理詳細
(1) システム上の年と月を取得する
(2) 取得した月が1月〜3月の間であったら、年を1年マイナス
(3) 取得した年をinput_year_cal関数で処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数input_ym_three_today
ファイルopreate_calendar.c内 関数input_ym_three
ファイルopreate_calendar.c内 関数get_today
void this_month_cal | ( | ) |
機能
今月のカレンダーを表示する
処理詳細
(1) システム上の年月を取得する。
(2) 取得した年月を関数month_print_calendar_gengohで処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数month_print_calendar_today
ファイルopreate_calendar.c内 関数get_today
void this_three_month | ( | ) |
機能
前月、今月、来月の3ヶ月を表示する
処理詳細
(1) システム上の年月を取得する
(2) 取得した年をinput_ym_three関数で処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopeate_calendar.c内 関数input_ym_three_today
void this_year_cal | ( | ) |
機能
今年の年間カレンダーを表示する
処理詳細
(1) システム上の年を取得する
(2) 取得した年をinput_year_cal関数で処理
被参照自作関数
ファイルghcal.c内 関数argcheck
参照自作関数
ファイルopreate_calendar.c内 関数input_ym_three_today
ファイルopreate_calendar.c内 関数input_ym_three
ファイルopreate_calendar.c内 関数get_today