The main documentation of the NotInSet Procedure contains additional explanation of this code listing.
define([NOT_IN_SET_ROUTINE],[
ifelse($1, [character], [
pushdef([TYPE], [$1,*])
pushdef([NotInSet_TYPE], expand(NotInSet_$1))
],[
pushdef([TYPE], [$1])
pushdef([NotInSet_TYPE], expand(NotInSet_TYPE))
])
function NotInSet_TYPE (X, Set) result(NotInSet)
! Input variables.
type(TYPE), intent(in) :: X ! Variable to be checked.
type(TYPE), dimension(:), intent(in) :: Set ! The set to check.
! Output variable.
type(logical) :: NotInSet ! Result of check.
! Internal variable.
type(integer) :: element ! Element loop counter.
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Verify requirements - none.
! NotInSet is true if X is not in the set.
NotInSet = .true.
do element = 1, SIZE(Set)
NotInSet = NotInSet .and. X /= Set(element)
end do
! Verify guarantees -- none.
return
end function NotInSet_TYPE
popdef([TYPE])
popdef([NotInSet_TYPE])
])
fortext([Type],[real integer character],[
NOT_IN_SET_ROUTINE(Type)
])