-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassing.f90
More file actions
57 lines (38 loc) · 1.32 KB
/
passing.f90
File metadata and controls
57 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
!> *Error passing*
!>
!> A very basic demo to get the idea.
!
! TODO: discuss - we should probably have some convention for module names.
! The hard part is avoiding them becoming too long...
module m_error_v_passing
use m_error_v, only: ErrorV, NO_ERROR_CODE
implicit none
private
public :: pass_error, pass_errors
contains
function pass_error(inv) result(is_err)
!! Pass an error
!!
!! If an error is supplied, we return `.true.`, otherwise `.false.`.
type(ErrorV), intent(in) :: inv
!! Input error value
logical :: is_err
!! Whether `inv` is an error or not
is_err = (inv % code /= NO_ERROR_CODE)
end function pass_error
function pass_errors(invs, n) result(is_errs)
!! Pass a number of errors
!!
!! For each value in `invs`, if an error is supplied, we return `.true.`, otherwise `.false.`.
type(ErrorV), dimension(n), intent(in) :: invs
!! Input error values
integer, intent(in) :: n
!! Number of values being passed
logical, dimension(n) :: is_errs
!! Whether each value in `invs` is an error or not
integer :: i
do i = 1, n
is_errs(i) = pass_error(invs(i))
end do
end function pass_errors
end module m_error_v_passing