toml-f のルートテーブルから既知セクションを読み込む。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(inout) | :: | cfg | |||
| type(toml_table), | intent(inout) | :: | document | |||
| type(app_config_authoring), | intent(inout) | :: | authoring |
subroutine apply_toml_document(cfg, document, authoring) type(app_config), intent(inout) :: cfg type(toml_table), intent(inout) :: document type(app_config_authoring), intent(inout) :: authoring type(toml_key), allocatable :: keys(:) type(toml_table), pointer :: section integer :: ikey, stat character(len=:), allocatable :: key_name call document%get_keys(keys) do ikey = 1, size(keys) key_name = lower_ascii(trim(keys(ikey)%key)) nullify (section) call get_value(document, keys(ikey), section, requested=.false., stat=stat) call require_toml_success(stat, '['//trim(keys(ikey)%key)//']') select case (trim(key_name)) case ('sim') if (.not. associated(section)) error stop 'TOML section [sim] must be a table.' call apply_sim_toml_table(cfg, section, authoring%sim) case ('particles') if (.not. associated(section)) error stop 'TOML section [particles] must be a table.' call apply_particles_toml_table(cfg, section, authoring) case ('mesh') if (.not. associated(section)) error stop 'TOML section [mesh] must be a table.' call apply_mesh_toml_table(cfg, section, authoring) case ('output') if (.not. associated(section)) error stop 'TOML section [output] must be a table.' call apply_output_toml_table(cfg, section) case default error stop 'Unknown TOML section or top-level key: '//trim(keys(ikey)%key) end select end do end subroutine apply_toml_document