fdoc

subroutinesignatureprivate

subroutine signature(site, id, b)

Write the declaration of a procedure.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

idintegerin

the procedure

btype(buffer_t)inout

the HTML

Calls

Source

Show the code
subroutine signature(site, id, b)
    type(site_t), intent(in) :: site        !! the site
    integer, intent(in) :: id               !! the procedure
    type(buffer_t), intent(inout) :: b      !! the HTML
    integer :: k

    associate (e => site%p%list%box(id)%e)
        call add(b, '<div class="sig">')
        if (allocated(e%attribs)) then
            do k = 1, size(e%attribs)
                call add(b, '<span class="k">')
                call html_escape(e%attribs(k)%s, b, .false.)
                call add(b, '</span> ')
            end do
        end if
        if (e%kind == E_FUNCTION .and. e%result > 0) then
            call write_type(site, site%p%list%box(e%result)%e, b)
            call add(b, ' ')
        end if
        select case (e%kind)
        case (E_FUNCTION); call add(b, '<span class="k">function</span> ')
        case (E_SUBROUTINE); call add(b, '<span class="k">subroutine</span> ')
        case (E_MODPROC); call add(b, '<span class="k">module procedure</span> ')
        end select
        call html_escape(e%name, b, .false.)
        if (allocated(e%more%args)) then
            call add(b, '(')
            call signature_arguments(site, e, b)
            call add(b, ')')
        end if
        if (e%kind == E_FUNCTION) then
            if (allocated(e%more%result_name)) then
                if (lowercase(e%more%result_name) /= lowercase(e%name)) then
                    call add(b, ' <span class="k">result</span>(')
                    call html_escape(e%more%result_name, b, .false.)
                    call add(b, ')')
                end if
            end if
        end if
        if (allocated(e%more%bind_c)) then
            call add(b, ' <span class="k">bind</span>(')
            call html_escape(e%more%bind_c, b, .false.)
            call add(b, ')')
        end if
        call add(b, '</div>'//achar(10))
    end associate
end subroutine signature

Graphs

Calls

Called by