179
180
181
182
183
184
185
192 implicit none
193 type(GT_HISTORY_ATTR), intent(in) :: from(:)
194 type(GT_HISTORY_ATTR), intent(out) :: to(:)
195 logical, intent(out), optional :: err
196 integer :: i, stat
197 character(STRING) :: cause_c
198 character(STRING), parameter:: subname = "copy_attrs"
199 continue
202 cause_c = ''
203 call dbgmessage(
'size(from)=<%d>, size(to)=<%d>, So copy <%d> times.', &
204 & i=(/ size(from), size(to), min(size(from),size(to)) /) )
205 if ( size(to) < size(from) ) then
207 cause_c = 'from is larger than to'
208 goto 999
209 end if
210
211 do i = 1, min( size(from), size(to) )
212
213 to(i)%attrname = from(i)%attrname
214 to(i)%attrtype = from(i)%attrtype
215 to(i)%array = from(i)%array
216
217 if (
strhead(
'char', trim(
lchar(from(i)%attrtype))) )
then
218 to(i)%Charvalue = from(i)%Charvalue
220 &
lchar(
'Int'), trim(
lchar(from(i)%attrtype))))
then
221 if ( from(i)%array ) then
222 allocate( to(i)%Intarray( size(from(i)%Intarray) ) )
223 to(i)%Intarray = from(i)%Intarray
224 else
225 to(i)%Intvalue = from(i)%Intvalue
226 endif
228 &
lchar(
'Real'), trim(
lchar(from(i)%attrtype))))
then
229 if ( from(i)%array ) then
230 allocate( to(i)%Realarray( size(from(i)%Realarray) ) )
231 to(i)%Realarray = from(i)%Realarray
232 else
233 to(i)%Realvalue = from(i)%Realvalue
234 endif
236 &
lchar(
'Double'), trim(
lchar(from(i)%attrtype))))
then
237 if ( from(i)%array ) then
238 allocate( to(i)%Doublearray( size(from(i)%Doublearray) ) )
239 to(i)%Doublearray = from(i)%Doublearray
240 else
241 to(i)%Doublevalue = from(i)%Doublevalue
242 endif
243 elseif (
strhead(
'logical', trim(
lchar(from(i)%attrtype))) )
then
244 to(i)%Logicalvalue = from(i)%Logicalvalue
245 else
247 cause_c = from(i)%attrtype
248 goto 999
249 endif
250 enddo
251999 continue
252 call storeerror(stat, subname, err, cause_c=cause_c)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
エラー等を保持
integer, parameter, public gt_eargsizemismatch
integer, parameter, public gt_ebadattrname
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)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ