172
173
174
175
176
177
178
185 implicit none
186 type(GT_HISTORY_ATTR), intent(in) :: from(:)
187 type(GT_HISTORY_ATTR), intent(out) :: to(:)
188 logical, intent(out), optional :: err
189 integer :: i, stat
190 character(STRING) :: cause_c
191 character(STRING), parameter:: subname = "copy_attrs"
192 continue
195 cause_c = ''
196 call dbgmessage(
'size(from)=<%d>, size(to)=<%d>, So copy <%d> times.', &
197 & i=(/ size(from), size(to), min(size(from),size(to)) /) )
198 if ( size(to) < size(from) ) then
200 cause_c = 'from is larger than to'
201 goto 999
202 end if
203
204 do i = 1, min( size(from), size(to) )
205
206 to(i)%attrname = from(i)%attrname
207 to(i)%attrtype = from(i)%attrtype
208 to(i)%array = from(i)%array
209
210 if (
strhead(
'char', trim(
lchar(from(i)%attrtype))) )
then
211 to(i)%Charvalue = from(i)%Charvalue
213 &
lchar(
'Int'), trim(
lchar(from(i)%attrtype))))
then
214 if ( from(i)%array ) then
215 allocate( to(i)%Intarray( size(from(i)%Intarray) ) )
216 to(i)%Intarray = from(i)%Intarray
217 else
218 to(i)%Intvalue = from(i)%Intvalue
219 endif
221 &
lchar(
'Real'), trim(
lchar(from(i)%attrtype))))
then
222 if ( from(i)%array ) then
223 allocate( to(i)%Realarray( size(from(i)%Realarray) ) )
224 to(i)%Realarray = from(i)%Realarray
225 else
226 to(i)%Realvalue = from(i)%Realvalue
227 endif
229 &
lchar(
'Double'), trim(
lchar(from(i)%attrtype))))
then
230 if ( from(i)%array ) then
231 allocate( to(i)%Doublearray( size(from(i)%Doublearray) ) )
232 to(i)%Doublearray = from(i)%Doublearray
233 else
234 to(i)%Doublevalue = from(i)%Doublevalue
235 endif
236 elseif (
strhead(
'logical', trim(
lchar(from(i)%attrtype))) )
then
237 to(i)%Logicalvalue = from(i)%Logicalvalue
238 else
240 cause_c = from(i)%attrtype
241 goto 999
242 endif
243 enddo
244999 continue
245 call storeerror(stat, subname, err, cause_c=cause_c)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
Error storage variables
integer, parameter, public gt_eargsizemismatch
integer, parameter, public gt_ebadattrname
Handling character types.
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
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)
Provides kind type parameter values.
integer, parameter, public string
Character length for string