functiondump_settings
character(len=:) function dump_settings(s) result(text)
The settings as a JSON object, for comparison with FORD's. Unset options are null.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| s | type(settings_t) | in | the settings |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| text | character(len=:) | privateallocatable |
Calls
- put_text
- put_logical
- put_list
- put_map
Source
Show the code
function dump_settings(s) result(text)
type(settings_t), intent(in) :: s !! the settings
character(len=:), allocatable :: text
type(json_core) :: json
type(json_value), pointer :: root, group
integer :: k
call json%initialize()
call json%create_object(root, '')
call put_text('author', s%author)
call put_text('author_description', s%author_description)
call put_text('author_pic', s%author_pic)
call put_text('bitbucket', s%bitbucket)
call put_text('css', s%css)
call put_text('directory', s%directory)
call put_text('doc_license', s%doc_license)
call put_text('docmark', s%docmark)
call put_text('docmark_alt', s%docmark_alt)
call put_text('email', s%email)
call put_text('encoding', s%encoding)
call put_text('facebook', s%facebook)
call put_text('github', s%github)
call put_text('gitlab', s%gitlab)
call put_text('gitter_sidecar', s%gitter_sidecar)
call put_text('google_plus', s%google_plus)
call put_text('graph_dir', s%graph_dir)
call put_text('license', s%license)
call put_text('logo', s%logo)
call put_text('linkedin', s%linkedin)
call put_text('mathjax_config', s%mathjax_config)
call put_text('md_base_dir', s%md_base_dir)
call put_text('media_dir', s%media_dir)
call put_text('output_dir', s%output_dir)
call put_text('page_dir', s%page_dir)
call put_text('predocmark', s%predocmark)
call put_text('predocmark_alt', s%predocmark_alt)
call put_text('preprocessor', s%preprocessor)
call put_text('privacy_policy_url', s%privacy_policy_url)
call put_text('project', s%project)
call put_text('project_bitbucket', s%project_bitbucket)
call put_text('project_download', s%project_download)
call put_text('project_github', s%project_github)
call put_text('project_gitlab', s%project_gitlab)
call put_text('project_sourceforge', s%project_sourceforge)
call put_text('project_url', s%project_url)
call put_text('project_website', s%project_website)
call put_text('revision', s%revision)
call put_text('sort', s%sort)
call put_text('summary', s%summary)
call put_text('terms_of_service_url', s%terms_of_service_url)
call put_text('twitter', s%twitter)
call put_text('version', s%version)
call put_text('website', s%website)
call put_text('year', s%year)
call put_logical('coloured_edges', s%coloured_edges)
call put_logical('dbg', s%dbg)
call put_logical('doxygen', s%doxygen)
call put_logical('externalize', s%externalize)
call put_logical('fixed_length_limit', s%fixed_length_limit)
call put_logical('force', s%force)
call put_logical('graph', s%graph)
call put_logical('hide_undoc', s%hide_undoc)
call put_logical('incl_src', s%incl_src)
call put_logical('lower', s%lower)
call put_logical('preprocess', s%preprocess)
call put_logical('print_creation_date', s%print_creation_date)
call put_logical('proc_internals', s%proc_internals)
call put_logical('quiet', s%quiet)
call put_logical('relative', s%relative)
call put_logical('search', s%search)
call put_logical('show_proc_parent', s%show_proc_parent)
call put_logical('source', s%source)
call put_logical('warn', s%warn)
call json%add(root, 'graph_maxdepth', s%graph_maxdepth)
call json%add(root, 'graph_maxnodes', s%graph_maxnodes)
call json%add(root, 'max_frontpage_items', s%max_frontpage_items)
call put_list('copy_subdir', s%copy_subdir)
call put_list('display', s%display)
call put_list('exclude', s%exclude)
call put_list('exclude_dir', s%exclude_dir)
call put_list('extensions', s%extensions)
call put_list('extra_vartypes', s%extra_vartypes)
call put_list('fixed_extensions', s%fixed_extensions)
call put_list('fpp_extensions', s%fpp_extensions)
call put_list('html_template_dir', s%html_template_dir)
call put_list('include', s%include)
call put_list('macro', s%macro)
call put_list('md_extensions', s%md_extensions)
call put_list('src_dir', s%src_dir)
call put_map('alias', s%alias)
call put_map('external', s%external)
call put_map('extra_mods', s%extra_mods)
call json%create_object(group, 'extra_filetypes')
call json%add(root, group)
do k = 1, size(s%extra_filetypes)
call json%add(group, s%extra_filetypes(k)%extension, s%extra_filetypes(k)%comment)
end do
call json%serialize(root, text)
call json%destroy(root)
contains
!> Add a text option, `null` if it is not set.
subroutine put_text(key, value)
character(len=*), intent(in) :: key !! the option
character(len=:), allocatable, intent(in) :: value !! its value
if (allocated(value)) then
call json%add(root, key, value)
else
call json%add(root, key)
end if
end subroutine put_text
!> Add a logical option.
subroutine put_logical(key, value)
character(len=*), intent(in) :: key !! the option
logical, intent(in) :: value !! its value
call json%add(root, key, value)
end subroutine put_logical
!> Add a list option.
subroutine put_list(key, list)
character(len=*), intent(in) :: key !! the option
type(string_t), intent(in) :: list(:) !! its values
type(json_value), pointer :: array
integer :: j
call json%create_array(array, key)
call json%add(root, array)
do j = 1, size(list)
call json%add(array, '', list(j)%s)
end do
end subroutine put_list
!> Add a map option.
subroutine put_map(key, map)
character(len=*), intent(in) :: key !! the option
type(map_entry_t), intent(in) :: map(:) !! its entries
type(json_value), pointer :: object
integer :: j
call json%create_object(object, key)
call json%add(root, object)
do j = 1, size(map)
call json%add(object, map(j)%key, map(j)%value)
end do
end subroutine put_map
end function dump_settings