vec_push_unique Subroutine

private subroutine vec_push_unique(buf, mbuf, n, cap, path, build_dir, mask, dep_dirs)

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(inout), allocatable :: buf(:)
integer(kind=int64), intent(inout), allocatable :: mbuf(:)
integer, intent(inout) :: n
integer, intent(inout) :: cap
character(len=*), intent(in) :: path
character(len=*), intent(in) :: build_dir
integer(kind=int64), intent(in) :: mask
type(string_t), intent(in), optional, allocatable :: dep_dirs(:)

Calls

proc~~vec_push_unique~~CallsGraph proc~vec_push_unique vec_push_unique exists exists proc~vec_push_unique->exists proc~is_ignored_path is_ignored_path proc~vec_push_unique->proc~is_ignored_path proc~is_in_dep_dirs is_in_dep_dirs proc~vec_push_unique->proc~is_in_dep_dirs proc~normalize_path normalize_path proc~vec_push_unique->proc~normalize_path proc~vec_grow vec_grow proc~vec_push_unique->proc~vec_grow proc~is_ignored_path->proc~normalize_path proc~contains_path_fragment contains_path_fragment proc~is_ignored_path->proc~contains_path_fragment proc~starts_with starts_with proc~is_ignored_path->proc~starts_with proc~is_in_dep_dirs->proc~normalize_path proc~is_in_dep_dirs->proc~starts_with proc~ends_with ends_with proc~contains_path_fragment->proc~ends_with

Called by

proc~~vec_push_unique~~CalledByGraph proc~vec_push_unique vec_push_unique proc~gather_files_with_mask gather_files_with_mask proc~gather_files_with_mask->proc~vec_push_unique proc~push_file_with_mask push_file_with_mask proc~push_file_with_mask->proc~vec_push_unique proc~compute_watch_files_from_settings compute_watch_files_from_settings proc~compute_watch_files_from_settings->proc~gather_files_with_mask proc~compute_watch_files_from_settings->proc~push_file_with_mask 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 vec_push_unique(buf, mbuf, n, cap, path, build_dir, mask, dep_dirs)
      type(string_t), allocatable, intent(inout) :: buf(:)
      integer(int64), allocatable, intent(inout) :: mbuf(:)
      integer, intent(inout) :: n, cap
      character(len=*), intent(in) :: path
      character(len=*), intent(in) :: build_dir
      integer(int64), intent(in) :: mask
      type(string_t), allocatable, intent(in), optional :: dep_dirs(:)

      character(len=:), allocatable :: p
      integer :: i

      p = normalize_path(path)
      if (len_trim(p) == 0) return

      if (is_ignored_path(p, build_dir)) then
         if (.not. present(dep_dirs)) return
         if (.not. is_in_dep_dirs(p, dep_dirs)) return
      end if

      if (.not. exists(p)) return

      do i = 1, n
         if (buf(i)%s == p) then
            mbuf(i) = ior(mbuf(i), mask)
            return
         end if
      end do

      if (n >= cap) call vec_grow(buf, mbuf, cap)

      n = n + 1
      buf(n)%s = p
      mbuf(n) = mask
   end subroutine vec_push_unique