fdoc

subroutinereveal_bound_proceduresprivate

subroutine reveal_bound_procedures(p, s)

Show the procedures that shown bindings bind to, even if they are private: whoever can see the type can call them through it.

Arguments

NameTypeIntentAttributesDescription
ptype(project_t)inout

the project

stype(settings_t)in

the settings

Calls

Called by

Source

Show the code
subroutine reveal_bound_procedures(p, s)
    type(project_t), intent(inout) :: p     !! the project
    type(settings_t), intent(in) :: s       !! the settings
    integer :: k, j, target

    do k = 1, p%list%n
        if (p%list%box(k)%e%kind /= E_BOUNDPROC) cycle
        if (.not. is_shown(p%list, k)) cycle
        if (.not. allocated(p%list%box(k)%e%more%binding_ids)) cycle
        do j = 1, size(p%list%box(k)%e%more%binding_ids)
            target = p%list%box(k)%e%more%binding_ids(j)
            if (target == 0) cycle
            if (p%list%box(k)%e%generic) then
                ! a specific binding of a generic one, which may itself be private
                if (p%list%box(target)%e%kind /= E_BOUNDPROC) cycle
                if (.not. allocated(p%list%box(target)%e%more%binding_ids)) cycle
                if (p%list%box(target)%e%generic .or. size(p%list%box(target)%e%more%binding_ids) /= 1) cycle
                target = p%list%box(target)%e%more%binding_ids(1)
                if (target == 0) cycle
            end if
            call reveal(target)
        end do
    end do
    call merge_separate_procedures(p)
contains
    !> Show procedure `id`, unless it is hidden for having no documentation, or its parent is not shown.
    subroutine reveal(id)
        integer, intent(in) :: id   !! the procedure
        associate (e => p%list%box(id)%e)
            if (e%visible) return
            if (.not. (is_procedure(e%kind) .or. e%kind == E_MODPROC)) return
            if (s%hide_undoc .and. size(e%doc) == 0) return
            if (e%parent > 0) then
                if (.not. is_shown(p%list, e%parent)) return
            end if
            e%visible = .true.
        end associate
    end subroutine reveal
end subroutine reveal_bound_procedures