Skip to content

Commit 26350b5

Browse files
committed
Update interface of prif_init based on latest design doc choices.
1 parent a7c77d6 commit 26350b5

File tree

8 files changed

+28
-12
lines changed

8 files changed

+28
-12
lines changed

example/hello.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ program hello_world
22
use prif, only : prif_init, this_image => prif_this_image, num_images => prif_num_images, prif_stop
33
implicit none
44

5-
integer :: me, num_imgs
5+
integer :: init_exit_code, me, num_imgs
66

7-
if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit code"
7+
call prif_init(init_exit_code)
8+
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit code"
89

910
call this_image(image_index=me)
1011
call num_images(image_count=num_imgs)

example/support-test/error_stop_character_code.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ program error_stop_character_code
22
use prif, only : prif_init, prif_error_stop
33
implicit none
44

5-
if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code"
5+
integer :: init_exit_code
6+
7+
call prif_init(init_exit_code)
8+
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"
69

710
call prif_error_stop(stop_code_char="Oh snap!")
811

example/support-test/error_stop_integer_code.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ program error_stop_integer_code
22
use prif, only : prif_init, prif_error_stop
33
implicit none
44

5-
if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code"
5+
integer :: init_exit_code
6+
7+
call prif_init(init_exit_code)
8+
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"
69

710
call prif_error_stop(1)
811

example/support-test/stop_with_integer_code.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ program stop_with_no_code
22
use prif, only : prif_init, prif_stop
33
implicit none
44

5-
if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code"
5+
integer :: init_exit_code
6+
7+
call prif_init(init_exit_code)
8+
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"
69

710
call prif_stop(1)
811

example/support-test/stop_with_no_code.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ program stop_with_no_code
22
use prif, only : prif_init, prif_stop
33
implicit none
44

5-
if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code"
5+
integer :: init_exit_code
6+
7+
call prif_init(init_exit_code)
8+
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code"
69

710
call prif_stop
811

src/caffeine/program_startup_m.f90

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
33
module program_startup_m
4+
use iso_c_binding, only : c_int
45
use team_type_m, only: prif_team_type
56
implicit none
67

@@ -11,10 +12,10 @@ module program_startup_m
1112

1213
interface
1314

14-
module function prif_init() result(exit_code)
15-
implicit none
16-
integer exit_code
17-
end function
15+
module subroutine prif_init(exit_code)
16+
implicit none
17+
integer(c_int), intent(out) :: exit_code
18+
end subroutine
1819

1920
end interface
2021

src/caffeine/program_startup_s.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
! Copyright (c), The Regents of the University of California
22
! Terms of use are as specified in LICENSE.txt
33
submodule(program_startup_m) program_startup_s
4-
use iso_c_binding, only : c_int, c_loc, c_char, c_null_char
4+
use iso_c_binding, only : c_loc, c_char, c_null_char
55
use synchronization_m, only : prif_sync_all
66
use caffeine_h_m, only : caf_caffeinate, caf_decaffeinate
77
use program_termination_m, only: prif_error_stop

test/a00_caffeinate_test.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ function check_caffeination() result(result_)
2121
type(result_t) :: result_
2222

2323
integer, parameter :: successful_initiation = 0
24+
integer :: init_exit_code
2425

25-
result_ = assert_that(prif_init() == successful_initiation)
26+
call prif_init(init_exit_code)
27+
result_ = assert_that(init_exit_code == successful_initiation)
2628
end function
2729

2830
end module a00_caffeinate_test

0 commit comments

Comments
 (0)