get_toml_int Subroutine

public subroutine get_toml_int(table, key, value, context)

Arguments

Type IntentOptional Attributes Name
type(toml_table), intent(inout) :: table
type(toml_key), intent(in) :: key
integer(kind=i32), intent(out) :: value
character(len=*), intent(in) :: context

Calls

proc~~get_toml_int~~CallsGraph proc~get_toml_int get_toml_int get_value get_value proc~get_toml_int->get_value proc~require_toml_success require_toml_success proc~get_toml_int->proc~require_toml_success proc~stop_config_error stop_config_error proc~get_toml_int->proc~stop_config_error proc~require_toml_success->proc~stop_config_error

Source Code

  subroutine get_toml_int(table, key, value, context)
    type(toml_table), intent(inout) :: table
    type(toml_key), intent(in) :: key
    integer(i32), intent(out) :: value
    character(len=*), intent(in) :: context
    integer :: stat
    integer(i64) :: tmp

    call get_value(table, key, tmp, stat=stat)
    call require_toml_success(stat, context)
    if (tmp > int(huge(0_i32), i64) .or. tmp < -int(huge(0_i32), i64) - 1_i64) then
      call stop_config_error(trim(context)//' must fit a 32-bit signed integer.')
    end if
    value = int(tmp, i32)
  end subroutine get_toml_int