fdoc

subroutinewrite_modules

subroutine write_modules(p, s, stat, errmsg)

Write modules.json, which other projects can use to link to this one.

Arguments

NameTypeIntentAttributesDescription
ptype(project_t)in

the project

stype(settings_t)in

the settings

statintegerout

nonzero on failure

errmsgcharacter(len=:)outallocatable

what is wrong

Calls

Source

Show the code
subroutine write_modules(p, s, stat, errmsg)
    type(project_t), intent(in) :: p                    !! the project
    type(settings_t), intent(in) :: s                   !! the settings
    integer, intent(out) :: stat                        !! nonzero on failure
    character(len=:), allocatable, intent(out) :: errmsg  !! what is wrong
    type(json_core) :: json
    type(json_value), pointer :: root, meta, modules, item
    character(len=:), allocatable :: text
    integer :: k

    call json%initialize(no_whitespace=.true.)
    call json%create_object(root, '')
    call json%create_object(meta, 'ford-metadata')
    call json%add(root, meta)
    call json%add(meta, 'version', 'fdoc')
    call json%create_array(modules, 'modules')
    call json%add(root, modules)
    do k = 1, size(p%modules)
        if (allocated(p%list%box(p%modules(k))%e%external_url)) cycle
        call entity_json(json, p, p%modules(k), '', k, item)
        call json%add(modules, item)
    end do
    call json%serialize(root, text)
    call json%destroy(root)
    call make_directory(s%output_dir, stat)
    call write_whole_file(join_path(s%output_dir, 'modules.json'), text, stat, errmsg)
end subroutine write_modules

Graphs

Calls

Called by