fdoc

subroutinelink_callsprivate

subroutine link_calls(p, id)

Find what the calls of entity id refer to.

Arguments

NameTypeIntentAttributesDescription
ptype(project_t)inout

the project

idintegerin

the procedure or program

Calls

Source

Show the code
subroutine link_calls(p, id)
    type(project_t), intent(inout) :: p     !! the project
    integer, intent(in) :: id               !! the procedure or program
    type(string_t), allocatable :: parts(:)
    integer :: k, item, context, j

    allocate (p%list%box(id)%e%call_ids(0), p%list%box(id)%e%more%unknown_calls(0))
    if (.not. allocated(p%list%box(id)%e%more%calls)) return
    do k = 1, size(p%list%box(id)%e%more%calls)
        parts = split_on(p%list%box(id)%e%more%calls(k)%s, '%')
        context = id
        do j = 1, size(parts) - 1
            context = context_of(p, label_item(p, context, parts(j)%s))
            if (context == 0) exit
        end do
        item = 0
        if (context > 0) item = label_item(p, context, parts(size(parts))%s)
        if (item == 0) then
            call push(p%list%box(id)%e%more%unknown_calls, parts(size(parts))%s)
        else if (p%list%box(item)%e%kind /= E_VARIABLE .and. p%list%box(item)%e%kind /= E_TYPE) then
            call push_int(p%list%box(id)%e%call_ids, item)
        end if
    end do
end subroutine link_calls

Graphs

Calls

Called by