update Subroutine

public subroutine update(key, valin1, valin2, valin3)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key
integer, optional :: valin1
integer, optional :: valin2
integer, optional :: valin3

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: place

Source Code

subroutine update(key,valin1,valin2,valin3)
character(len=*),intent(in)      :: key
integer,optional                 :: valin1,valin2,valin3
integer                          :: place
   if(present(valin1))then
      ! find where string is or should be
      call locate(keywords,key,place)
      ! if string was not found insert it
      if(place.lt.1)then
         call insert(keywords,key,iabs(place))
         call insert(rows,valin1,iabs(place))
         call insert(cols,valin2,iabs(place))
         call insert(locs,valin3,iabs(place))
      else
         call replace(rows,valin1,place)
         call replace(cols,valin2,place)
         call replace(locs,valin3,place)
      endif
   else
      call locate(keywords,key,place)
      if(place.gt.0)then
         call remove(keywords,place)
         call remove(rows,place)
         call remove(cols,place)
         call remove(locs,place)
      endif
   endif
end subroutine update