\hypertarget{namespacedc__calendar__internal}{}\section{dc\+\_\+calendar\+\_\+internal Module Reference}
\label{namespacedc__calendar__internal}\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacedc__calendar__internal_ab33be336dc4b2e284e99c43b24235728}{default\+\_\+cal\+\_\+set}
\item 
integer function, public \hyperlink{namespacedc__calendar__internal_a5aaf74615ddc4b9e53d67d4949c55dd5}{dccaldate\+\_\+normalize} (year, month, day, hour, min, sec, cal)
\item 
integer function, public \hyperlink{namespacedc__calendar__internal_a5f6fb926707ca4deb84a454527b8c7f9}{dccaldate\+\_\+ym2d} (year, month, day, cal, day\+\_\+of\+\_\+year)
\item 
character(token) function, public \hyperlink{namespacedc__calendar__internal_aa5cfbed96ce640b2c6dd7bc0df513872}{dccaltype\+\_\+str} (cal\+\_\+type)
\item 
character(token) function, public \hyperlink{namespacedc__calendar__internal_a7f4b2e1d48fbf2e691931d5a40337ee2}{dccaldate\+\_\+str2ustr} (str)
\item 
integer function, public \hyperlink{namespacedc__calendar__internal_ae2ad5ba61c1d074aea90ec876012150c}{dccaldate\+\_\+str2usym} (str)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
type(dc\+\_\+cal), target, save, public \hyperlink{namespacedc__calendar__internal_a19929403a35d14fa0c6ce80f5e4392a5}{default\+\_\+cal}
\item 
type(dc\+\_\+cal\+\_\+date), target, save, public \hyperlink{namespacedc__calendar__internal_a3bc8a36b4f46e738aefa1d702a571111}{default\+\_\+date}
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacedc__calendar__internal_a5aaf74615ddc4b9e53d67d4949c55dd5}\label{namespacedc__calendar__internal_a5aaf74615ddc4b9e53d67d4949c55dd5}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!dccaldate\+\_\+normalize@{dccaldate\+\_\+normalize}}
\index{dccaldate\+\_\+normalize@{dccaldate\+\_\+normalize}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{dccaldate\+\_\+normalize()}{dccaldate\_normalize()}}
{\footnotesize\ttfamily integer function, public dc\+\_\+calendar\+\_\+internal\+::dccaldate\+\_\+normalize (\begin{DoxyParamCaption}\item[{integer, intent(inout)}]{year,  }\item[{integer, intent(inout)}]{month,  }\item[{integer, intent(inout)}]{day,  }\item[{integer, intent(inout)}]{hour,  }\item[{integer, intent(inout)}]{min,  }\item[{real(dp), intent(inout)}]{sec,  }\item[{type(dc\+\_\+cal), intent(in)}]{cal }\end{DoxyParamCaption})}



Definition at line 77 of file dc\+\_\+calendar\+\_\+internal.\+f90.



References dc\+\_\+calendar\+\_\+types\+::cal\+\_\+360day, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+cyclic, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+gregorian, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+julian, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+noleap, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+user\+\_\+defined, dc\+\_\+error\+::dc\+\_\+einconsistcaldate, and dc\+\_\+error\+::dc\+\_\+noerr.


\begin{DoxyCode}
77     \textcolor{comment}{!}
78     \textcolor{comment}{! 暦情報 cal に従い, 日時情報の正規化を行う. }
79     \textcolor{comment}{! dc\_calender モジュール内部で使用されることを前提とする. }
80     \textcolor{comment}{! 具体的には以下の場合に正規化を実施する. }
81     \textcolor{comment}{!}
82     \textcolor{comment}{! * sec が cal で設定される「1 分の秒数」を超えている. }
83     \textcolor{comment}{!   -> sec を「1 分の秒数」以内に納めるよう，年月日時分に繰り上げる．}
84     \textcolor{comment}{! * min が cal で設定される「1 時間の分数」を超えている. }
85     \textcolor{comment}{!   -> min を「1 時間の分数」以内に納めるよう，年月日時に繰り上げる．}
86     \textcolor{comment}{! * hour が cal で設定される「1 日の時間数」を超えている. }
87     \textcolor{comment}{!   -> hour を「1 日の時間数」以内に納めるよう，年月日に繰り上げる．}
88     \textcolor{comment}{! * day が cal で設定される「1 月の日数」を超えている. }
89     \textcolor{comment}{!   -> day を「1 月の日数」以内に納めるよう，年月に繰り上げる．}
90     \textcolor{comment}{! }
91     \textcolor{comment}{! * sec, min, hour, day が負の場合. }
92     \textcolor{comment}{!   -> それぞれを正にするよう負の分を上の位に繰り上げる．}
93     \textcolor{comment}{!}
94     \textcolor{comment}{! * day が 0 の場合. }
95     \textcolor{comment}{!   -> 正にするよう上の位に繰り上げる．}
96     \textcolor{comment}{!}
97     \textcolor{comment}{! 正常に正規化が行われれば stat には DC\_NOERR (=0) が返るが, }
98     \textcolor{comment}{! 日時情報が暦と整合的でない場合にはエラーコード DC\_EINCONSISTCALDATE }
99     \textcolor{comment}{! が返る. 整合的であるかどうかは以下で判定する. }
100     \textcolor{comment}{! }
101     \textcolor{comment}{! * 月が, 暦情報に含まれる「1年の月数」を}
102     \textcolor{comment}{!   既に超えてしまっている場合}
103     \textcolor{comment}{!}
104     \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}, \hyperlink{namespacedc__error_af615e5370c2a4be7e491ababe9171027}{dc\_einconsistcaldate}
105     \textcolor{keywordtype}{use }\hyperlink{namespacedc__calendar__types}{dc\_calendar\_types}\textcolor{keywordtype}{, only}: &
106       & \hyperlink{namespacedc__calendar__types_a01862dd22ae24667d07cb523d6f7d6fc}{cal\_user\_defined}, &
107       & \hyperlink{namespacedc__calendar__types_aff25d0687bf75b37d319ef5e68b942bb}{cal\_cyclic}, \hyperlink{namespacedc__calendar__types_af6212ffe5e51fc8c270d28a0754c71da}{cal\_noleap}, \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian}, 
      \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian}, \hyperlink{namespacedc__calendar__types_ae8c1fb15e0255aa447017a0ab468e747}{cal\_360day}
108     \textcolor{keywordtype}{implicit none}
109     \textcolor{keywordtype}{integer}:: stat                      \textcolor{comment}{! ステータス. Status.}
110     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)}:: year       \textcolor{comment}{! 年. Year.  }
111     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)}:: month      \textcolor{comment}{! 月. Month. }
112     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)}:: day        \textcolor{comment}{! 日. Day. }
113     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)}:: hour       \textcolor{comment}{! 時. Hour. }
114     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)}:: \hyperlink{interfacedc__date__generic_1_1min}{min}        \textcolor{comment}{! 分. Minute. }
115     \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{intent(inout)}:: sec       \textcolor{comment}{! 秒. Sec. }
116     \textcolor{keywordtype}{type}(dc\_cal), \textcolor{keywordtype}{intent(in)}:: cal
117                               \textcolor{comment}{! 暦情報を収めたオブジェクト. }
118                               \textcolor{comment}{! }
119                               \textcolor{comment}{! An object that stores information of }
120                               \textcolor{comment}{! calendar. }
121 
122     \textcolor{comment}{! 既定の暦での 1 ヶ月の日数}
123     \textcolor{comment}{! Days in months of previously-defined calendars}
124     \textcolor{comment}{!}
125     \textcolor{keywordtype}{integer}:: day\_in\_month\_jg
126     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{pointer}:: day\_in\_month(:) =>null()
127 
128     \textcolor{comment}{! 既定の暦での 1 日・時間・分の時間・分・秒数}
129     \textcolor{comment}{! Hours, minutes, seconds in a day, a hour, a minute of previously-defined calendars}
130     \textcolor{comment}{!}
131     \textcolor{keywordtype}{integer}:: month\_in\_year   \textcolor{comment}{! 1 日の時間数. }
132                               \textcolor{comment}{! Hours in a day. }
133     \textcolor{keywordtype}{integer}:: hour\_in\_day     \textcolor{comment}{! 1 日の時間数. }
134                               \textcolor{comment}{! Hours in a day. }
135     \textcolor{keywordtype}{integer}:: min\_in\_hour     \textcolor{comment}{! 1 時間の分数. }
136                               \textcolor{comment}{! Minutes in a hour. }
137     \textcolor{keywordtype}{real(DP)}:: sec\_in\_min     \textcolor{comment}{! 1 分の秒数. }
138                               \textcolor{comment}{! Seconds in a minute. }
139 
140     \textcolor{comment}{! 作業変数}
141     \textcolor{comment}{! Work variables}
142     \textcolor{comment}{!}
143     \textcolor{keywordtype}{real(DP)}:: wyear, wday, whour, wmin
144     \textcolor{keywordtype}{real(DP)}:: wdb, ychunk\_e6, ychunk\_e3, chunk\_scale\_e6, chunk\_scale\_e3
145   \textcolor{keywordflow}{continue}
146     stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
147 
148     \textcolor{comment}{! 日時と暦の整合性チェック}
149     \textcolor{comment}{! Check consistency calendar and date}
150     \textcolor{comment}{!}
151 \textcolor{comment}{!!$    if ( min  > cal % min\_in\_hour ) stat = DC\_EINCONSISTCALDATE}
152 \textcolor{comment}{!!$    if ( hour > cal % hour\_in\_day ) stat = DC\_EINCONSISTCALDATE}
153 \textcolor{comment}{!!$    if ( all( day  > cal % day\_in\_month) ) stat = DC\_EINCONSISTCALDATE}
154     \textcolor{keywordflow}{select case}( cal % cal\_type )
155     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a01862dd22ae24667d07cb523d6f7d6fc}{cal\_user\_defined} )
156       \textcolor{keywordflow}{if} ( month > cal % month\_in\_year ) stat = \hyperlink{namespacedc__error_af615e5370c2a4be7e491ababe9171027}{dc\_einconsistcaldate}
157 \textcolor{keywordflow}{    case default}
158       \textcolor{keywordflow}{if} ( month > 12 ) stat = \hyperlink{namespacedc__error_af615e5370c2a4be7e491ababe9171027}{dc\_einconsistcaldate}
159 \textcolor{keywordflow}{    end select}
160 
161     \textcolor{keywordflow}{if} ( stat /= \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr} ) \textcolor{keywordflow}{return}
162 
163     \textcolor{comment}{! 秒〜日の変換パラメタ他の設定}
164     \textcolor{comment}{! Set parameter for conversion of sec -- day, etc}
165     \textcolor{comment}{! }
166     month\_in\_year = cal % month\_in\_year
167     hour\_in\_day   = cal % hour\_in\_day
168     min\_in\_hour   = cal % min\_in\_hour
169     sec\_in\_min    = cal % sec\_in\_min
170     day\_in\_month => cal % day\_in\_month
171 
172     \textcolor{keywordflow}{select case}( cal % cal\_type )
173     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian} )
174       chunk\_scale\_e6 = 4.0e+5
175       ychunk\_e6 = 146100000.0\_dp
176 
177       chunk\_scale\_e3 = 4.0e+2
178       ychunk\_e3 = 146100.0\_dp
179     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian} )
180       chunk\_scale\_e6 = 4.0e+5
181       ychunk\_e6 = 146097000.0\_dp
182 
183       chunk\_scale\_e3 = 4.0e+2
184       ychunk\_e3 = 146097.0\_dp
185 \textcolor{keywordflow}{    case default}
186       chunk\_scale\_e6 = 1.0e+6
187       ychunk\_e6 = chunk\_scale\_e6 * sum( day\_in\_month(:) )
188 
189       chunk\_scale\_e3 = 1.0e+3
190       ychunk\_e3 = chunk\_scale\_e3 * sum( day\_in\_month(:) )
191 \textcolor{keywordflow}{    end select}
192 
193     \textcolor{comment}{! 倍精度実数に一時的に格納}
194     \textcolor{comment}{! Store in double precision variable temporally}
195     \textcolor{comment}{!}
196     wyear  = \textcolor{keywordtype}{real}( year, dp )
197     wday   = \textcolor{keywordtype}{real}( day, dp )
198     whour  = \textcolor{keywordtype}{real}( hour, dp )
199     wmin   = \textcolor{keywordtype}{real}( \hyperlink{interfacedc__date__generic_1_1min}{min}, dp )
200 
201 
202     \textcolor{comment}{! 秒 -> 分の繰り上げ}
203     \textcolor{comment}{! Moving up sec -> min}
204     \textcolor{comment}{!}
205     \textcolor{keywordflow}{if} ( .not. sec < sec\_in\_min ) \textcolor{keywordflow}{then}
206       wmin = wmin + aint( sec / sec\_in\_min )
207       sec = mod( sec, sec\_in\_min )
208     \textcolor{keywordflow}{elseif} ( sec < 0.0\_dp ) \textcolor{keywordflow}{then}
209       wdb = ceiling( abs(sec) / sec\_in\_min )
210       wmin = wmin - wdb
211       sec = sec + wdb * sec\_in\_min
212 \textcolor{keywordflow}{    end if}
213 
214     \textcolor{comment}{! 分 -> 時の繰り上げ}
215     \textcolor{comment}{! Moving up min -> hour}
216     \textcolor{comment}{!}
217     \textcolor{keywordflow}{if} ( .not. wmin < min\_in\_hour ) \textcolor{keywordflow}{then}
218       whour = whour + aint( wmin / min\_in\_hour )
219       wmin = mod( wmin, \textcolor{keywordtype}{real( min\_in\_hour, DP )} )
220     \textcolor{keywordflow}{elseif} ( wmin < 0 ) \textcolor{keywordflow}{then}
221       wdb = ceiling( abs(wmin) / \textcolor{keywordtype}{real(min\_in\_hour)} )
222       whour = whour - wdb
223       wmin = wmin + wdb * min\_in\_hour
224 \textcolor{keywordflow}{    end if}
225 
226     \textcolor{comment}{! 時 -> 日の繰り上げ}
227     \textcolor{comment}{! Moving up hour -> day}
228     \textcolor{comment}{!}
229     \textcolor{keywordflow}{if} ( .not. whour < hour\_in\_day ) \textcolor{keywordflow}{then}
230       wday = wday + aint( whour / hour\_in\_day )
231       whour = mod( whour, \textcolor{keywordtype}{real( hour\_in\_day, DP )} )
232     \textcolor{keywordflow}{elseif} ( whour < 0 ) \textcolor{keywordflow}{then}
233       wdb = ceiling( abs(whour) / \textcolor{keywordtype}{real(hour\_in\_day)} )
234       wday = wday - wdb
235       whour = whour + wdb * hour\_in\_day
236 \textcolor{keywordflow}{    end if}
237 
238     \textcolor{comment}{! 日が負もしくは 0 の場合，負の部分を年に繰り上げ，日を正に変換}
239     \textcolor{comment}{! Negative or 0 part of day is moved up to year}
240     \textcolor{comment}{!}
241     \textcolor{keywordflow}{if} ( wday < 1.0\_dp ) \textcolor{keywordflow}{then}
242       \textcolor{keywordflow}{select case}( cal % cal\_type )
243       \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian} )
244 
245         \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( wday < 1.0\_dp )
246 
247           \textcolor{keywordflow}{if} ( wday < - ychunk\_e6 ) \textcolor{keywordflow}{then}
248             wyear = wyear + chunk\_scale\_e6 * ( aint( wday / ychunk\_e6 ) - 1.0\_dp )
249             wday = mod( wday, ychunk\_e6 ) + ychunk\_e6
250 \textcolor{keywordflow}{          end if}
251 
252           \textcolor{keywordflow}{if} ( wday < 1.0\_dp ) \textcolor{keywordflow}{then}
253             wyear = wyear + chunk\_scale\_e3 * ( aint( wday / ychunk\_e3 ) - 1.0\_dp )
254             wday = mod( wday, ychunk\_e3 ) + ychunk\_e3
255 \textcolor{keywordflow}{          end if}
256 
257 \textcolor{keywordflow}{        end do}
258 
259       \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian} )
260 
261         \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( wday < 1.0\_dp )
262 
263           \textcolor{keywordflow}{if} ( wday < - ychunk\_e6 ) \textcolor{keywordflow}{then}
264             wyear = wyear + chunk\_scale\_e6 * ( aint( wday / ychunk\_e6 ) - 1.0\_dp )
265             wday = mod( wday, ychunk\_e6 ) + ychunk\_e6
266 \textcolor{keywordflow}{          end if}
267 
268           \textcolor{keywordflow}{if} ( wday < 1.0\_dp ) \textcolor{keywordflow}{then}
269             wyear = wyear + chunk\_scale\_e3 * ( aint( wday / ychunk\_e3 ) - 1.0\_dp )
270             wday = mod( wday, ychunk\_e3 ) + ychunk\_e3
271 \textcolor{keywordflow}{          end if}
272 
273 \textcolor{keywordflow}{        end do}
274 
275 \textcolor{keywordflow}{      case default}
276 
277         \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( wday < 1.0\_dp )
278 
279           \textcolor{keywordflow}{if} ( wday < - ychunk\_e6 ) \textcolor{keywordflow}{then}
280             wyear = wyear + chunk\_scale\_e6 * ( aint( wday / ychunk\_e6 ) - 1.0\_dp )
281             wday = mod( wday, ychunk\_e6 ) + ychunk\_e6
282 \textcolor{keywordflow}{          end if}
283 
284           \textcolor{keywordflow}{if} ( wday < 1.0\_dp ) \textcolor{keywordflow}{then}
285             wyear = wyear + chunk\_scale\_e3 * ( aint( wday / ychunk\_e3 ) - 1.0\_dp )
286             wday = mod( wday, ychunk\_e3 ) + ychunk\_e3
287 \textcolor{keywordflow}{          end if}
288 
289 \textcolor{keywordflow}{        end do}
290 
291 \textcolor{keywordflow}{      end select}
292 
293 \textcolor{keywordflow}{    end if}
294 
295     \textcolor{comment}{! 日 -> 年月の繰り上げ}
296     \textcolor{comment}{! Moving up day -> year and month}
297     \textcolor{comment}{!}
298     \textcolor{keywordflow}{select case}( cal % cal\_type )
299     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian} )
300 
301       \textcolor{keywordflow}{if} ( wday > ychunk\_e6 ) \textcolor{keywordflow}{then}
302         wyear = wyear + chunk\_scale\_e6 * aint( wday / ychunk\_e6 )
303         wday = mod( wday, ychunk\_e6 )
304 \textcolor{keywordflow}{      end if}
305 
306       \textcolor{keywordflow}{if} ( wday > ychunk\_e3 ) \textcolor{keywordflow}{then}
307         wyear = wyear + chunk\_scale\_e3 * aint( wday / ychunk\_e3 )
308         wday = mod( wday, ychunk\_e3 )
309 \textcolor{keywordflow}{      end if}
310 
311       \textcolor{keywordflow}{do}
312         \textcolor{keywordflow}{if} ( month == 2 ) \textcolor{keywordflow}{then}
313           \textcolor{keywordflow}{if} ( mod( wyear, 4.0\_dp ) == 0 ) \textcolor{keywordflow}{then}
314             day\_in\_month\_jg = 29
315           \textcolor{keywordflow}{else}
316             day\_in\_month\_jg = 28
317 \textcolor{keywordflow}{          end if}
318         \textcolor{keywordflow}{else}
319           day\_in\_month\_jg = day\_in\_month(month)
320 \textcolor{keywordflow}{        end if}
321 
322         \textcolor{keywordflow}{if} ( .not. wday > day\_in\_month\_jg ) \textcolor{keywordflow}{exit}
323 
324         wday = wday - day\_in\_month\_jg
325         month = month + 1
326         \textcolor{keywordflow}{if} ( month > month\_in\_year ) \textcolor{keywordflow}{then}
327           month = 1
328           wyear = wyear + 1
329 \textcolor{keywordflow}{        end if}
330 \textcolor{keywordflow}{      end do}
331 
332     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian} )
333 
334       \textcolor{keywordflow}{if} ( wday > ychunk\_e6 ) \textcolor{keywordflow}{then}
335         wyear = wyear + chunk\_scale\_e6 * aint( wday / ychunk\_e6 )
336         wday = mod( wday, ychunk\_e6 )
337 \textcolor{keywordflow}{      end if}
338 
339       \textcolor{keywordflow}{if} ( wday > ychunk\_e3 ) \textcolor{keywordflow}{then}
340         wyear = wyear + chunk\_scale\_e3 * aint( wday / ychunk\_e3 )
341         wday = mod( wday, ychunk\_e3 )
342 \textcolor{keywordflow}{      end if}
343 
344       \textcolor{keywordflow}{do}
345         \textcolor{keywordflow}{if} ( month == 2 ) \textcolor{keywordflow}{then}
346           \textcolor{keywordflow}{if} ( mod( wyear, 400.0\_dp ) == 0 ) \textcolor{keywordflow}{then}
347             day\_in\_month\_jg = 29
348           \textcolor{keywordflow}{elseif} ( mod( wyear, 100.0\_dp ) == 0 ) \textcolor{keywordflow}{then}
349             day\_in\_month\_jg = 28
350           \textcolor{keywordflow}{elseif} ( mod( wyear, 4.0\_dp ) == 0 ) \textcolor{keywordflow}{then}
351             day\_in\_month\_jg = 29
352           \textcolor{keywordflow}{else}
353             day\_in\_month\_jg = 28
354 \textcolor{keywordflow}{          end if}
355         \textcolor{keywordflow}{else}
356           day\_in\_month\_jg = day\_in\_month(month)
357 \textcolor{keywordflow}{        end if}
358 
359         \textcolor{keywordflow}{if} ( .not. wday > day\_in\_month\_jg ) \textcolor{keywordflow}{exit}
360 
361         wday = wday - day\_in\_month\_jg
362         month = month + 1
363         \textcolor{keywordflow}{if} ( month > month\_in\_year ) \textcolor{keywordflow}{then}
364           month = 1
365           wyear = wyear + 1
366 \textcolor{keywordflow}{        end if}
367 \textcolor{keywordflow}{      end do}
368 
369 \textcolor{keywordflow}{    case default}
370 
371       \textcolor{keywordflow}{if} ( wday > ychunk\_e6 ) \textcolor{keywordflow}{then}
372         wyear = wyear + chunk\_scale\_e6 * aint( wday / ychunk\_e6 )
373         wday = mod( wday, ychunk\_e6 )
374 \textcolor{keywordflow}{      end if}
375 
376       \textcolor{keywordflow}{if} ( wday > ychunk\_e3 ) \textcolor{keywordflow}{then}
377         wyear = wyear + chunk\_scale\_e3 * aint( wday / ychunk\_e3 )
378         wday = mod( wday, ychunk\_e3 )
379 \textcolor{keywordflow}{      end if}
380 
381       \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( wday > day\_in\_month(month) )
382         wday = wday - day\_in\_month(month)
383         month = month + 1
384         \textcolor{keywordflow}{if} ( month > month\_in\_year ) \textcolor{keywordflow}{then}
385           month = 1
386           wyear = wyear + 1
387 \textcolor{keywordflow}{        end if}
388 \textcolor{keywordflow}{      end do}
389 
390 \textcolor{keywordflow}{    end select}
391 
392     \textcolor{comment}{! 整数に戻す}
393     \textcolor{comment}{! Return to integer}
394     \textcolor{comment}{!}
395     year  = wyear 
396     day   = wday  
397     hour  = whour 
398     \hyperlink{interfacedc__date__generic_1_1min}{min}   = wmin  
399 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedc__calendar__internal_a7f4b2e1d48fbf2e691931d5a40337ee2}\label{namespacedc__calendar__internal_a7f4b2e1d48fbf2e691931d5a40337ee2}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!dccaldate\+\_\+str2ustr@{dccaldate\+\_\+str2ustr}}
\index{dccaldate\+\_\+str2ustr@{dccaldate\+\_\+str2ustr}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{dccaldate\+\_\+str2ustr()}{dccaldate\_str2ustr()}}
{\footnotesize\ttfamily character(token) function, public dc\+\_\+calendar\+\_\+internal\+::dccaldate\+\_\+str2ustr (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{str }\end{DoxyParamCaption})}



Definition at line 530 of file dc\+\_\+calendar\+\_\+internal.\+f90.



References dc\+\_\+types\+::token, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+day, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+hour, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+min, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+month, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+sec, and dc\+\_\+calendar\+\_\+types\+::unit\+\_\+year.


\begin{DoxyCode}
530     \textcolor{comment}{!}
531     \textcolor{comment}{! 引数 *str* に与えられた文字列を解釈し, 日時の単位を *unit* に返す. }
532     \textcolor{comment}{! それぞれ以下の文字列が日時の単位として解釈される.}
533     \textcolor{comment}{! 大文字と小文字は区別されない. }
534     \textcolor{comment}{! 返る文字列は以下の文字型の配列の先頭の文字列となる. }
535     \textcolor{comment}{! (例: *str* に 'hrs.' が与えられる場合, dc\_calendar\_types#UNIT\_HOUR}
536     \textcolor{comment}{! 配列の先頭の文字列 UNIT\_HOUR(1) が返る.)}
537     \textcolor{comment}{!}
538     \textcolor{comment}{! 年         :: dc\_calendar\_types#UNIT\_YEAR}
539     \textcolor{comment}{! 月         :: dc\_calendar\_types#UNIT\_MONTH}
540     \textcolor{comment}{! 日         :: dc\_calendar\_types#UNIT\_DAY}
541     \textcolor{comment}{! 時         :: dc\_calendar\_types#UNIT\_HOUR}
542     \textcolor{comment}{! 分         :: dc\_calendar\_types#UNIT\_MIN}
543     \textcolor{comment}{! 秒         :: dc\_calendar\_types#UNIT\_SEC}
544     \textcolor{comment}{!}
545     \textcolor{comment}{! これらに該当しない文字列を *str* に与えた場合, 空文字が返る. }
546     \textcolor{comment}{!}
547     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
548     \textcolor{keywordtype}{use }\hyperlink{namespacedc__calendar__types}{dc\_calendar\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year}, \hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month}, 
      \hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day}, &
549       & \hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour}, \hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min}, \hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec}
550     \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: strieq
551     \textcolor{keywordtype}{implicit none}
552     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: str
553     \textcolor{keywordtype}{character(TOKEN)}:: unit
554     \textcolor{keywordtype}{integer} :: unit\_str\_size, i
555   \textcolor{keywordflow}{continue}
556     unit = adjustl(str)
557 
558     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec})
559     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
560       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec}(i)))) \textcolor{keywordflow}{then}
561         unit = \hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec}(1)
562         \textcolor{keywordflow}{return}
563 \textcolor{keywordflow}{      end if}
564 \textcolor{keywordflow}{    end do}
565 
566     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min})
567     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
568       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min}(i)))) \textcolor{keywordflow}{then}
569         unit = \hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min}(1)
570         \textcolor{keywordflow}{return}
571 \textcolor{keywordflow}{      end if}
572 \textcolor{keywordflow}{    end do}
573 
574     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour})
575     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
576       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour}(i)))) \textcolor{keywordflow}{then}
577         unit = \hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour}(1)
578         \textcolor{keywordflow}{return}
579 \textcolor{keywordflow}{      end if}
580 \textcolor{keywordflow}{    end do}
581 
582     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day})
583     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
584       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day}(i)))) \textcolor{keywordflow}{then}
585         unit = \hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day}(1)
586         \textcolor{keywordflow}{return}
587 \textcolor{keywordflow}{      end if}
588 \textcolor{keywordflow}{    end do}
589 
590     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month})
591     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
592       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month}(i)))) \textcolor{keywordflow}{then}
593         unit = \hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month}(1)
594         \textcolor{keywordflow}{return}
595 \textcolor{keywordflow}{      end if}
596 \textcolor{keywordflow}{    end do}
597 
598     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year})
599     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
600       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year}(i)))) \textcolor{keywordflow}{then}
601         unit = \hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year}(1)
602         \textcolor{keywordflow}{return}
603 \textcolor{keywordflow}{      end if}
604 \textcolor{keywordflow}{    end do}
605 
606     unit = \textcolor{stringliteral}{''}
607 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedc__calendar__internal_ae2ad5ba61c1d074aea90ec876012150c}\label{namespacedc__calendar__internal_ae2ad5ba61c1d074aea90ec876012150c}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!dccaldate\+\_\+str2usym@{dccaldate\+\_\+str2usym}}
\index{dccaldate\+\_\+str2usym@{dccaldate\+\_\+str2usym}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{dccaldate\+\_\+str2usym()}{dccaldate\_str2usym()}}
{\footnotesize\ttfamily integer function, public dc\+\_\+calendar\+\_\+internal\+::dccaldate\+\_\+str2usym (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{str }\end{DoxyParamCaption})}



Definition at line 611 of file dc\+\_\+calendar\+\_\+internal.\+f90.



References dc\+\_\+types\+::token, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+day, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+hour, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+min, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+month, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+sec, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+day, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+err, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+hour, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+min, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+month, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+sec, dc\+\_\+calendar\+\_\+types\+::unit\+\_\+symbol\+\_\+year, and dc\+\_\+calendar\+\_\+types\+::unit\+\_\+year.


\begin{DoxyCode}
611     \textcolor{comment}{!}
612     \textcolor{comment}{! 引数 *str* に与えられた文字列を解釈し, 日時の単位を示す}
613     \textcolor{comment}{! 整数 *symbol* を返す. それぞれ以下の文字列が日時の単位として解釈する.}
614     \textcolor{comment}{! 大文字と小文字は区別しない.}
615     \textcolor{comment}{!}
616     \textcolor{comment}{! 年         :: dc\_calendar\_types#UNIT\_YEAR}
617     \textcolor{comment}{! 月         :: dc\_calendar\_types#UNIT\_MONTH}
618     \textcolor{comment}{! 日         :: dc\_calendar\_types#UNIT\_DAY}
619     \textcolor{comment}{! 時         :: dc\_calendar\_types#UNIT\_HOUR}
620     \textcolor{comment}{! 分         :: dc\_calendar\_types#UNIT\_MIN}
621     \textcolor{comment}{! 秒         :: dc\_calendar\_types#UNIT\_SEC}
622     \textcolor{comment}{!}
623     \textcolor{comment}{! 返るシンボル (整数型) は以下の通り. }
624     \textcolor{comment}{!}
625     \textcolor{comment}{! 年         :: dc\_calendar\_types#UNIT\_SYMBOL\_YEAR}
626     \textcolor{comment}{! 月         :: dc\_calendar\_types#UNIT\_SYMBOL\_MONTH}
627     \textcolor{comment}{! 日         :: dc\_calendar\_types#UNIT\_SYMBOL\_DAY}
628     \textcolor{comment}{! 時         :: dc\_calendar\_types#UNIT\_SYMBOL\_HOUR}
629     \textcolor{comment}{! 分         :: dc\_calendar\_types#UNIT\_SYMBOL\_MIN}
630     \textcolor{comment}{! 秒         :: dc\_calendar\_types#UNIT\_SYMBOL\_SEC}
631     \textcolor{comment}{!}
632     \textcolor{comment}{! これらに該当しない文字列を *str* に与えた場合, }
633     \textcolor{comment}{! dc\_calendar\_types#UNIT\_SYMBOL\_ERR が返る. }
634     \textcolor{comment}{!}
635     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
636     \textcolor{keywordtype}{use }\hyperlink{namespacedc__calendar__types}{dc\_calendar\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year}, \hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month}, 
      \hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day}, &
637       & \hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour}, \hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min}, \hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec}, &
638       & \hyperlink{namespacedc__calendar__types_a9f02aaa42bc65301b0f6e86c34f5e975}{unit\_symbol\_year}, \hyperlink{namespacedc__calendar__types_a6a2218105981b62304a32c51f20e0824}{unit\_symbol\_month}, 
      \hyperlink{namespacedc__calendar__types_ab4be572292ddec215a2e956866a4d893}{unit\_symbol\_day}, &
639       & \hyperlink{namespacedc__calendar__types_ab35dfa690b91efaf7cfc2d056da4629b}{unit\_symbol\_hour}, \hyperlink{namespacedc__calendar__types_ac941d6da4d3fd07f09b543d20796e606}{unit\_symbol\_min}, 
      \hyperlink{namespacedc__calendar__types_a15ce2d6947c7143915fa55b6549d4997}{unit\_symbol\_sec}, &
640       & \hyperlink{namespacedc__calendar__types_ae69b4825c7774e217d64eb366ef797c3}{unit\_symbol\_err}
641     \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: strieq
642     \textcolor{keywordtype}{implicit none}
643     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: str
644     \textcolor{keywordtype}{integer}:: symbol
645     \textcolor{keywordtype}{integer}:: unit\_str\_size, i
646     \textcolor{keywordtype}{character(TOKEN)}:: unit
647   \textcolor{keywordflow}{continue}
648     unit = adjustl(str)
649 
650     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec})
651     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
652       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a6756a4c5dc3dca6ffb0a852710a8500b}{unit\_sec}(i)))) \textcolor{keywordflow}{then}
653         symbol = \hyperlink{namespacedc__calendar__types_a15ce2d6947c7143915fa55b6549d4997}{unit\_symbol\_sec}
654         \textcolor{keywordflow}{return}
655 \textcolor{keywordflow}{      end if}
656 \textcolor{keywordflow}{    end do}
657 
658     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min})
659     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
660       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_ae352239e839d2a5f5f4f5c38030975a9}{unit\_min}(i)))) \textcolor{keywordflow}{then}
661         symbol = \hyperlink{namespacedc__calendar__types_ac941d6da4d3fd07f09b543d20796e606}{unit\_symbol\_min}
662         \textcolor{keywordflow}{return}
663 \textcolor{keywordflow}{      end if}
664 \textcolor{keywordflow}{    end do}
665 
666     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour})
667     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
668       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a4b20e916893afb293b7910ca61d16ae4}{unit\_hour}(i)))) \textcolor{keywordflow}{then}
669         symbol = \hyperlink{namespacedc__calendar__types_ab35dfa690b91efaf7cfc2d056da4629b}{unit\_symbol\_hour}
670         \textcolor{keywordflow}{return}
671 \textcolor{keywordflow}{      end if}
672 \textcolor{keywordflow}{    end do}
673 
674     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day})
675     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
676       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_ad1f60103f35464aa447a4eb1655c2074}{unit\_day}(i)))) \textcolor{keywordflow}{then}
677         symbol = \hyperlink{namespacedc__calendar__types_ab4be572292ddec215a2e956866a4d893}{unit\_symbol\_day}
678         \textcolor{keywordflow}{return}
679 \textcolor{keywordflow}{      end if}
680 \textcolor{keywordflow}{    end do}
681 
682     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month})
683     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
684       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a0c8cae07cd0fafa669c3cc9161637282}{unit\_month}(i)))) \textcolor{keywordflow}{then}
685         symbol = \hyperlink{namespacedc__calendar__types_a6a2218105981b62304a32c51f20e0824}{unit\_symbol\_month}
686         \textcolor{keywordflow}{return}
687 \textcolor{keywordflow}{      end if}
688 \textcolor{keywordflow}{    end do}
689 
690     unit\_str\_size = \textcolor{keyword}{size}(\hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year})
691     \textcolor{keywordflow}{do} i = 1, unit\_str\_size
692       \textcolor{keywordflow}{if} (strieq(trim(unit), trim(\hyperlink{namespacedc__calendar__types_a1a782dd3dfe06e05edcb82423ef2b2b1}{unit\_year}(i)))) \textcolor{keywordflow}{then}
693         symbol = \hyperlink{namespacedc__calendar__types_a9f02aaa42bc65301b0f6e86c34f5e975}{unit\_symbol\_year}
694         \textcolor{keywordflow}{return}
695 \textcolor{keywordflow}{      end if}
696 \textcolor{keywordflow}{    end do}
697 
698     symbol = \hyperlink{namespacedc__calendar__types_ae69b4825c7774e217d64eb366ef797c3}{unit\_symbol\_err}
699 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedc__calendar__internal_a5f6fb926707ca4deb84a454527b8c7f9}\label{namespacedc__calendar__internal_a5f6fb926707ca4deb84a454527b8c7f9}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!dccaldate\+\_\+ym2d@{dccaldate\+\_\+ym2d}}
\index{dccaldate\+\_\+ym2d@{dccaldate\+\_\+ym2d}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{dccaldate\+\_\+ym2d()}{dccaldate\_ym2d()}}
{\footnotesize\ttfamily integer function, public dc\+\_\+calendar\+\_\+internal\+::dccaldate\+\_\+ym2d (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{year,  }\item[{integer, intent(in)}]{month,  }\item[{integer, intent(in)}]{day,  }\item[{type(dc\+\_\+cal), intent(in)}]{cal,  }\item[{real(dp), intent(out)}]{day\+\_\+of\+\_\+year }\end{DoxyParamCaption})}



Definition at line 403 of file dc\+\_\+calendar\+\_\+internal.\+f90.



References dc\+\_\+calendar\+\_\+types\+::cal\+\_\+360day, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+cyclic, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+gregorian, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+julian, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+noleap, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+user\+\_\+defined, dc\+\_\+error\+::dc\+\_\+einconsistcaldate, and dc\+\_\+error\+::dc\+\_\+noerr.


\begin{DoxyCode}
403     \textcolor{comment}{!}
404     \textcolor{comment}{! 暦情報 cal に従い, 月日をその年が始まった時からの通日に変換する. }
405     \textcolor{comment}{! 結果は倍精度実数として *day\_of\_year* に返る. }
406     \textcolor{comment}{! dccaldate\_normalize によって正規化した後に呼び出すこと. }
407     \textcolor{comment}{!}
408     \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}, \hyperlink{namespacedc__error_af615e5370c2a4be7e491ababe9171027}{dc\_einconsistcaldate}
409     \textcolor{keywordtype}{use }\hyperlink{namespacedc__calendar__types}{dc\_calendar\_types}\textcolor{keywordtype}{, only}: &
410       & \hyperlink{namespacedc__calendar__types_a01862dd22ae24667d07cb523d6f7d6fc}{cal\_user\_defined}, &
411       & \hyperlink{namespacedc__calendar__types_aff25d0687bf75b37d319ef5e68b942bb}{cal\_cyclic}, \hyperlink{namespacedc__calendar__types_af6212ffe5e51fc8c270d28a0754c71da}{cal\_noleap}, \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian}, 
      \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian}, \hyperlink{namespacedc__calendar__types_ae8c1fb15e0255aa447017a0ab468e747}{cal\_360day}
412     \textcolor{keywordtype}{implicit none}
413     \textcolor{keywordtype}{integer}:: stat                      \textcolor{comment}{! ステータス. Status.}
414     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: year          \textcolor{comment}{! 年. Year.  }
415     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: month         \textcolor{comment}{! 月. Month. }
416     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: day           \textcolor{comment}{! 日. Day. }
417     \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{intent(out)}:: day\_of\_year \textcolor{comment}{! 年始からの通日. Day of year}
418     \textcolor{keywordtype}{type}(dc\_cal), \textcolor{keywordtype}{intent(in)}:: cal
419                               \textcolor{comment}{! 暦情報を収めたオブジェクト. }
420                               \textcolor{comment}{! }
421                               \textcolor{comment}{! An object that stores information of }
422                               \textcolor{comment}{! calendar. }
423 
424     \textcolor{comment}{! 作業変数}
425     \textcolor{comment}{! Work variables}
426     \textcolor{comment}{!}
427     \textcolor{keywordtype}{integer}:: i
428 
429   \textcolor{keywordflow}{continue}
430     stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
431 
432     \textcolor{comment}{! 日時と暦の整合性チェック}
433     \textcolor{comment}{! Check consistency calendar and date}
434     \textcolor{comment}{!}
435 \textcolor{comment}{!!$    if ( min  > cal % min\_in\_hour ) stat = DC\_EINCONSISTCALDATE}
436 \textcolor{comment}{!!$    if ( hour > cal % hour\_in\_day ) stat = DC\_EINCONSISTCALDATE}
437 \textcolor{comment}{!!$    if ( all( day  > cal % day\_in\_month) ) stat = DC\_EINCONSISTCALDATE}
438     \textcolor{keywordflow}{select case}( cal % cal\_type )
439     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a01862dd22ae24667d07cb523d6f7d6fc}{cal\_user\_defined} )
440       \textcolor{keywordflow}{if} ( month > cal % month\_in\_year ) stat = \hyperlink{namespacedc__error_af615e5370c2a4be7e491ababe9171027}{dc\_einconsistcaldate}
441 \textcolor{keywordflow}{    case default}
442       \textcolor{keywordflow}{if} ( month > 12 ) stat = \hyperlink{namespacedc__error_af615e5370c2a4be7e491ababe9171027}{dc\_einconsistcaldate}
443 \textcolor{keywordflow}{    end select}
444 
445     \textcolor{keywordflow}{if} ( stat /= \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr} ) \textcolor{keywordflow}{return}
446 
447     \textcolor{comment}{! 倍精度実数に一時的に格納}
448     \textcolor{comment}{! Store in double precision variable temporally}
449     \textcolor{comment}{!}
450     day\_of\_year  = \textcolor{keywordtype}{real}( day, dp )
451 
452     \textcolor{comment}{! 年月 -> 日 の繰り下げ}
453     \textcolor{comment}{! Moving doun year and month -> day}
454     \textcolor{comment}{!}
455     \textcolor{keywordflow}{select case}( cal % cal\_type )
456     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian} )
457 
458       \textcolor{keywordflow}{do} i = 1, month - 1
459         \textcolor{keywordflow}{if} ( i == 2 ) \textcolor{keywordflow}{then}
460           \textcolor{keywordflow}{if} ( mod( year, 4 ) == 0 ) \textcolor{keywordflow}{then}
461             day\_of\_year = day\_of\_year + 29
462           \textcolor{keywordflow}{else}
463             day\_of\_year = day\_of\_year + 28
464 \textcolor{keywordflow}{          end if}
465         \textcolor{keywordflow}{else}
466           day\_of\_year = day\_of\_year + cal % day\_in\_month(i)
467 \textcolor{keywordflow}{        end if}
468 \textcolor{keywordflow}{      end do}
469 
470     \textcolor{keywordflow}{case}( \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian} )
471 
472       \textcolor{keywordflow}{do} i = 1, month - 1
473         \textcolor{keywordflow}{if} ( i == 2 ) \textcolor{keywordflow}{then}
474           \textcolor{keywordflow}{if} ( mod( year, 400 ) == 0 ) \textcolor{keywordflow}{then}
475             day\_of\_year = day\_of\_year + 29
476           \textcolor{keywordflow}{elseif} ( mod( year, 100 ) == 0 ) \textcolor{keywordflow}{then}
477             day\_of\_year = day\_of\_year + 28
478           \textcolor{keywordflow}{elseif} ( mod( year, 4 ) == 0 ) \textcolor{keywordflow}{then}
479             day\_of\_year = day\_of\_year + 29
480           \textcolor{keywordflow}{else}
481             day\_of\_year = day\_of\_year + 28
482 \textcolor{keywordflow}{          end if}
483         \textcolor{keywordflow}{else}
484           day\_of\_year = day\_of\_year + cal % day\_in\_month(i)
485 \textcolor{keywordflow}{        end if}
486 
487 \textcolor{keywordflow}{      end do}
488 
489 \textcolor{keywordflow}{    case default}
490 
491       \textcolor{keywordflow}{do} i = 1, month - 1
492         day\_of\_year = day\_of\_year + cal % day\_in\_month(i)
493 \textcolor{keywordflow}{      end do}
494 
495 \textcolor{keywordflow}{    end select}
496 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedc__calendar__internal_aa5cfbed96ce640b2c6dd7bc0df513872}\label{namespacedc__calendar__internal_aa5cfbed96ce640b2c6dd7bc0df513872}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!dccaltype\+\_\+str@{dccaltype\+\_\+str}}
\index{dccaltype\+\_\+str@{dccaltype\+\_\+str}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{dccaltype\+\_\+str()}{dccaltype\_str()}}
{\footnotesize\ttfamily character(token) function, public dc\+\_\+calendar\+\_\+internal\+::dccaltype\+\_\+str (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{cal\+\_\+type }\end{DoxyParamCaption})}



Definition at line 501 of file dc\+\_\+calendar\+\_\+internal.\+f90.



References dc\+\_\+calendar\+\_\+types\+::cal\+\_\+360day, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+cyclic, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+gregorian, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+julian, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+noleap, dc\+\_\+calendar\+\_\+types\+::cal\+\_\+user\+\_\+defined, and dc\+\_\+types\+::token.


\begin{DoxyCode}
501     \textcolor{comment}{!}
502     \textcolor{comment}{! 整数型の暦タイプ *cal\_type* を文字列 *str* に変換する. }
503     \textcolor{comment}{! 不正な *cal\_type* の場合は空文字が返る. }
504     \textcolor{comment}{! }
505     \textcolor{keywordtype}{use }\hyperlink{namespacedc__calendar__types}{dc\_calendar\_types}\textcolor{keywordtype}{, only}: &
506       & \hyperlink{namespacedc__calendar__types_a01862dd22ae24667d07cb523d6f7d6fc}{cal\_user\_defined}, &
507       & \hyperlink{namespacedc__calendar__types_aff25d0687bf75b37d319ef5e68b942bb}{cal\_cyclic}, \hyperlink{namespacedc__calendar__types_af6212ffe5e51fc8c270d28a0754c71da}{cal\_noleap}, \hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian}, 
      \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian}, \hyperlink{namespacedc__calendar__types_ae8c1fb15e0255aa447017a0ab468e747}{cal\_360day}
508     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
509     \textcolor{keywordtype}{implicit none}
510     \textcolor{keywordtype}{character(TOKEN)}:: str
511     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: cal\_type
512 
513     \textcolor{comment}{! 作業変数}
514     \textcolor{comment}{! Work variables}
515     \textcolor{comment}{!}
516   \textcolor{keywordflow}{continue}
517     \textcolor{keywordflow}{select case}( cal\_type )
518     \textcolor{keywordflow}{case}(\hyperlink{namespacedc__calendar__types_a01862dd22ae24667d07cb523d6f7d6fc}{cal\_user\_defined}) ; str = \textcolor{stringliteral}{'user\_defined'}
519     \textcolor{keywordflow}{case}(\hyperlink{namespacedc__calendar__types_aff25d0687bf75b37d319ef5e68b942bb}{cal\_cyclic})       ; str = \textcolor{stringliteral}{'cyclic      '}
520     \textcolor{keywordflow}{case}(\hyperlink{namespacedc__calendar__types_af6212ffe5e51fc8c270d28a0754c71da}{cal\_noleap})       ; str = \textcolor{stringliteral}{'noleap      '}
521     \textcolor{keywordflow}{case}(\hyperlink{namespacedc__calendar__types_a0c7574e07214536d34d1a1ff6cd1703c}{cal\_julian})       ; str = \textcolor{stringliteral}{'julian      '}
522     \textcolor{keywordflow}{case}(\hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian})    ; str = \textcolor{stringliteral}{'gregorian   '}
523     \textcolor{keywordflow}{case}(\hyperlink{namespacedc__calendar__types_ae8c1fb15e0255aa447017a0ab468e747}{cal\_360day})       ; str = \textcolor{stringliteral}{'360day      '}
524 \textcolor{keywordflow}{    case default}           ; str = \textcolor{stringliteral}{'            '}
525 \textcolor{keywordflow}{    end select}
\end{DoxyCode}
\mbox{\Hypertarget{namespacedc__calendar__internal_ab33be336dc4b2e284e99c43b24235728}\label{namespacedc__calendar__internal_ab33be336dc4b2e284e99c43b24235728}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!default\+\_\+cal\+\_\+set@{default\+\_\+cal\+\_\+set}}
\index{default\+\_\+cal\+\_\+set@{default\+\_\+cal\+\_\+set}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{default\+\_\+cal\+\_\+set()}{default\_cal\_set()}}
{\footnotesize\ttfamily subroutine, public dc\+\_\+calendar\+\_\+internal\+::default\+\_\+cal\+\_\+set (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Definition at line 44 of file dc\+\_\+calendar\+\_\+internal.\+f90.



References dc\+\_\+calendar\+\_\+types\+::cal\+\_\+gregorian, and default\+\_\+cal.


\begin{DoxyCode}
44     \textcolor{comment}{! }
45     \textcolor{comment}{! DCCal で始まる手続が呼び出され, "dc\_calendar\_types#DC\_CAL" 型の}
46     \textcolor{comment}{! 引数に暦の設定が行われていない場合には, まずこの手続を呼び出して, }
47     \textcolor{comment}{! デフォルトの暦 "default\_cal" をグレゴリオ暦として設定する. }
48     \textcolor{comment}{! }
49     \textcolor{comment}{! 既に "default\_cal" に暦が設定されている場合にはこの手続}
50     \textcolor{comment}{! 内でそれを判定して何もせずに手続を終了するため, }
51     \textcolor{comment}{! この手続は何度呼び出しても良く, 呼び出す側で状態の有無を}
52     \textcolor{comment}{! 確認する必要はない. }
53     \textcolor{comment}{! }
54     \textcolor{keywordtype}{use }\hyperlink{namespacedc__calendar__types}{dc\_calendar\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian}
55     \textcolor{keywordtype}{implicit none}
56     \textcolor{keywordtype}{type}(dc\_cal), \textcolor{keywordtype}{pointer}:: calp =>null()
57   \textcolor{keywordflow}{continue}
58     calp => default\_cal
59 
60     \textcolor{keywordflow}{if} ( calp % initialized ) \textcolor{keywordflow}{return}
61 
62     calp % cal\_type = \hyperlink{namespacedc__calendar__types_a56becce7ca212d6f20b0f2d738ea4538}{cal\_gregorian}
63     calp % month\_in\_year = 12
64     calp % hour\_in\_day   = 24
65     calp % min\_in\_hour   = 60
66     calp % sec\_in\_min    = 60.0\_dp
67     \textcolor{keyword}{allocate}( calp % day\_in\_month(1:12) )
68     calp % day\_in\_month(1:12) = &
69       & (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
70 
71     calp % initialized = .true.
72     \textcolor{keyword}{nullify}( calp )
\end{DoxyCode}


\subsection{Variable Documentation}
\mbox{\Hypertarget{namespacedc__calendar__internal_a19929403a35d14fa0c6ce80f5e4392a5}\label{namespacedc__calendar__internal_a19929403a35d14fa0c6ce80f5e4392a5}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!default\+\_\+cal@{default\+\_\+cal}}
\index{default\+\_\+cal@{default\+\_\+cal}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{default\+\_\+cal}{default\_cal}}
{\footnotesize\ttfamily type(dc\+\_\+cal), target, save, public dc\+\_\+calendar\+\_\+internal\+::default\+\_\+cal}



Definition at line 24 of file dc\+\_\+calendar\+\_\+internal.\+f90.


\begin{DoxyCode}
24   \textcolor{keywordtype}{type}(dc\_cal), \textcolor{keywordtype}{save}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{public}:: default\_cal
\end{DoxyCode}
\mbox{\Hypertarget{namespacedc__calendar__internal_a3bc8a36b4f46e738aefa1d702a571111}\label{namespacedc__calendar__internal_a3bc8a36b4f46e738aefa1d702a571111}} 
\index{dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}!default\+\_\+date@{default\+\_\+date}}
\index{default\+\_\+date@{default\+\_\+date}!dc\+\_\+calendar\+\_\+internal@{dc\+\_\+calendar\+\_\+internal}}
\subsubsection{\texorpdfstring{default\+\_\+date}{default\_date}}
{\footnotesize\ttfamily type(dc\+\_\+cal\+\_\+date), target, save, public dc\+\_\+calendar\+\_\+internal\+::default\+\_\+date}



Definition at line 33 of file dc\+\_\+calendar\+\_\+internal.\+f90.


\begin{DoxyCode}
33   \textcolor{keywordtype}{type}(dc\_cal\_date), \textcolor{keywordtype}{save}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{public}:: default\_date
\end{DoxyCode}
