Debian Codegraph @

src/system_f2003.f90

raw
1 !-----------------------------------------------------------------
2 !
3 ! This file is (or was) part of SPLASH, a visualisation tool
4 ! for Smoothed Particle Hydrodynamics written by Daniel Price:
5 !
6 ! http://users.monash.edu.au/~dprice/splash
7 !
8 ! SPLASH comes with ABSOLUTELY NO WARRANTY.
9 ! This is free software; and you are welcome to redistribute
10 ! it under the terms of the GNU General Public License
11 ! (see LICENSE file for details) and the provision that
12 ! this notice remains intact. If you modify this file, please
13 ! note section 2a) of the GPLv2 states that:
14 !
15 ! a) You must cause the modified files to carry prominent notices
16 ! stating that you changed the files and the date of any change.
17 !
18 ! Copyright (C) 2005-2009 Daniel Price. All rights reserved.
19 ! Contact: [email protected]
20 !
21 !-----------------------------------------------------------------
22
23 !
24 ! this module contains wrappers for all of the
25 ! system and compiler dependent routines
26 !
27 ! these are called from the main program by their generic names,
28 ! and in here the actual call to the system is performed
29 !
30 ! THIS ONE IS FOR FORTRAN 2003 COMPILERS
31 !
32 module system_commands
33 use iso_c_binding, only:c_int,c_char
34 implicit none
35
36 interface
37 function setenv(name, value, overwrite) bind(c,name='setenv')
38 import :: c_int,c_char
39 integer(c_int) :: setenv
40 character(kind=c_char), intent(in) :: name(*), value(*)
41 integer(c_int), value :: overwrite
42 end function
43 end interface
44
45 contains
46
47 subroutine get_number_arguments(nargs)
48 integer, intent(out) :: nargs
49
50 nargs = COMMAND_ARGUMENT_COUNT()
51
52 end subroutine get_number_arguments
53
54 subroutine get_argument(iarg,argstring)
55 integer, intent(in) :: iarg
56 character(len=*), intent(out) :: argstring
57
58 call GET_COMMAND_ARGUMENT(iarg,argstring)
59
60 end subroutine get_argument
61
62 subroutine get_environment(variable,value)
63 character(len=*), intent(in) :: variable
64 character(len=*), intent(out) :: value
65
66 call GET_ENVIRONMENT_VARIABLE(variable,value)
67
68 end subroutine get_environment
69
70 end module system_commands