\hypertarget{dccaldateparsestr_8f90}{}\section{dc\+\_\+utils/dccaldateparsestr.f90 File Reference}
\label{dccaldateparsestr_8f90}\index{dc\+\_\+utils/dccaldateparsestr.\+f90@{dc\+\_\+utils/dccaldateparsestr.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{dccaldateparsestr_8f90_a3c24e415a5099d44770f735b892473c7}{dccaldateparsestr1} (date\+\_\+str, year, month, day, hour, min, sec, zone, err)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{dccaldateparsestr_8f90_a3c24e415a5099d44770f735b892473c7}\label{dccaldateparsestr_8f90_a3c24e415a5099d44770f735b892473c7}} 
\index{dccaldateparsestr.\+f90@{dccaldateparsestr.\+f90}!dccaldateparsestr1@{dccaldateparsestr1}}
\index{dccaldateparsestr1@{dccaldateparsestr1}!dccaldateparsestr.\+f90@{dccaldateparsestr.\+f90}}
\subsubsection{\texorpdfstring{dccaldateparsestr1()}{dccaldateparsestr1()}}
{\footnotesize\ttfamily subroutine dccaldateparsestr1 (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{date\+\_\+str,  }\item[{integer, intent(out)}]{year,  }\item[{integer, intent(out)}]{month,  }\item[{integer, intent(out)}]{day,  }\item[{integer, intent(out)}]{hour,  }\item[{integer, intent(out)}]{min,  }\item[{real(dp), intent(out)}]{sec,  }\item[{character($\ast$), intent(out)}]{zone,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



Definition at line 17 of file dccaldateparsestr.\+f90.



References dc\+\_\+error\+::dc\+\_\+ealreadyinit, dc\+\_\+error\+::dc\+\_\+ebaddate, dc\+\_\+error\+::dc\+\_\+noerr, dc\+\_\+types\+::dp, dc\+\_\+regex\+::match(), dc\+\_\+error\+::storeerror(), dc\+\_\+types\+::string, and dc\+\_\+types\+::token.


\begin{DoxyCode}
17   \textcolor{comment}{! *date\_str* で与えられる日時形式 }
18   \textcolor{comment}{! (gtool4 netCDF 規約「5.5 日時形式」に準拠) を解釈し, }
19   \textcolor{comment}{! *year* 〜 *zone* に返します. }
20   \textcolor{comment}{!}
21   \textcolor{comment}{! Parse strings of date (conformed to gtool4 netCDF Convention}
22   \textcolor{comment}{! "5.5 Expression of date and time") specified as *date\_str*, }
23   \textcolor{comment}{! and return *year* -- *zone*. }
24   \textcolor{comment}{!}
25 
26   \textcolor{keywordtype}{use }\hyperlink{namespacedc__regex}{dc\_regex}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}
27   \textcolor{keywordtype}{use }dc\_message\textcolor{keywordtype}{, only}: messagenotify
28   \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: lchar, stoi, stod
29   \textcolor{keywordtype}{use }dc\_trace\textcolor{keywordtype}{, only}: beginsub, endsub, dbgmessage
30   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}, 
      \hyperlink{namespacedc__error_a3302263a8c976235052a305d54572070}{dc\_ealreadyinit}, \hyperlink{namespacedc__error_ac7e64bb1ca445d53f1c98ab82917bc51}{dc\_ebaddate}
31   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}, \hyperlink{namespacedc__types_ac74a34430fcd3d0eb2344f19d536c086}{dp}, \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
32   \textcolor{keywordtype}{implicit none}
33   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: date\_str
34                               \textcolor{comment}{! 日時情報を表す文字列. }
35                               \textcolor{comment}{! 表示形式については gtool4 netCDF 規約}
36                               \textcolor{comment}{! 5.5 日時形式を参照のこと. }
37                               \textcolor{comment}{! }
38                               \textcolor{comment}{! Strings that express date and time. }
39                               \textcolor{comment}{! See gtool4 netCDF Convention }
40                               \textcolor{comment}{! 5.5 Expression of date and time for details. }
41   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: year  \textcolor{comment}{! 年. Year.}
42   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: month \textcolor{comment}{! 月. Month.}
43   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: day   \textcolor{comment}{! 日. Day.}
44   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: hour  \textcolor{comment}{! 時. Hour.}
45   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: min   \textcolor{comment}{! 分. Minute.}
46   \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{intent(out)}:: sec  \textcolor{comment}{! 秒. Second.}
47   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(out)}:: zone
48                               \textcolor{comment}{! UTC からの時差. Time-zone. }
49   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
50                               \textcolor{comment}{! 例外処理用フラグ. }
51                               \textcolor{comment}{! デフォルトでは, この手続き内でエラーが}
52                               \textcolor{comment}{! 生じた場合, プログラムは強制終了します. }
53                               \textcolor{comment}{! 引数 *err* が与えられる場合, }
54                               \textcolor{comment}{! プログラムは強制終了せず, 代わりに}
55                               \textcolor{comment}{! *err* に .true. が代入されます. }
56                               \textcolor{comment}{!}
57                               \textcolor{comment}{! Exception handling flag. }
58                               \textcolor{comment}{! By default, when error occur in }
59                               \textcolor{comment}{! this procedure, the program aborts. }
60                               \textcolor{comment}{! If this *err* argument is given, }
61                               \textcolor{comment}{! .true. is substituted to *err* and }
62                               \textcolor{comment}{! the program does not abort. }
63 
64 
65   \textcolor{comment}{! 作業変数}
66   \textcolor{comment}{! Work variables}
67   \textcolor{comment}{!}
68   \textcolor{keywordtype}{integer}:: start, length
69   \textcolor{keywordtype}{character(STRING)}:: str1, str2
70   \textcolor{keywordtype}{character(TOKEN)}:: zone\_pm, zone\_hrs, zone\_min
71   \textcolor{keywordtype}{integer}:: stat
72   \textcolor{keywordtype}{character(STRING)}:: cause\_c
73   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{'DCCalDateParseStr1'}
74 \textcolor{keywordflow}{continue}
75   \textcolor{keyword}{call }beginsub( subname )
76   stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
77   cause\_c = \textcolor{stringliteral}{''}
78 
79   \textcolor{comment}{! 与えられた文字列が日時表現として有効かどうかをチェック}
80   \textcolor{comment}{! Check validation of strings as an expression of date}
81   \textcolor{comment}{!}
82   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'[-]*#d+-#d+-#d+[#w#s]+#d+:#d+:#d+'}, date\_str, & \textcolor{comment}{! (in)}
83     &         start, length ) \textcolor{comment}{! (out)}
84 
85   \textcolor{keywordflow}{if} ( length > 0 ) \textcolor{keywordflow}{then}
86     str1 = date\_str(start:)
87   \textcolor{keywordflow}{else}
88     stat = \hyperlink{namespacedc__error_ac7e64bb1ca445d53f1c98ab82917bc51}{dc\_ebaddate}
89     \textcolor{keyword}{call }messagenotify(\textcolor{stringliteral}{'W'}, subname, &
90       & \textcolor{stringliteral}{'date\_str=<%c> is invalid expression as date.'}, &
91       & c1 = trim(date\_str) )
92     \textcolor{keywordflow}{goto} 999
93 \textcolor{keywordflow}{  end if}
94 
95   \textcolor{comment}{! 年の解釈}
96   \textcolor{comment}{! Parse year}
97   \textcolor{comment}{!}
98   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'^[-]*#d+-'}, str1, & \textcolor{comment}{! (in)}
99     &         start, length ) \textcolor{comment}{! (out)}
100   str2 = str1(start:start+length-2)
101   str1 = str1(start+length:)
102   year = stoi(str2)
103 
104   \textcolor{comment}{! 月の解釈}
105   \textcolor{comment}{! Parse month}
106   \textcolor{comment}{!}
107   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'^#d+-'}, str1, & \textcolor{comment}{! (in)}
108     &         start, length ) \textcolor{comment}{! (out)}
109   str2 = str1(start:start+length-2)
110   str1 = str1(start+length:)
111   month = stoi(str2)
112 
113   \textcolor{comment}{! 日の解釈}
114   \textcolor{comment}{! Parse day}
115   \textcolor{comment}{!}
116   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'^#d+[#w#s]'}, str1, & \textcolor{comment}{! (in)}
117     &         start, length ) \textcolor{comment}{! (out)}
118   str2 = str1(start:start+length-2)
119   str1 = str1(start+length:)
120   day = stoi(str2)
121 
122   \textcolor{comment}{! 時の解釈}
123   \textcolor{comment}{! Parse hour}
124   \textcolor{comment}{!}
125   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'#d+:'}, str1, & \textcolor{comment}{! (in)}
126     &         start, length ) \textcolor{comment}{! (out)}
127   str2 = str1(start:start+length-2)
128   str1 = str1(start+length:)
129   hour = stoi(str2)
130 
131   \textcolor{comment}{! 分の解釈}
132   \textcolor{comment}{! Parse minute}
133   \textcolor{comment}{!}
134   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'#d+:'}, str1, & \textcolor{comment}{! (in)}
135     &         start, length ) \textcolor{comment}{! (out)}
136   str2 = str1(start:start+length-2)
137   str1 = str1(start+length:)
138   min = stoi(str2)
139 
140   \textcolor{comment}{! 秒の解釈}
141   \textcolor{comment}{! Parse min}
142   \textcolor{comment}{!}
143   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'#d+'}, str1, & \textcolor{comment}{! (in)}
144     &         start, length ) \textcolor{comment}{! (out)}
145   str2 = str1(start:start+length-1)
146   str1 = str1(start+length:)
147 
148   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'^#.#d+'}, str1, & \textcolor{comment}{! (in)}
149     &         start, length ) \textcolor{comment}{! (out)}
150 
151   \textcolor{keywordflow}{if} ( length > 0 ) \textcolor{keywordflow}{then}
152     str2 = trim(str2) // str1(start:start+length-1)
153     str1 = str1(start+length:)
154 \textcolor{keywordflow}{  end if}
155   sec = stod(str2)
156 
157   \textcolor{comment}{! UTC からの時差の解釈}
158   \textcolor{comment}{! Parse time-zone difference}
159   \textcolor{comment}{!}
160   \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'[#+-]#d+:#d+'}, str1, & \textcolor{comment}{! (in)}
161     &         start, length ) \textcolor{comment}{! (out)}
162   \textcolor{keywordflow}{if} ( length > 0 ) \textcolor{keywordflow}{then}
163     zone\_pm = str1(start:start)
164     str1 = str1(start+1:start+length-1)
165 
166     \textcolor{keyword}{call }\hyperlink{namespacedc__regex_abc5c6d1c941d8689bdf6e32a6b919b25}{match}( \textcolor{stringliteral}{'^#d+:'}, str1, & \textcolor{comment}{! (in)}
167       &         start, length ) \textcolor{comment}{! (out)}
168     zone\_hrs = str1(start:start+length-2)
169     zone\_min = str1(start+length:)
170     zone = trim(zone\_pm) // trim(zone\_hrs) // \textcolor{stringliteral}{':'} // trim(zone\_min)
171   \textcolor{keywordflow}{else}
172     zone = \textcolor{stringliteral}{''}
173 \textcolor{keywordflow}{  end if}
174 
175   \textcolor{keyword}{call }dbgmessage(\textcolor{stringliteral}{'year=<%d> month=<%d> day=<%d> hour=<%d> min=<%d> sec=<%f>'} // &
176     & \textcolor{stringliteral}{' zone=<%c>'}, &
177     & i = (/year, month, day, hour, min/), d = (/sec/), &
178     & c1 = trim(zone) )
179 
180   \textcolor{comment}{! 終了処理, 例外処理}
181   \textcolor{comment}{! Termination and Exception handling}
182   \textcolor{comment}{!}
183 999 \textcolor{keywordflow}{continue}
184   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}( stat, subname, err, cause\_c )
185   \textcolor{keyword}{call }endsub( subname )
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{dccaldateparsestr_8f90_a3c24e415a5099d44770f735b892473c7_cgraph}
\end{center}
\end{figure}
