Body of read_config_from_string — mirrors read_config_impl with the line array replacing the file unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text | |||
| type(config_t), | intent(out), | target | :: | cfg | ||
| type(nml_schema_t), | intent(out) | :: | sch | |||
| integer, | intent(out), | optional | :: | ierr |
Non-zero on a strict-parse failure when present; absent
behaves as today ( |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | private, | allocatable | :: | lines(:) | |||
| integer, | private | :: | n_lines |
subroutine read_config_from_string_impl(text, cfg, sch, ierr) !! Body of [[read_config_from_string]] — mirrors read_config_impl !! with the line array replacing the file unit. character(len=*), intent(in) :: text type(config_t), target, intent(out) :: cfg type(nml_schema_t), intent(out) :: sch integer, intent(out), optional :: ierr !! Non-zero on a strict-parse failure when present; absent !! behaves as today (`error stop`). character(len=:), allocatable :: lines(:) integer :: n_lines call build_rdb_schema(cfg, sch) ! Empty buffer → keep pristine defaults (mirrors the missing-file ! branch of read_config_impl). if (len_trim(text) == 0) then if (present(ierr)) ierr = OCEAN_STATUS_OK return end if call split_to_lines(text, lines, n_lines) ! Strict schema parse from the same lines: validate + APPLY every ! migrated group straight into `cfg`. Same status/errors routing ! as read_config_impl — see its comment for the rationale. if (present(ierr)) then block integer :: parse_status, e character(len=:), allocatable :: parse_errors(:) call sch%parse_lines(lines, n_lines, status=parse_status, errors=parse_errors) if (parse_status /= 0) then if (allocated(parse_errors)) then do e = 1, size(parse_errors) call error_ring_push(trim(parse_errors(e))) call logger%error(trim(parse_errors(e))) end do end if ierr = OCEAN_STATUS_ERR_CONFIG_PARSE return end if end block else call sch%parse_lines(lines, n_lines) end if call apply_time_unit_cascade(cfg) call apply_cartesian_degrees(cfg) if (present(ierr)) ierr = OCEAN_STATUS_OK end subroutine read_config_from_string_impl