toml-f のルートテーブルから既知セクションを読み込む。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(inout) | :: | cfg | |||
| type(config_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(config_toml_table), intent(inout) :: document type(app_config_authoring), intent(inout) :: authoring type(toml_key), allocatable :: keys(:) type(config_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) case ('domain') if (.not. associated(section)) error stop 'TOML section [domain] must be a table.' call apply_domain_toml_table(section, authoring%domain) case ('field_boundary') if (.not. associated(section)) error stop 'TOML section [field_boundary] must be a table.' call apply_field_boundary_toml_table(section, authoring%field_boundary) case ('particle_boundary') if (.not. associated(section)) error stop 'TOML section [particle_boundary] must be a table.' call apply_particle_boundary_toml_table(section, authoring%particle_boundary) case ('reservoir') if (.not. associated(section)) error stop 'TOML section [reservoir] must be a table.' call apply_reservoir_toml_table(section, authoring%reservoir) case ('surface_current_model') if (.not. associated(section)) error stop 'TOML section [surface_current_model] must be a table.' call apply_surface_current_model_toml_table(cfg, section) case ('particles') if (.not. associated(section)) error stop 'TOML section [particles] must be a table.' call apply_particles_toml_table(cfg, section, authoring) case ('periodic2') if (.not. associated(section)) error stop 'TOML section [periodic2] must be a table.' call apply_periodic2_toml_table(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