functionindex_findpure
pure integer function index_find(table, name) result(value)
The value of name in table, or 0.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| table | type(name_index_t) | in | the table | |
| name | character(len=*) | in | the name |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| value | integer |
Calls
Source
Show the code
pure integer function index_find(table, name) result(value)
type(name_index_t), intent(in) :: table !! the table
character(len=*), intent(in) :: name !! the name
integer :: at, entry
value = 0
if (table%n == 0) return
at = name_hash(name, size(table%slots))
do
entry = table%slots(at)
if (entry == 0) return
if (len(table%keys(entry)%s) == len(name)) then
if (table%keys(entry)%s == name) then
value = table%values(entry)
return
end if
end if
at = merge(at + 1, 1, at < size(table%slots))
end do
end function index_find