Skip to content

Commit

Permalink
Merge branch 'exp'
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinobuAmasaki committed Aug 26, 2024
2 parents 2c243eb + 9498f79 commit 43559f7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
17 changes: 12 additions & 5 deletions src/api_internal_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ pure subroutine do_matching_exactly(automaton, string, res, prefix, suffix, runs
integer :: max_match !
character(:), allocatable :: str

integer :: len_pre, len_post, n
integer :: len_pre, len_suf, n
logical :: empty_pre, empty_post, matches_pre, matches_post

runs_engine = .false.
Expand All @@ -190,7 +190,7 @@ pure subroutine do_matching_exactly(automaton, string, res, prefix, suffix, runs
end if

len_pre = len(prefix)
len_post = len(suffix)
len_suf = len(suffix)
n = len(string)
matches_pre = .true.
matches_post = .true.
Expand All @@ -202,11 +202,18 @@ pure subroutine do_matching_exactly(automaton, string, res, prefix, suffix, runs
return
end if
end if


! Returns false if the prefix or suffix is ​​longer than the input string.
if (len_pre > len(string) .or. len_suf > len(string)) then
res = .false.
return
end if

empty_pre = prefix == ''
empty_post = suffix == ''
if (.not. empty_pre) matches_pre = string(1:len_pre) == prefix
if (.not. empty_post) matches_post = string(n-len_post+1:n) == suffix

if (.not. empty_pre) matches_pre = string(1:len_pre) == prefix
if (.not. empty_post) matches_post = string(n-len_suf+1:n) == suffix

runs_engine = any([(matches_pre .and. matches_post), &
(empty_pre .and. matches_post), &
Expand Down
11 changes: 0 additions & 11 deletions src/forgex_cli/cli_qpc_qpf.c

This file was deleted.

26 changes: 26 additions & 0 deletions src/forgex_cli/cli_time_measurement_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module forgex_cli_time_measurement_m
logical(c_bool) :: is_succeeded = .false.

!> For Windows, use high-resolution system call for timing.
#if defined(_WIN32) || defined(_WIN64)
interface
function QueryPerformanceCounter(PerformanceCount_count) result(is_succeeded_c) &
bind(c, name="QueryPerformanceCounter")
Expand All @@ -45,11 +46,36 @@ function QueryPerformanceFrequency(Frequency_countPerSec) result(is_supported_c)
logical(c_bool) :: is_supported_c
end function QueryPerformanceFrequency
end interface
#endif
!! cf. https://qiita.com/implicit_none/items/86c9117990798c1e8b3b


contains

#if defined(_WIN32) || defined(_WIN64)
#else
function QueryPerformanceCounter(PerformanceCount) result(res)
use, intrinsic :: iso_c_binding
implicit none
integer(c_long_long), intent(inout) :: PerformanceCount
logical(c_bool):: res
PerformanceCount = 1
res = .false.

end function QueryPerformanceCounter


function QueryPerformanceFrequency(PerformanceCountPerSec) result(res)
use, intrinsic :: iso_c_binding
implicit none
integer(c_long_long), intent(inout) :: PerformanceCountPerSec
logical(c_bool) :: res
PerformanceCountPerSec = 1
res = .false.

end function QueryPerformanceFrequency
#endif


!> This subroutine is for timing purpose and starts a stopwatch.
subroutine time_begin()
Expand Down

0 comments on commit 43559f7

Please sign in to comment.