fdoc

subroutinedoxygen_paramsprivate

subroutine doxygen_params(list, id)

Move doxygen @param name text lines from procedure id to the variables they describe.

Arguments

NameTypeIntentAttributesDescription
listtype(entity_list_t)inout

the entities

idintegerin

the procedure

Calls

Source

Show the code
subroutine doxygen_params(list, id)
    type(entity_list_t), intent(inout) :: list  !! the entities
    integer, intent(in) :: id                   !! the procedure
    type(string_t), allocatable :: kept(:), words(:)
    character(len=:), allocatable :: line
    integer :: k, c, at, child
    logical :: moved

    if (.not. allocated(list%box(id)%e%doc)) return
    allocate (kept(0))
    do k = 1, size(list%box(id)%e%doc)
        line = strip(list%box(id)%e%doc(k)%s)
        moved = .false.
        if (starts_with(line, '@param')) then
            at = index(line, ']')
            if (at == 0) at = 6
            words = split_words(line(at + 1:))
            if (size(words) >= 1) then
                do c = 1, size(list%box(id)%e%children)
                    child = list%box(id)%e%children(c)
                    if (list%box(child)%e%kind /= E_VARIABLE) cycle
                    if (lowercase(list%box(child)%e%name) /= lowercase(words(1)%s)) cycle
                    call push(list%box(child)%e%doc, join(words(2:), ' '))
                    moved = .true.
                end do
            end if
        end if
        if (.not. moved) call push(kept, list%box(id)%e%doc(k)%s)
    end do
    call move_alloc(kept, list%box(id)%e%doc)
end subroutine doxygen_params

Graphs

Calls

Called by