select_names_or_all Subroutine

private subroutine select_names_or_all(targets, scope, names, keep)

Arguments

Type IntentOptional Attributes Name
type(build_target_ptr), intent(in) :: targets(:)
integer, intent(in) :: scope
character(len=*), intent(in), optional :: names(:)
logical, intent(inout) :: keep(:)

Calls

proc~~select_names_or_all~~CallsGraph proc~select_names_or_all select_names_or_all basename basename proc~select_names_or_all->basename glob glob proc~select_names_or_all->glob is_executable_target is_executable_target proc~select_names_or_all->is_executable_target

Called by

proc~~select_names_or_all~~CalledByGraph proc~select_names_or_all select_names_or_all proc~compute_watch_files_from_settings compute_watch_files_from_settings proc~compute_watch_files_from_settings->proc~select_names_or_all proc~rebuild_watch_list rebuild_watch_list proc~rebuild_watch_list->proc~compute_watch_files_from_settings proc~handle_manifest_change handle_manifest_change proc~handle_manifest_change->proc~rebuild_watch_list proc~watcher_init watcher_t%watcher_init proc~watcher_init->proc~rebuild_watch_list proc~watcher_run watcher_t%watcher_run proc~watcher_run->proc~rebuild_watch_list proc~watcher_run->proc~handle_manifest_change

Source Code

   subroutine select_names_or_all(targets, scope, names, keep)
      type(build_target_ptr), intent(in) :: targets(:)
      integer, intent(in) :: scope
      character(len=*), intent(in), optional :: names(:)
      logical, intent(inout) :: keep(:)

      integer :: i, j
      character(len=:), allocatable :: outbase_full, outbase_stem
      logical :: any_name

      any_name = .false.
      if (present(names)) then
         if (size(names) > 0) then
            do j = 1, size(names)
               if (len_trim(names(j)) > 0) then
                  any_name = .true.
                  exit
               end if
            end do
         end if
      end if

      if (.not. any_name) then
         do i = 1, size(targets)
            if (targets(i)%ptr%is_executable_target(scope)) keep(i) = .true.
         end do
         return
      end if

      do i = 1, size(targets)
         if (.not. targets(i)%ptr%is_executable_target(scope)) cycle
         outbase_full = basename(targets(i)%ptr%output_file)
         outbase_stem = basename(targets(i)%ptr%output_file, suffix=.false.)
         do j = 1, size(names)
            if (len_trim(names(j)) == 0) cycle
            if (glob(trim(names(j)), outbase_full) .or. glob(trim(names(j)), outbase_stem)) then
               keep(i) = .true.
               exit
            end if
         end do
      end do
   end subroutine select_names_or_all