gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
sysdep Module Reference

Provides interface for system dependent procedures. More...

Functions/Subroutines

subroutine, public abortprogram (message)
 Abort program execution.
integer function, public sysdepargcount ()
 Get number of command line arguments.
subroutine, public sysdepargget (index, val)
 Get command line argument.
subroutine, public sysdepenvget (env, str)
 Get environment variable.

Detailed Description

Provides interface for system dependent procedures.

Author
Youhei SASAKI, Eizi TOYODA, Yasuhiro MORIKAWA

This module provides interfaces for system dependent procedures. In other words, there are interface declarations of functions and subroutines whose features are regarded as system dependent.

Note that a procedure with one name may have several implementations.

The sysdep module has no dependence to other modules.

Procedures list

Procedure Description
AbortProgram Abort program execution
SysdepArgGet Get command line argument
SysdepArgCount Get number of command line arguments
SysdepEnvGet Get environment variable

Function/Subroutine Documentation

◆ abortprogram()

subroutine, public sysdep::abortprogram ( character(len=*), intent(in), optional message)

Abort program execution.


Aborts the program, optionally displaying an error message to stderr.

Parameters
[in]messageOptional error message to display before aborting

Definition at line 89 of file sysdep.f90.

90 use dc_types, only: stderr
91 implicit none
92 character(len=*), intent(in), optional :: message
93 continue
94 if (present(message)) write(stderr, *) trim(message)
95 call dc_f_abort()
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public stderr
Unit number for Standard ERROR
Definition dc_types.f90:122

References dc_types::stderr.

◆ sysdepargcount()

integer function, public sysdep::sysdepargcount

Get number of command line arguments.


Returns the number of command line arguments passed to the program.

Returns
Number of command line arguments

Definition at line 113 of file sysdep.f90.

114 implicit none
115 sysdepargcount = command_argument_count()

References sysdepargcount().

Here is the call graph for this function:

◆ sysdepargget()

subroutine, public sysdep::sysdepargget ( integer, intent(in) index,
character(len = *), intent(out) val )

Get command line argument.


Retrieves the command line argument at the specified index. Negative indices count from the end (e.g., -1 is the last argument).

Parameters
[in]indexIndex of the argument to retrieve
[out]valValue of the argument

Definition at line 137 of file sysdep.f90.

138 implicit none
139 integer, intent(in) :: index
140 character(len = *), intent(out) :: val
141 !
142 integer:: idx
143 integer:: argc
144 continue
145 argc = sysdepargcount()
146 if (index < 0) then
147 idx = argc + 1 + index
148 else
149 idx = index
150 endif
151 if (idx > argc) then
152 val = ''
153 else
154 call get_command_argument(index, val)
155 end if

References sysdepargcount().

Here is the call graph for this function:

◆ sysdepenvget()

subroutine, public sysdep::sysdepenvget ( character(len = *), intent(in) env,
character(len = *), intent(out) str )

Get environment variable.


Retrieves the value of the specified environment variable.

Parameters
[in]envName of the environment variable
[out]strValue of the environment variable

Definition at line 175 of file sysdep.f90.

176 character(len = *), intent(in) :: env
177 character(len = *), intent(out) :: str
178 call get_environment_variable(trim(adjustl(env)), str)