fdoc

subroutinefind_sources

subroutine find_sources(s, files)

The source files of the project, sorted, without those excluded. Fixed-form files are left out with a warning, as they are not supported yet.

Arguments

NameTypeIntentAttributesDescription
stype(settings_t)in

the settings

filestype(string_t)outallocatabledimension(:)

paths of the files

Calls

Source

Show the code
subroutine find_sources(s, files)
    type(settings_t), intent(in) :: s                       !! the settings
    type(string_t), allocatable, intent(out) :: files(:)    !! paths of the files
    type(string_t), allocatable :: found(:), extensions(:), no_exclusions(:)
    integer :: d, k, j, skipped
    logical :: keep

    allocate (files(0), no_exclusions(0))
    extensions = [s%extensions, s%fixed_extensions]
    skipped = 0
    do d = 1, size(s%src_dir)
        if (.not. is_directory(s%src_dir(d)%s)) cycle
        call collect_files(s%src_dir(d)%s, extensions, no_exclusions, found)
        do k = 1, size(found)
            keep = .true.
            do j = 1, size(s%exclude_dir)
                if (starts_with(found(k)%s, s%exclude_dir(j)%s//'/')) keep = .false.
            end do
            do j = 1, size(s%exclude)
                if (glob_matches(s%exclude(j)%s, found(k)%s)) keep = .false.
            end do
            if (keep .and. contains_string(s%fixed_extensions, extension_of(found(k)%s)) .and. &
                .not. contains_string(s%extensions, extension_of(found(k)%s))) then
                skipped = skipped + 1
                call warn('skipping fixed-form file (not supported yet): '//found(k)%s)
                keep = .false.
            end if
            if (keep) call push(files, found(k)%s)
        end do
    end do
    call sort_strings(files)
end subroutine find_sources

Graphs

Calls

Called by