fdoc

subroutinedescribeprivate

subroutine describe(list, id, text, rank)

The text and rank of the type of variable id. Anything else, such as a dummy procedure, is procedure.

Arguments

NameTypeIntentAttributesDescription
listtype(entity_list_t)in

the entities

idintegerin

the variable

textcharacter(len=:)outallocatable

its type

rankintegerout

its rank

Calls

Source

Show the code
subroutine describe(list, id, text, rank)
    type(entity_list_t), intent(in) :: list             !! the entities
    integer, intent(in) :: id                           !! the variable
    character(len=:), allocatable, intent(out) :: text  !! its type
    integer, intent(out) :: rank                        !! its rank
    type(buffer_t) :: b

    rank = 0
    text = 'procedure'
    if (id == 0) return
    associate (e => list%box(id)%e)
        if (e%kind /= E_VARIABLE .or. .not. allocated(e%vartype)) return
        call add(b, e%vartype)
        if (allocated(e%type_kind) .and. allocated(e%strlen)) then
            call add(b, '(len='//e%strlen//', '//e%type_kind//')')
        else if (allocated(e%type_kind)) then
            call add(b, '('//e%type_kind//')')
        else if (allocated(e%strlen)) then
            call add(b, '(len='//e%strlen//')')
        else if (allocated(e%proto)) then
            call add(b, '('//e%proto(1)%s//')')
        end if
        if (allocated(e%dimension)) rank = rank_of(e%dimension)
    end associate
    call take(b, text)
end subroutine describe

Graphs

Calls

Called by