| Path: | src/anvarattr.f90 |
| Last Update: | Wed Jul 20 18:22:22 JST 2005 |
Copyright (C) GFD Dennou Club, 2000. All rights reserved.
| var : | type(AN_VARIABLE), intent(inout) |
| name : | character(len = *), intent(out) |
| end : | logical, intent(out), optional |
大域属性は、その名前の先頭に "+" が付加された普通の変数属性で あるかのように見える。
subroutine ANVarAttrNext(var, name, end)
implicit none
type(AN_VARIABLE), intent(inout):: var
character(len = *), intent(out):: name
type(an_variable_entry):: ent
logical, intent(out), optional:: end
character(len = NF_MAX_NAME):: attrname
integer:: stat
integer:: new_attrid
stat = vtable_lookup(var, ent)
if (stat /= NF_NOERR) goto 999
new_attrid = ent%attrid
! 最初は変数属性の検索
if (ent%attrid >= 0) then
new_attrid = ent%attrid + 1
stat = NF_INQ_ATTNAME(ent%fileid, ent%varid, new_attrid, attrname)
if (stat == NF_NOERR) then
name = attrname
stat = vtable_set_attrid(var, new_attrid)
end = .FALSE.
return
endif
new_attrid = -1
endif
! 次は大域属性の検索
stat = NF_INQ_ATTNAME(ent%fileid, NF_GLOBAL, -new_attrid, attrname)
if (stat == NF_NOERR) then
new_attrid = new_attrid - 1
name = GT_PLUS // attrname
stat = vtable_set_attrid(var, new_attrid)
end = .FALSE.
return
endif
999 continue
! ここでは attrid の再設定はしない。次呼んでもエラーになるのが適当。
end = .TRUE.
name = ""
return
end subroutine