Traverse operating system tables to obtain profiles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
character(len=:), | intent(in), | allocatable | :: | compiler_name |
Name of compiler |
|
type(toml_key), | intent(in), | allocatable | :: | os_list(:) |
List of OSs in table with profile name and compiler name given |
|
type(toml_table), | intent(in), | pointer | :: | table |
Table containing OS tables |
|
type(profile_config_t), | intent(inout), | allocatable | :: | profiles(:) |
List of profiles |
|
integer, | intent(inout) | :: | profindex |
Index in the list of profiles |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | ios | ||||
logical, | public | :: | is_key_val | ||||
logical, | public | :: | is_valid | ||||
type(toml_key), | public, | allocatable | :: | key_list(:) | |||
character(len=:), | public, | allocatable | :: | l_os_name | |||
character(len=:), | public, | allocatable | :: | os_name | |||
type(toml_table), | public, | pointer | :: | os_node | |||
integer, | public | :: | os_type | ||||
integer, | public | :: | stat |
subroutine traverse_oss(profile_name, compiler_name, os_list, table, profiles, profindex, error)
!> Name of profile
character(len=:), allocatable, intent(in) :: profile_name
!> Name of compiler
character(len=:), allocatable, intent(in) :: compiler_name
!> List of OSs in table with profile name and compiler name given
type(toml_key), allocatable, intent(in) :: os_list(:)
!> Table containing OS tables
type(toml_table), pointer, intent(in) :: table
!> Error handling
type(error_t), allocatable, intent(out) :: error
!> List of profiles
type(profile_config_t), allocatable, intent(inout) :: profiles(:)
!> Index in the list of profiles
integer, intent(inout) :: profindex
type(toml_key), allocatable :: key_list(:)
character(len=:), allocatable :: os_name, l_os_name
type(toml_table), pointer :: os_node
integer :: ios, stat, os_type
logical :: is_valid, is_key_val
if (size(os_list)<1) return
do ios = 1, size(os_list)
os_name = os_list(ios)%key
call validate_os_name(os_name, is_valid)
if (is_valid) then
call get_value(table, os_name, os_node, stat=stat)
if (stat /= toml_stat%success) then
call syntax_error(error, "os "//os_name//" has to be a table")
return
end if
call os_node%get_keys(key_list)
call match_os_type(os_name, os_type)
call get_flags(profile_name, compiler_name, os_type, key_list, os_node, profiles, profindex, .true.)
else
! Not lowercase OS name
l_os_name = lower(os_name)
call validate_os_name(l_os_name, is_valid)
if (is_valid) then
call fatal_error(error,'*traverse_oss*:Error: Name of the operating system must be a lowercase string.')
end if
if (allocated(error)) return
! Missing OS name
is_key_val = .false.
os_name = os_list(ios)%key
call get_value(table, os_name, os_node, stat=stat)
if (stat /= toml_stat%success) then
is_key_val = .true.
end if
os_node=>table
os_type = OS_ALL
call get_flags(profile_name, compiler_name, os_type, os_list, os_node, profiles, profindex, .false.)
end if
end do
end subroutine traverse_oss