fdoc

subroutineload_fpm_settingsprivate

subroutine load_fpm_settings(path, s, found, front, stat, errmsg)

Read the [extra.fdoc] or [extra.ford] table of fpm.toml file path, if there is one.

Arguments

NameTypeIntentAttributesDescription
pathcharacter(len=*)in

the file

stype(settings_t)inout

the settings

foundlogicalout

true if a table exists

frontcharacter(len=:)outallocatable

its front_page, if it has one

statintegerout

nonzero on failure

errmsgcharacter(len=:)outallocatable

what is wrong

Calls

Source

Show the code
subroutine load_fpm_settings(path, s, found, front, stat, errmsg)
    character(len=*), intent(in) :: path                !! the file
    type(settings_t), intent(inout) :: s                !! the settings
    logical, intent(out) :: found                       !! true if a table exists
    character(len=:), allocatable, intent(out) :: front !! its `front_page`, if it has one
    integer, intent(out) :: stat                        !! nonzero on failure
    character(len=:), allocatable, intent(out) :: errmsg  !! what is wrong
    type(toml_table), allocatable :: top
    type(toml_table), pointer :: extra, table
    type(toml_error), allocatable :: error
    character(len=:), allocatable :: file
    logical :: exists

    stat = 0
    found = .false.
    inquire (file=path, exist=exists)
    if (.not. exists) return
    call toml_load(top, path, error=error)
    if (allocated(error)) then
        stat = 1
        errmsg = path//': '//error%message
        return
    end if
    call get_value(top, 'extra', extra, requested=.false.)
    if (.not. associated(extra)) return
    call get_value(extra, 'fdoc', table, requested=.false.)
    if (.not. associated(table)) call get_value(extra, 'ford', table, requested=.false.)
    if (.not. associated(table)) return
    found = .true.
    call get_value(table, 'front_page', front)
    call get_value(table, 'front_page_file', file)
    if (allocated(file)) then
        call read_whole_file(join_path(parent_directory(path), file), front, stat, errmsg)
        if (stat /= 0) return
    end if
    call apply_table(table, s, stat, errmsg)
end subroutine load_fpm_settings

Graphs

Calls

Called by