TOML の scalar または最大3成分数値配列キーを読み込む。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(toml_table), | intent(inout) | :: | table | |||
| type(toml_key), | intent(in) | :: | key | |||
| real(kind=dp), | intent(out) | :: | value(3) | |||
| integer(kind=i32), | intent(out) | :: | value_len | |||
| character(len=*), | intent(in) | :: | context |
subroutine get_toml_real_scalar_or_array3(table, key, value, value_len, context) type(toml_table), intent(inout) :: table type(toml_key), intent(in) :: key real(dp), intent(out) :: value(3) integer(i32), intent(out) :: value_len character(len=*), intent(in) :: context type(toml_array), pointer :: array real(dp) :: scalar_value integer :: i, n, stat value = 0.0d0 value_len = 0_i32 call get_value(table, key, scalar_value, stat=stat) if (stat == toml_stat%success) then value(1) = scalar_value value_len = 1_i32 return end if nullify (array) call get_value(table, key, array, stat=stat) call require_toml_success(stat, context) if (.not. associated(array)) error stop 'Invalid TOML value for '//trim(context)//'.' n = toml_len(array) if (n < 1 .or. n > 3) then error stop trim(context)//' must be a number or an array of 1 to 3 numbers.' end if do i = 1, n call get_value(array, i, value(i), stat=stat) call require_toml_success(stat, context) end do value_len = int(n, i32) end subroutine get_toml_real_scalar_or_array3