load_table_from_file Subroutine

public subroutine load_table_from_file(table, file, error)

Load a TOML table from a file read whole by getfile; parse errors name the file

Arguments

Type IntentOptional Attributes Name
type(toml_table), intent(out), allocatable :: table

TOML table read

character(len=*), intent(in) :: file

File to read

type(error_t), intent(out), allocatable :: error

Error handling


Source Code

    subroutine load_table_from_file(table, file, error)

        !> TOML table read
        type(toml_table), allocatable, intent(out) :: table

        !> File to read
        character(len=*), intent(in) :: file

        !> Error handling
        type(error_t), allocatable, intent(out) :: error

        character(len=:), allocatable :: text, message
        integer :: stat

        text = getfile(file, iostat=stat, iomsg=message)
        if (stat /= 0) then
            call fatal_error(error, message)
            return
        end if
        call load_table_from_text(table, text, file, error)

    end subroutine load_table_from_file