gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
sysdep.f90
Go to the documentation of this file.
1!-----------------------------------------------------------------------
2! Copyright (c) 2000-2026 Gtool Development Group. All rights reserved.
3!-----------------------------------------------------------------------
53
54module sysdep
55 use, intrinsic :: iso_c_binding
56 implicit none
57 private
58 public :: abortprogram
59 public :: sysdepargget
60 public :: sysdepargcount
61 public :: sysdepenvget
62
63 interface
64 subroutine dc_f_abort() &
65 ! bind(C, name="dc_c_abort")
66 bind(C, name="abort")
67 import
68 end subroutine dc_f_abort
69 end interface
70
71contains
72
89 subroutine abortprogram(message)
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()
96 end subroutine abortprogram
97
113 integer function sysdepargcount()
114 implicit none
115 sysdepargcount = command_argument_count()
116 end function sysdepargcount
117
137 subroutine sysdepargget(index, val)
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
156 end subroutine sysdepargget
157
175 subroutine sysdepenvget(env, str)
176 character(len = *), intent(in) :: env
177 character(len = *), intent(out) :: str
178 call get_environment_variable(trim(adjustl(env)), str)
179 end subroutine sysdepenvget
180
181end module sysdep
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public stderr
標準エラー出力の装置番号
Definition dc_types.f90:122
システムに依存する手続きのインタフェースを提供します
Definition sysdep.f90:54
subroutine, public abortprogram(message)
プログラムを異常終了させます
Definition sysdep.f90:90
subroutine, public sysdepenvget(env, str)
環境変数を取得します
Definition sysdep.f90:176
subroutine, public sysdepargget(index, val)
コマンドライン引数を取得します
Definition sysdep.f90:138
integer function, public sysdepargcount()
コマンドライン引数の数を取得します
Definition sysdep.f90:114