58 implicit none
59 type(GTHST_NMLINFO), intent(inout):: gthstnml
60 logical, intent(out), optional:: err
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 character(STRING):: opname, opfile
79 logical:: end
80
81
82
83
84 character(STRING):: fullfilename
85 type(GTHST_NMLINFO_ENTRY), pointer:: hptr =>null()
86 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_prev =>null()
87 integer:: stat
88 character(STRING):: cause_c
89 character(*), parameter:: subname = 'HstNmlInfoEndDefine'
90 continue
93 cause_c = ''
94
95
96
97
98
99 if ( .not. gthstnml % initialized ) then
101 cause_c = 'GTHST_NMLINFO'
102 goto 999
103 end if
104
105 if ( .not. gthstnml % define_mode ) then
107 cause_c = 'EndDefine'
108 goto 999
109 end if
110
111
112
113
114
115 hptr => gthstnml % gthstnml_list
116 if ( .not. associated( hptr % history ) ) then
117 allocate( hptr % history )
118 end if
119 wholeloop : do while ( associated( hptr % next ) )
120 call listnext( gthstnml_list = hptr )
121 if ( trim(hptr % name) == '' .or. trim(hptr % file) == '' ) &
122 & cycle wholeloop
123
124 fullfilename = trim( hptr % fileprefix ) // hptr % file
125
126
127
128
129
130 nullify( hptr_prev )
132 searchloop : do
134 & opname, opfile, end )
135 if ( end ) exit searchloop
136 if ( trim(opfile) /= trim(fullfilename) ) cycle searchloop
137 hptr_prev => gthstnml % gthstnml_list
138
140 & name = opname )
141 if ( .not. associated( hptr_prev ) ) cycle searchloop
142 if ( trim(hptr % name) == trim(hptr_prev % name) ) cycle searchloop
143
144
145
146
147 if ( abs(hptr % interval_value - hptr_prev % interval_value) >
sp_eps )
then
149 & '@interval_value=%r (var=%a) and @interval_value=%r (var=%a) are applied to a file "%a"', &
150 & r = (/hptr % interval_value, hptr_prev % interval_value/), &
151 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
153 cause_c = fullfilename
154 goto 999
155 elseif ( hptr % interval_unit /= hptr_prev % interval_unit ) then
157 & '@interval_unit=%a (var=%a) and @interval_unit=%a (var=%a) are applied to a file "%a"', &
158 & ca =
stoa(hptr % interval_unit, hptr % name, &
159 & hptr_prev % interval_unit, hptr_prev % name, &
160 & fullfilename) )
162 cause_c = fullfilename
163 goto 999
164 end if
165
166
167
168
169 if ( abs(hptr % origin_value - hptr_prev % origin_value) >
sp_eps )
then
171 & '@origin_value=%r (var=%a) and @origin_value=%r (var=%a) are applied to a file "%a"', &
172 & r = (/hptr % origin_value, hptr_prev % origin_value/), &
173 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
175 cause_c = fullfilename
176 goto 999
177 elseif ( hptr % origin_unit /= hptr_prev % origin_unit ) then
179 & '@origin_unit=%a (var=%a) and @origin_unit=%a (var=%a) are applied to a file "%a"', &
180 & ca =
stoa(hptr % origin_unit, hptr % name, &
181 & hptr_prev % origin_unit, hptr_prev % name, &
182 & fullfilename) )
184 cause_c = fullfilename
185 goto 999
186 end if
187
188
189
190
191 if ( abs(hptr % terminus_value - hptr_prev % terminus_value) >
sp_eps )
then
193 & '@terminus_value=%r (var=%a) and @terminus_value=%r (var=%a) are applied to a file "%a"', &
194 & r = (/hptr % terminus_value, hptr_prev % terminus_value/), &
195 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
197 cause_c = fullfilename
198 goto 999
199 elseif ( hptr % terminus_unit /= hptr_prev % terminus_unit ) then
201 & '@terminus_unit=%a (var=%a) and @terminus_unit=%a (var=%a) are applied to a file "%a"', &
202 & ca =
stoa(hptr % terminus_unit, hptr % name, &
203 & hptr_prev % terminus_unit, hptr_prev % name, &
204 & fullfilename) )
206 cause_c = fullfilename
207 goto 999
208 end if
209
210
211
212
213 if ( ( hptr % newfile_intvalue > 0.0 ) &
214 & .or. ( hptr_prev % newfile_intvalue > 0.0 ) ) then
216 & 'when @newfile_intvalue=%d (var=%a) > 0 or' // &
217 & ' @newfile_intvalue=%d (var=%a) > 0, multiple variables can not be output to one file "%a"', &
218 & i = (/hptr % newfile_intvalue, hptr_prev % newfile_intvalue/), &
219 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
221 cause_c = fullfilename
222 goto 999
223 end if
224
225
226
227
228 if ( hptr % newfile_intvalue /= hptr_prev % newfile_intvalue ) then
230 & '@newfile_intvalue=%d (var=%a) and @newfile_intvalue=%d (var=%a) are applied to a file "%a"', &
231 & i = (/hptr % newfile_intvalue, hptr_prev % newfile_intvalue/), &
232 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
234 cause_c = fullfilename
235 goto 999
236 elseif ( hptr % newfile_intunit /= hptr_prev % newfile_intunit ) then
238 & '@newfile_intunit=%a (var=%a) and @newfile_intunit=%a (var=%a) are applied to a file "%a"', &
239 & ca =
stoa(hptr % newfile_intunit, hptr % name, &
240 & hptr_prev % newfile_intunit, hptr_prev % name, &
241 & fullfilename) )
243 cause_c = fullfilename
244 goto 999
245 end if
246
247
248
249
250
251 if ( any( hptr % slice_start /= hptr_prev % slice_start ) ) then
253 & '@slice_start=%*d (var=%a) and @slice_start=%*d (var=%a) are applied to a file "%a"', &
254 & i = (/hptr % slice_start(1:10), hptr_prev % slice_start(1:10)/), &
255 & n = (/10, 10/), &
256 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
258 cause_c = fullfilename
259 goto 999
260 elseif ( any( hptr % slice_end /= hptr_prev % slice_end ) ) then
262 & '@slice_end=%*d (var=%a) and @slice_end=%*d (var=%a) are applied to a file "%a"', &
263 & i = (/hptr % slice_end(1:10), hptr_prev % slice_end(1:10)/), &
264 & n = (/10, 10/), &
265 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
267 cause_c = fullfilename
268 goto 999
269 elseif ( any( hptr % slice_stride /= hptr_prev % slice_stride ) ) then
271 & '@slice_stride=%*d (var=%a) and @slice_stride=%*d (var=%a) are applied to a file "%a"', &
272 & i = (/hptr % slice_stride(1:10), hptr_prev % slice_stride(1:10)/), &
273 & n = (/10, 10/), &
274 & ca =
stoa(hptr % name, hptr_prev % name, fullfilename) )
276 cause_c = fullfilename
277 goto 999
278 end if
279
280
281
282
283
284 hptr % history => hptr_prev % history
285 exit searchloop
286 end do searchloop
287
288
289
290
291
292 if ( .not. associated( hptr % history ) ) then
293 allocate( hptr % history )
294 hptr % history % initialized = .false.
295 end if
296
297
298
299
300
302 & hptr % name, fullfilename )
303
304 end do wholeloop
305
306 nullify( hptr )
307 nullify( hptr_prev )
308
309
310
311
312
313 gthstnml % define_mode = .false.
314999 continue
315 call storeerror( stat, subname, err, cause_c )
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
エラー等を保持
integer, parameter, public hst_ebadslice
integer, parameter, public dc_enotinit
-400 以下: dc ユーティリティのエラー
integer, parameter, public hst_eintfile
integer, parameter, public hst_ebadorigin
integer, parameter, public hst_ebadterminus
integer, parameter, public hst_enotindefine
-500 以下: データ入出力層のエラー
integer, parameter, public hst_ebadnewfileint
character(string) function, public joinchar(carray, expr)
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
real(sp), parameter, public sp_eps
単精度実数型変数のマシンイプシロン.
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
type(hash), save, public opened_files