cli_get_real_dp Subroutine

private subroutine cli_get_real_dp(this, name, value, err)

Read a value as real(dp), strictly.

Type Bound

cli_t

Arguments

Type IntentOptional Attributes Name
class(cli_t), intent(in) :: this
character(len=*), intent(in) :: name

Long name of a declared entry.

real(kind=dp), intent(out) :: value

Parsed value; zero when the conversion failed.

type(error_t), intent(inout), optional :: err

Set on an undeclared name or an unparsable value.


Calls

proc~~cli_get_real_dp~~CallsGraph proc~cli_get_real_dp cli_t%cli_get_real_dp interface~parse_real parse_real proc~cli_get_real_dp->interface~parse_real proc~cli_find cli_t%cli_find proc~cli_get_real_dp->proc~cli_find proc~cli_get_string cli_t%cli_get_string proc~cli_get_real_dp->proc~cli_get_string proc~error_has_error error_t%error_has_error proc~cli_get_real_dp->proc~error_has_error proc~fail~2 fail proc~cli_get_real_dp->proc~fail~2 proc~parse_real_dp_char parse_real_dp_char interface~parse_real->proc~parse_real_dp_char proc~parse_real_dp_string parse_real_dp_string interface~parse_real->proc~parse_real_dp_string proc~parse_real_sp_char parse_real_sp_char interface~parse_real->proc~parse_real_sp_char proc~parse_real_sp_string parse_real_sp_string interface~parse_real->proc~parse_real_sp_string proc~cli_get_string->proc~cli_find proc~cli_get_string->proc~fail~2 proc~error_set error_t%error_set proc~fail~2->proc~error_set proc~parse_real_wide parse_real_wide proc~parse_real_dp_char->proc~parse_real_wide proc~parse_real_dp_string->proc~parse_real_wide proc~parse_real_sp_char->proc~error_has_error proc~parse_real_sp_char->proc~error_set interface~strip strip proc~parse_real_sp_char->interface~strip proc~parse_real_sp_char->proc~parse_real_wide proc~parse_real_sp_string->proc~parse_real_sp_char proc~strip_char strip_char interface~strip->proc~strip_char proc~strip_string strip_string interface~strip->proc~strip_string proc~parse_real_wide->proc~error_has_error proc~parse_real_wide->proc~error_set proc~parse_real_wide->interface~strip proc~check_exponent check_exponent proc~parse_real_wide->proc~check_exponent proc~skip_sign skip_sign proc~parse_real_wide->proc~skip_sign proc~check_exponent->proc~error_set proc~check_exponent->proc~skip_sign proc~strip_string->interface~strip

Variables

Type Visibility Attributes Name Initial
type(error_t), private :: local
type(string_type), private :: text

Source Code

   subroutine cli_get_real_dp(this, name, value, err)
      !! Read a value as `real(dp)`, strictly.
      class(cli_t), intent(in) :: this
      character(len=*), intent(in) :: name
         !! Long name of a declared entry.
      real(dp), intent(out) :: value
         !! Parsed value; zero when the conversion failed.
      type(error_t), intent(inout), optional :: err
         !! Set on an undeclared name or an unparsable value.

      type(string_type) :: text
      type(error_t) :: local

      value = 0.0_dp
      call this%get_string(name, text, err)
      if (present(err)) then
         if (err%has_error()) return
      else
         if (this%find(name) == 0_default_int) return
      end if
      call parse_real(char(text), value, local)
      if (local%has_error()) then
         call fail(err, ERROR_PARSE, "pic_cli: "//name//" is not a real: "//char(text))
      end if
   end subroutine cli_get_real_dp