[1987] | 1 | !> @posix_calls_from_fortran.f90 |
---|
| 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU fGeneral Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
| 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
| 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
| 19 | ! Current revisions: |
---|
| 20 | ! ----------------- |
---|
| 21 | ! |
---|
| 22 | ! |
---|
| 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: posix_calls_from_fortran.f90 1986 2016-08-10 14:07:17Z gronemeier $ |
---|
| 26 | ! |
---|
| 27 | ! 1986 2016-08-10 14:07:17Z gronemeier |
---|
| 28 | ! Initial revision |
---|
| 29 | ! |
---|
| 30 | ! Description: |
---|
| 31 | ! ------------ |
---|
| 32 | !> Collection of POSIX-command calls for Fortran |
---|
| 33 | !------------------------------------------------------------------------------! |
---|
| 34 | MODULE posix_calls_from_fortran |
---|
| 35 | |
---|
| 36 | USE, INTRINSIC :: iso_c_binding, ONLY: c_int |
---|
| 37 | |
---|
| 38 | IMPLICIT none |
---|
| 39 | |
---|
| 40 | PRIVATE |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | INTERFACE |
---|
| 44 | |
---|
| 45 | FUNCTION fsleep( seconds ) BIND( C, NAME='sleep' ) |
---|
| 46 | IMPORT |
---|
| 47 | INTEGER(c_int) :: fsleep |
---|
| 48 | INTEGER(c_int), INTENT(IN), VALUE :: seconds |
---|
| 49 | END FUNCTION fsleep |
---|
| 50 | |
---|
| 51 | END INTERFACE |
---|
| 52 | |
---|
| 53 | INTERFACE fortran_sleep |
---|
| 54 | MODULE PROCEDURE fortran_sleep |
---|
| 55 | END INTERFACE fortran_sleep |
---|
| 56 | |
---|
| 57 | PUBLIC fortran_sleep |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | CONTAINS |
---|
| 61 | |
---|
| 62 | !------------------------------------------------------------------------------! |
---|
| 63 | ! Description: |
---|
| 64 | ! ------------ |
---|
| 65 | !> Wait a specified amount of seconds |
---|
| 66 | !------------------------------------------------------------------------------! |
---|
| 67 | SUBROUTINE fortran_sleep( seconds ) |
---|
| 68 | |
---|
| 69 | INTEGER, INTENT(IN) :: seconds |
---|
| 70 | |
---|
| 71 | INTEGER(c_int) :: seconds_in_c |
---|
| 72 | INTEGER(c_int) :: sleep_return_value |
---|
| 73 | |
---|
| 74 | seconds_in_c = seconds |
---|
| 75 | |
---|
| 76 | sleep_return_value = fsleep( seconds_in_c ) |
---|
| 77 | |
---|
| 78 | END SUBROUTINE fortran_sleep |
---|
| 79 | |
---|
| 80 | END MODULE posix_calls_from_fortran |
---|
| 81 | |
---|