In-memory sibling of read_config: build + strict-parse +
apply a namelist held entirely in the text buffer (newline-
separated), with NO filesystem touch — no temp file, no chdir,
no cleanup. Same validation behaviour as the file path (the
schema parser and the native &ocean_bc_nml read both run from
the in-memory line array); same error stop default and same
optional non-aborting ierr as read_config.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
Whole namelist as one string (records separated by ‘\n’). |
||
| type(config_t), | intent(out), | target | :: | cfg | ||
| type(nml_schema_t), | intent(out), | optional | :: | schema | ||
| integer, | intent(out), | optional | :: | ierr |
Non-zero on a strict-parse failure when present; absent
behaves as today ( |
subroutine read_config_from_string(text, cfg, schema, ierr) !! In-memory sibling of [[read_config]]: build + strict-parse + !! apply a namelist held entirely in the `text` buffer (newline- !! separated), with NO filesystem touch — no temp file, no `chdir`, !! no cleanup. Same validation behaviour as the file path (the !! schema parser and the native &ocean_bc_nml read both run from !! the in-memory line array); same `error stop` default and same !! optional non-aborting `ierr` as [[read_config]]. character(len=*), intent(in) :: text !! Whole namelist as one string (records separated by '\n'). type(config_t), target, intent(out) :: cfg type(nml_schema_t), intent(out), optional :: schema integer, intent(out), optional :: ierr !! Non-zero on a strict-parse failure when present; absent !! behaves as today (`error stop`). The natural FFI/create() !! door: a bad namelist string becomes a returned status !! instead of aborting the host process. if (present(schema)) then call read_config_from_string_impl(text, cfg, schema, ierr=ierr) else block type(nml_schema_t) :: sch call read_config_from_string_impl(text, cfg, sch, ierr=ierr) end block end if end subroutine read_config_from_string