save_section Subroutine

private subroutine save_section(self, unit, retain_comments, iostat, iomsg)

Save data.

Arguments

TypeIntentOptionalAttributesName
class(section), intent(in) :: self

Section data.

integer(kind=I4P), intent(in) :: unit

Logic unit.

logical, intent(in) :: retain_comments

Flag for retaining eventual comments.

integer(kind=I4P), intent(out), optional :: iostat

IO error.

character, intent(out), optional :: iomsg

IO error message.


Contents

Source Code


Source Code

  subroutine save_section(self, unit, retain_comments, iostat, iomsg)
  !< Save data.
  class(section), intent(in)            :: self            !< Section data.
  integer(I4P),   intent(in)            :: unit            !< Logic unit.
  logical,        intent(in)            :: retain_comments !< Flag for retaining eventual comments.
  integer(I4P),   intent(out), optional :: iostat          !< IO error.
  character(*),   intent(out), optional :: iomsg           !< IO error message.
  integer(I4P)                          :: iostatd         !< IO error.
  character(500)                        :: iomsgd          !< Temporary variable for IO error message.
  integer(I4P)                          :: o               !< Counter.

  if (allocated(self%sname)) write(unit=unit, fmt='(A)', iostat=iostatd, iomsg=iomsgd)'['//self%sname//']'
  if (allocated(self%options)) then
    do o=1, size(self%options, dim=1)
      call self%options(o)%save(iostat=iostatd, iomsg=iomsgd, unit=unit, retain_comments=retain_comments)
    enddo
  endif
  if (present(iostat)) iostat = iostatd
  if (present(iomsg))  iomsg  = iomsgd
  endsubroutine save_section