get_decimal_mode Subroutine

private subroutine get_decimal_mode(unit, decimal_point, iostat, iomsg)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: unit

Logical unit.

logical, intent(out) :: decimal_point

True if the decimal mode is POINT, false otherwise.

integer, intent(out) :: iostat

IO status code.

character(kind=CK,len=*), intent(inout) :: iomsg

IO status message.

Description

Get the DECIMAL changeable connection mode for the given unit.

If the unit is connected to an internal file, then the default value of DECIMAL is always returned. This may not be the actual value in force at the time of the call to this procedure.

Called By

proc~~get_decimal_mode~~CalledByGraph proc~get_decimal_mode get_decimal_mode proc~read_undelimited_listdirected read_undelimited_listdirected proc~read_undelimited_listdirected->proc~get_decimal_mode
Help

Variables

TypeVisibility AttributesNameInitial
character(len=5), public :: decimal_buffer

Buffer for INQUIRE about DECIMAL, sized for POINT or COMMA.

character(len=len(iomsg)), public :: local_iomsg

Local variant of iomsg, so it doesn't get inappropriately redefined.


Source Code

  subroutine get_decimal_mode(unit, decimal_point, iostat, iomsg)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Get the DECIMAL changeable connection mode for the given unit.
  !<
  !< If the unit is connected to an internal file, then the default value of DECIMAL is always returned. This may not be the
  !< actual value in force at the time of the call to this procedure.
  !---------------------------------------------------------------------------------------------------------------------------------
  use, intrinsic :: iso_fortran_env, only : iostat_inquire_internal_unit
  !---------------------------------------------------------------------------------------------------------------------------------
  integer,                   intent(in)    :: unit           !< Logical unit.
  logical,                   intent(out)   :: decimal_point  !< True if the decimal mode is POINT, false otherwise.
  integer,                   intent(out)   :: iostat         !< IO status code.
  character(kind=CK, len=*), intent(inout) :: iomsg          !< IO status message.
  character(5)                             :: decimal_buffer !< Buffer for INQUIRE about DECIMAL, sized for POINT or COMMA.
  character(len(iomsg))                    :: local_iomsg    !< Local variant of iomsg, so it doesn't get inappropriately redefined.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  inquire(unit, decimal=decimal_buffer, iostat=iostat, iomsg=local_iomsg)
  if (iostat == iostat_inquire_internal_unit) then
    ! no way of determining the decimal mode for an internal file
    iostat = 0
    decimal_point = .true.
    return
  else if (iostat /= 0) then
    iomsg = local_iomsg
    return
  endif
  decimal_point = decimal_buffer == 'POINT'
  !---------------------------------------------------------------------------------------------------------------------------------
  endsubroutine get_decimal_mode