functiontype_memberprivate
integer function type_member(p, id, name, kind) result(found)
The component of kind kind named name of type id, including inherited ones, or 0.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| p | type(project_t) | in | the project | |
| id | integer | in | the type | |
| name | character(len=*) | in | the name, in lowercase | |
| kind | integer | in | one of the |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| found | integer |
Source
Show the code
integer function type_member(p, id, name, kind) result(found)
type(project_t), intent(in) :: p !! the project
integer, intent(in) :: id !! the type
character(len=*), intent(in) :: name !! the name, in lowercase
integer, intent(in) :: kind !! one of the `E_*` constants
integer :: k
found = 0
associate (e => p%list%box(id)%e)
! a generic binding can be declared in several statements: the last counts
do k = size(e%children), 1, -1
if (p%list%box(e%children(k))%e%kind /= kind) cycle
if (lowercase(p%list%box(e%children(k))%e%name) == name) then
found = e%children(k)
return
end if
end do
if (.not. allocated(e%more%inherited)) return
do k = 1, size(e%more%inherited)
if (p%list%box(e%more%inherited(k))%e%kind /= kind) cycle
if (lowercase(p%list%box(e%more%inherited(k))%e%name) == name) then
found = e%more%inherited(k)
return
end if
end do
end associate
end function type_member