gdmemvarattrdel.f90

Path: gtdata/gtdata_memory/gdmemvarattrdel.f90
Last Update: Mon May 25 18:47:27 +0900 2009

Methods

Included Modules

gtdata_memory_types gtdata_memory_internal dc_error netcdf_f77

Public Instance methods

Subroutine :
var :type(GD_MEM_VARIABLE), intent(in)
name :character(len = *), intent(in)
err :logical, intent(out), optional

[Source]

subroutine GDMemVarAttrDel(var, name, err)
  use gtdata_memory_types, only: GD_MEM_VARIABLE, GD_MEM_VARIABLE_ENTRY, GD_MEM_ATTR_CHAIN
  use gtdata_memory_internal, only: memtab_lookup
  use dc_error, only: StoreError
  use netcdf_f77, only: NF_ENOTATT, nf_noerr
  type(GD_MEM_VARIABLE), intent(in):: var
  character(len = *), intent(in):: name
  logical, intent(out), optional:: err
  type(GD_MEM_VARIABLE_ENTRY), pointer:: ent
  type(GD_MEM_ATTR_CHAIN), pointer:: p, prev
  integer:: stat
  stat = memtab_lookup(var, ent)
  if (stat /= nf_noerr) goto 999
  nullify(prev)
  p => ent%attr
  do
    if (.not. associated(p)) exit
    if (p%name == name) then
      if (associated(p%cbuf)) deallocate(p%cbuf)
      prev%next => p%next
      deallocate(p)
      call StoreError(nf_noerr, "GDMemVarAttrDel", err)
      return
    endif
    prev => p
    p => p%next
  enddo
  stat = nf_enotatt
999 continue
  call StoreError(stat, "GDMemVarAttrDel", err, cause_c=name)
end subroutine GDMemVarAttrDel

[Validate]