11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
36 use dc_trace, only: beginsub, endsub
37 use dc_string, only: putline, printf, split, strinclude, stoa, joinchar
43 use dc_message, only: messagenotify
44 implicit none
45 type(GTHST_NMLINFO), intent(inout):: gthstnml
46 logical, intent(out), optional:: err
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 character(STRING):: opname, opfile
65 logical:: end
66
67
68
69
70 character(STRING):: fullfilename
71 type(GTHST_NMLINFO_ENTRY), pointer:: hptr =>null()
72 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_prev =>null()
73 integer:: stat
74 character(STRING):: cause_c
75 character(*), parameter:: subname = 'HstNmlInfoEndDefine'
76 continue
77 call beginsub( subname )
79 cause_c = ''
80
81
82
83
84
85 if ( .not. gthstnml % initialized ) then
87 cause_c = 'GTHST_NMLINFO'
88 goto 999
89 end if
90
91 if ( .not. gthstnml % define_mode ) then
93 cause_c = 'EndDefine'
94 goto 999
95 end if
96
97
98
99
100
101 hptr => gthstnml % gthstnml_list
102 if ( .not. associated( hptr % history ) ) then
103 allocate( hptr % history )
104 end if
105 wholeloop : do while ( associated( hptr % next ) )
106 call listnext( gthstnml_list = hptr )
107 if ( trim(hptr % name) == '' .or. trim(hptr % file) == '' ) &
108 & cycle wholeloop
109
110 fullfilename = trim( hptr % fileprefix ) // hptr % file
111
112
113
114
115
116 nullify( hptr_prev )
118 searchloop : do
120 & opname, opfile, end )
121 if ( end ) exit searchloop
122 if ( trim(opfile) /= trim(fullfilename) ) cycle searchloop
123 hptr_prev => gthstnml % gthstnml_list
124
126 & name = opname )
127 if ( .not. associated( hptr_prev ) ) cycle searchloop
128 if ( trim(hptr % name) == trim(hptr_prev % name) ) cycle searchloop
129
130
131
132
133 if ( hptr % interval_value /= hptr_prev % interval_value ) then
134 call messagenotify( 'W', subname, &
135 & '@interval_value=%r (var=%a) and @interval_value=%r (var=%a) are applied to a file "%a"', &
136 & r = (/hptr % interval_value, hptr_prev % interval_value/), &
137 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
139 cause_c = fullfilename
140 goto 999
141 elseif ( hptr % interval_unit /= hptr_prev % interval_unit ) then
142 call messagenotify( 'W', subname, &
143 & '@interval_unit=%a (var=%a) and @interval_unit=%a (var=%a) are applied to a file "%a"', &
144 & ca = stoa(hptr % interval_unit, hptr % name, &
145 & hptr_prev % interval_unit, hptr_prev % name, &
146 & fullfilename) )
148 cause_c = fullfilename
149 goto 999
150 end if
151
152
153
154
155 if ( hptr % origin_value /= hptr_prev % origin_value ) then
156 call messagenotify( 'W', subname, &
157 & '@origin_value=%r (var=%a) and @origin_value=%r (var=%a) are applied to a file "%a"', &
158 & r = (/hptr % origin_value, hptr_prev % origin_value/), &
159 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
161 cause_c = fullfilename
162 goto 999
163 elseif ( hptr % origin_unit /= hptr_prev % origin_unit ) then
164 call messagenotify( 'W', subname, &
165 & '@origin_unit=%a (var=%a) and @origin_unit=%a (var=%a) are applied to a file "%a"', &
166 & ca = stoa(hptr % origin_unit, hptr % name, &
167 & hptr_prev % origin_unit, hptr_prev % name, &
168 & fullfilename) )
170 cause_c = fullfilename
171 goto 999
172 end if
173
174
175
176
177 if ( hptr % terminus_value /= hptr_prev % terminus_value ) then
178 call messagenotify( 'W', subname, &
179 & '@terminus_value=%r (var=%a) and @terminus_value=%r (var=%a) are applied to a file "%a"', &
180 & r = (/hptr % terminus_value, hptr_prev % terminus_value/), &
181 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
183 cause_c = fullfilename
184 goto 999
185 elseif ( hptr % terminus_unit /= hptr_prev % terminus_unit ) then
186 call messagenotify( 'W', subname, &
187 & '@terminus_unit=%a (var=%a) and @terminus_unit=%a (var=%a) are applied to a file "%a"', &
188 & ca = stoa(hptr % terminus_unit, hptr % name, &
189 & hptr_prev % terminus_unit, hptr_prev % name, &
190 & fullfilename) )
192 cause_c = fullfilename
193 goto 999
194 end if
195
196
197
198
199 if ( ( hptr % newfile_intvalue > 0.0 ) &
200 & .or. ( hptr_prev % newfile_intvalue > 0.0 ) ) then
201 call messagenotify( 'W', subname, &
202 & 'when @newfile_intvalue=%d (var=%a) > 0 or' // &
203 & ' @newfile_intvalue=%d (var=%a) > 0, multiple variables can not be output to one file "%a"', &
204 & i = (/hptr % newfile_intvalue, hptr_prev % newfile_intvalue/), &
205 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
207 cause_c = fullfilename
208 goto 999
209 end if
210
211
212
213
214 if ( hptr % newfile_intvalue /= hptr_prev % newfile_intvalue ) then
215 call messagenotify( 'W', subname, &
216 & '@newfile_intvalue=%d (var=%a) and @newfile_intvalue=%d (var=%a) are applied to a file "%a"', &
217 & i = (/hptr % newfile_intvalue, hptr_prev % newfile_intvalue/), &
218 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
220 cause_c = fullfilename
221 goto 999
222 elseif ( hptr % newfile_intunit /= hptr_prev % newfile_intunit ) then
223 call messagenotify( 'W', subname, &
224 & '@newfile_intunit=%a (var=%a) and @newfile_intunit=%a (var=%a) are applied to a file "%a"', &
225 & ca = stoa(hptr % newfile_intunit, hptr % name, &
226 & hptr_prev % newfile_intunit, hptr_prev % name, &
227 & fullfilename) )
229 cause_c = fullfilename
230 goto 999
231 end if
232
233
234
235
236
237 if ( any( hptr % slice_start /= hptr_prev % slice_start ) ) then
238 call messagenotify( 'W', subname, &
239 & '@slice_start=%*d (var=%a) and @slice_start=%*d (var=%a) are applied to a file "%a"', &
240 & i = (/hptr % slice_start(1:10), hptr_prev % slice_start(1:10)/), &
241 & n = (/10, 10/), &
242 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
244 cause_c = fullfilename
245 goto 999
246 elseif ( any( hptr % slice_end /= hptr_prev % slice_end ) ) then
247 call messagenotify( 'W', subname, &
248 & '@slice_end=%*d (var=%a) and @slice_end=%*d (var=%a) are applied to a file "%a"', &
249 & i = (/hptr % slice_end(1:10), hptr_prev % slice_end(1:10)/), &
250 & n = (/10, 10/), &
251 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
253 cause_c = fullfilename
254 goto 999
255 elseif ( any( hptr % slice_stride /= hptr_prev % slice_stride ) ) then
256 call messagenotify( 'W', subname, &
257 & '@slice_stride=%*d (var=%a) and @slice_stride=%*d (var=%a) are applied to a file "%a"', &
258 & i = (/hptr % slice_stride(1:10), hptr_prev % slice_stride(1:10)/), &
259 & n = (/10, 10/), &
260 & ca = stoa(hptr % name, hptr_prev % name, fullfilename) )
262 cause_c = fullfilename
263 goto 999
264 end if
265
266
267
268
269
270 hptr % history => hptr_prev % history
271 exit searchloop
272 end do searchloop
273
274
275
276
277
278 if ( .not. associated( hptr % history ) ) then
279 allocate( hptr % history )
280 hptr % history % initialized = .false.
281 end if
282
283
284
285
286
288 & hptr % name, fullfilename )
289
290 end do wholeloop
291
292 nullify( hptr )
293 nullify( hptr_prev )
294
295
296
297
298
299 gthstnml % define_mode = .false.
300999 continue
301 call storeerror( stat, subname, err, cause_c )
302 call endsub( subname )
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public hst_ebadslice
integer, parameter, public dc_enotinit
integer, parameter, public hst_eintfile
integer, parameter, public hst_ebadorigin
integer, parameter, public dc_noerr
integer, parameter, public hst_ebadterminus
integer, parameter, public hst_enotindefine
integer, parameter, public hst_ebadnewfileint
Provides kind type parameter values.
integer, parameter, public stdout
Unit number for Standard OUTPUT
integer, parameter, public token
Character length for word, token
integer, parameter, public dp
Double Precision Real number
integer, parameter, public string
Character length for string
type(hash), save, public opened_files