gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dccalinquire.f90
Go to the documentation of this file.
1! -*- mode: f90; coding: utf-8 -*-
2!-----------------------------------------------------------------------
3! Copyright (c) 2000-2026 Gtool Development Group. All rights reserved.
4!-----------------------------------------------------------------------
5!>
6!> @author Yasuhiro MORIKAWA
7!> @copyright Copyright (C) GFD Dennou Club, 2009-2026. All rights reserved. <br/>
8!> License is BSD-2-Clause. see [COPYRIGHT](@ref COPYRIGHT) in detail
9!> @en
10!> @brief Inquire information of calendar
11!> @details
12!> Procedures described in this file are provided from "dc_calendar" module.
13!> @enden
14!>
15!> @ja
16!> @brief 暦情報の問い合わせ
17!> @details
18!> このファイルに記載される手続き群は dc_calendar モジュールから提供されます.
19!> @endja
20!>
21
22!> @en
23!> @brief Inquire information of calendar
24!> @details
25!> Inquire information of calendar.
26!>
27!> Following strings are returned to `cal_type`.
28!>
29!> | cal_type | Description |
30!> |--------------|----------------------------------------------------------|
31!> | gregorian | Gregorian calendar |
32!> | julian | Julian calendar |
33!> | noleap | A calendar without leap year |
34!> | 360day | A calendar in which number of days of a month is 30 |
35!> | cyclic | A calendar in which number of days of a year is "30.6 x (number of months) - (total days until last month)" (truncate fractional part) |
36!> | user_defined | User defined calendar |
37!>
38!> If an optional argument `cal` is omitted,
39!> information of a calendar that is stored in the "dc_calendar"
40!> is returned.
41!> If `cal` is not omitted, information of the variable is returned.
42!>
43!> @param[out] cal_type Strings that specify a kind of calendar
44!> @param[out] month_in_year Months in a year
45!> @param[out] day_in_month Days in months (array)
46!> @param[out] day_in_month_ptr Days in months (pointer)
47!> @param[out] hour_in_day Hours in a day
48!> @param[out] min_in_hour Minutes in an hour
49!> @param[out] sec_in_min Seconds in a minute
50!> @param[in] cal An object that stores information of calendar
51!> @param[out] err Exception handling flag
52!> @enden
53!>
54!> @ja
55!> @brief 暦情報の問い合わせ
56!> @details
57!> 暦情報の問い合わせを行います.
58!>
59!> `cal_type` には以下の文字列が返ります.
60!>
61!> | cal_type | 説明 |
62!> |--------------|----------------------------------------------------------|
63!> | gregorian | グレゴリオ暦 |
64!> | julian | ユリウス暦 |
65!> | noleap | 閏年無しの暦 |
66!> | 360day | 1ヶ月が 30 日の暦 |
67!> | cyclic | ある月の日数を「30.6 × 月数 − 前月までの総日数」の小数点以下切捨とする暦 |
68!> | user_defined | ユーザ定義の暦 |
69!>
70!> 省略可能引数 `cal` が省略された場合には, dc_calendar 内部で
71!> 保持される暦に関する情報が得られます.
72!> `cal` が省略されない場合にはその変数に設定された暦の情報が得られます.
73!>
74!> @param[out] cal_type 暦の種類を示す文字列
75!> @param[out] month_in_year 1年の月数
76!> @param[out] day_in_month 1ヶ月の日数 (配列)
77!> @param[out] day_in_month_ptr 1ヶ月の日数 (ポインタ)
78!> @param[out] hour_in_day 1日の時間数
79!> @param[out] min_in_hour 1時間の分数
80!> @param[out] sec_in_min 1分の秒数
81!> @param[in] cal 暦情報を収めたオブジェクト
82!> @param[out] err 例外処理用フラグ.
83!> デフォルトでは, この手続き内でエラーが生じた場合,
84!> プログラムは強制終了します.
85!> 引数 `err` が与えられる場合, プログラムは強制終了せず,
86!> 代わりに `err` に .true. が代入されます.
87!> @endja
88subroutine dccalinquire1( cal_type, &
89 & month_in_year, day_in_month, day_in_month_ptr, &
90 & hour_in_day, min_in_hour, sec_in_min, &
91 & cal, err )
92
93 use dc_calendar_types, only: dc_cal
95 use dc_message, only: messagenotify
96 use dc_string, only: lchar
97 use dc_trace, only: beginsub, endsub
99 use dc_types, only: string, dp
100 implicit none
101 character(*), intent(out), optional:: cal_type
102 integer, intent(out), optional:: month_in_year
103 integer, intent(out), optional:: day_in_month(:)
104 integer, pointer, optional:: day_in_month_ptr(:)
105 integer, intent(out), optional:: hour_in_day
106 integer, intent(out), optional:: min_in_hour
107 real(DP), intent(out), optional:: sec_in_min
108 type(dc_cal), intent(in), optional, target:: cal
109 logical, intent(out), optional:: err
110
111 ! 作業変数
112 ! Work variables
113 !
114 type(dc_cal), pointer:: calp =>null()
115 integer:: siz_dm
116 integer:: stat
117 character(STRING):: cause_c
118 character(*), parameter:: subname = 'DCCalInquire1'
119continue
120 call beginsub( subname )
121 stat = dc_noerr
122 cause_c = ''
123
124 ! オブジェクトのポインタ割付
125 ! Associate pointer of an object
126 !
127 if ( present( cal ) ) then
128 calp => cal
129 else
130 calp => default_cal
131 if ( .not. calp % initialized ) call default_cal_set
132 end if
133
134 ! 初期設定のチェック
135 ! Check initialization
136 !
137 if ( .not. calp % initialized ) then
138 stat = dc_enotinit
139 cause_c = 'DC_CAL'
140 goto 999
141 end if
142
143 ! 各要素への値の参照
144 ! Refer elements
145 !
146 if ( present( cal_type ) ) then
147 cal_type = dccaltype_str( calp % cal_type )
148 end if
149 if ( present( month_in_year ) ) month_in_year = calp % month_in_year
150 if ( present( hour_in_day ) ) hour_in_day = calp % hour_in_day
151 if ( present( min_in_hour ) ) min_in_hour = calp % min_in_hour
152 if ( present( sec_in_min ) ) sec_in_min = calp % sec_in_min
153
154 if ( present( day_in_month ) ) then
155 if ( size( day_in_month ) > 0 ) then
156 day_in_month = 0
157 siz_dm = min( size( day_in_month ), size( calp % day_in_month ) )
158 day_in_month(1:siz_dm) = calp % day_in_month(1:siz_dm)
159 end if
160 end if
161
162 if ( present( day_in_month_ptr ) ) then
163 siz_dm = size( calp % day_in_month )
164 allocate( day_in_month_ptr(1:siz_dm) )
165 day_in_month_ptr(1:siz_dm) = calp % day_in_month(1:siz_dm)
166 end if
167
168 ! 終了処理, 例外処理
169 ! Termination and Exception handling
170 !
171999 continue
172 nullify( calp )
173 call storeerror( stat, subname, err, cause_c )
174 call endsub( subname )
175end subroutine dccalinquire1
subroutine dccalinquire1(cal_type, month_in_year, day_in_month, day_in_month_ptr, hour_in_day, min_in_hour, sec_in_min, cal, err)
暦情報の問い合わせ
dc_calendar用の内部モジュール
type(dc_cal), target, save, public default_cal
デフォルトの暦. DCCal で始まる手続のうち, DC_CAL 型の省略可能引数が与えられない 場合にはこの暦が設定もしくは利用される.
character(token) function, public dccaltype_str(cal_type)
subroutine, public default_cal_set
暦と日時に関する構造データ型と定数
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_enotinit
-400 以下: dc ユーティリティのエラー
Definition dc_error.f90:534
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
メッセージの出力
文字型変数の操作
Definition dc_string.f90:83
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92