Print data with a pretty format.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
||
character, | intent(in), | optional | :: | pref | Prefixing string. |
|
integer(kind=I4P), | intent(out), | optional | :: | iostat | IO error. |
|
character, | intent(out), | optional | :: | iomsg | IO error message. |
subroutine print_section(self, unit, retain_comments, pref, iostat, iomsg)
!< Print data with a pretty format.
class(section), intent(in) :: self !< Section data.
integer(I4P), intent(in) :: unit !< Logic unit.
logical, intent(in) :: retain_comments !< Flag for retaining eventual comments.
character(*), intent(in), optional :: pref !< Prefixing string.
integer(I4P), intent(out), optional :: iostat !< IO error.
character(*), intent(out), optional :: iomsg !< IO error message.
character(len=:), allocatable :: prefd !< Prefixing string.
integer(I4P) :: iostatd !< IO error.
character(500) :: iomsgd !< Temporary variable for IO error message.
integer(I4P) :: o !< Counter.
prefd = '' ; if (present(pref)) prefd = pref
if (allocated(self%sname)) write(unit=unit, fmt='(A)', iostat=iostatd, iomsg=iomsgd)prefd//'['//self%sname//']'
if (allocated(self%options)) then
do o=1, size(self%options, dim=1)
call self%options(o)%print(pref=prefd//' ', iostat=iostatd, iomsg=iomsgd, unit=unit, retain_comments=retain_comments)
enddo
endif
if (present(iostat)) iostat = iostatd
if (present(iomsg)) iomsg = iomsgd
endsubroutine print_section