public subroutine tokenize_flags(flags, flags_array)
Tokenize a string into an array of compiler flags
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
character(len=*),
|
intent(in) |
|
|
:: |
flags |
|
type(string_t),
|
intent(out), |
|
allocatable
|
:: |
flags_array(:) |
|
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
character(len=:),
|
public, |
allocatable
|
:: |
flags_char_array(:) |
|
|
|
integer,
|
public |
|
:: |
i |
|
|
|
logical,
|
public |
|
:: |
success |
|
|
|
Source Code
subroutine tokenize_flags(flags, flags_array)
character(*), intent(in) :: flags
type(string_t), allocatable, intent(out) :: flags_array(:)
character(len=:), allocatable :: flags_char_array(:)
integer :: i
logical :: success
flags_char_array = shlex_split(flags, join_spaced=.true., keep_quotes=.true., success=success)
if (.not. success) then
allocate(flags_array(0))
return
end if
allocate(flags_array(size(flags_char_array)))
do i = 1, size(flags_char_array)
flags_array(i)%s = trim(adjustl(flags_char_array(i)))
end do
end subroutine tokenize_flags