Formatted input.
Bug
Change temporary acks: find a more precise length of the input string and avoid the trimming!
Bug
Read listdirected with and without delimiters does not work.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(inout) | :: | dtv |
The string. |
||
integer, | intent(in) | :: | unit |
Logical unit. |
||
character(len=*), | intent(in) | :: | iotype |
Edit descriptor. |
||
integer, | intent(in) | :: | v_list(:) |
Edit descriptor list. |
||
integer, | intent(out) | :: | iostat |
IO status code. |
||
character(len=*), | intent(inout) | :: | iomsg |
IO status message. |
subroutine read_formatted(dtv, unit, iotype, v_list, iostat, iomsg) !< Formatted input. !< !< @bug Change temporary acks: find a more precise length of the input string and avoid the trimming! !< !< @bug Read listdirected with and without delimiters does not work. class(string), intent(inout) :: dtv !< The string. integer, intent(in) :: unit !< Logical unit. character(len=*), intent(in) :: iotype !< Edit descriptor. integer, intent(in) :: v_list(:) !< Edit descriptor list. integer, intent(out) :: iostat !< IO status code. character(len=*), intent(inout) :: iomsg !< IO status message. character(len=len(iomsg)) :: local_iomsg !< Local variant of iomsg, so it doesn't get inappropriately redefined. character(kind=CK, len=1) :: delim !< String delimiter, if any. character(kind=CK, len=100) :: temporary !< Temporary storage string. if (iotype == 'LISTDIRECTED') then call get_next_non_blank_character_any_record(unit=unit, ch=delim, iostat=iostat, iomsg=iomsg) if (iostat/=0) return if (delim=='"'.OR.delim=="'") then call dtv%read_delimited(unit=unit, delim=delim, iostat=iostat, iomsg=local_iomsg) else ! step back before the non-blank read(unit, "(TL1)", iostat=iostat, iomsg=iomsg) if (iostat /= 0) return call dtv%read_undelimited_listdirected(unit=unit, iostat=iostat, iomsg=local_iomsg) endif if (is_iostat_eor(iostat)) then ! suppress IOSTAT_EOR iostat = 0 elseif (iostat /= 0) then iomsg = local_iomsg endif return else read(unit, "(A)", iostat=iostat, iomsg=iomsg)temporary dtv%raw = trim(temporary) endif endsubroutine read_formatted