Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it.
Get the DELIM changeable connection mode for the given unit.
If the unit is connected to an internal file, then the default value of NONE is always returned.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | unit | The unit for the connection. |
||
| character(kind=len=1,CK), | intent(out) | :: | delim | Represents the value of the DELIM mode. |
||
| integer, | intent(out) | :: | iostat | IOSTAT error code, non-zero on error. |
||
| character(len=*), | intent(inout) | :: | iomsg | IOMSG explanatory message - only defined if iostat is non-zero. |
subroutine get_delimiter_mode(unit, delim, iostat, iomsg)
!---------------------------------------------------------------------------------------------------------------------------------
!< Get the DELIM changeable connection mode for the given unit.
!<
!< If the unit is connected to an internal file, then the default value of NONE is always returned.
!---------------------------------------------------------------------------------------------------------------------------------
use, intrinsic :: iso_fortran_env, only : iostat_inquire_internal_unit
!---------------------------------------------------------------------------------------------------------------------------------
integer, intent(in) :: unit !< The unit for the connection.
character(len=1, kind=CK), intent(out) :: delim !< Represents the value of the DELIM mode.
integer, intent(out) :: iostat !< IOSTAT error code, non-zero on error.
character(*), intent(inout) :: iomsg !< IOMSG explanatory message - only defined if iostat is non-zero.
character(10) :: delim_buffer !< Buffer for INQUIRE about DELIM, sized for APOSTROHPE.
character(len(iomsg)) :: local_iomsg !< Local variant of iomsg, so it doesn't get inappropriately redefined.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
! get the string representation of the changeable mode
inquire(unit, delim=delim_buffer, iostat=iostat, iomsg=local_iomsg)
if (iostat == iostat_inquire_internal_unit) then
! no way of determining the DELIM mode for an internal file
iostat = 0
delim = ''
return
elseif (iostat /= 0) then
iomsg = local_iomsg
return
endif
! interpret the DELIM string
if (delim_buffer == 'QUOTE') then
delim = '"'
elseif (delim_buffer == 'APOSTROPHE') then
delim = ''''
else
delim = '"'
endif
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine get_delimiter_mode