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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| list | type(entity_list_t) | in | the entities | |
| id | integer | in | the variable | |
| text | character(len=:) | out | allocatable | its type |
| rank | integer | out | 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