92 &
'$Id: dc_iounit.f90,v 1.1 2009-03-20 09:09:53 morikawa Exp $' 101 & unit, file, mode, &
151 integer,
intent(out):: unit
152 character(*),
intent(in):: file
153 character(*),
intent(in),
optional:: mode
154 logical,
intent(out),
optional:: err
159 integer,
parameter:: max_unit = 99
169 integer,
parameter:: min_unit = 0
179 character(TOKEN):: open_mode
181 logical:: unit_exist_flag, unit_opend_flag
182 logical:: file_exist_flag
185 character(STRING):: cause_c
186 character(*),
parameter:: subname =
'FileOpen' 208 if ( trim(file) ==
'' )
then 219 inquire(unit=unit_work, exist=unit_exist_flag, opened=unit_opend_flag)
220 if (unit_exist_flag .and. .not. unit_opend_flag)
then 223 unit_work = unit_work - 1
224 if (unit_work < min_unit)
then 235 select case( trim(open_mode) )
236 case (
'r',
'w',
'rw',
'a',
'ra')
247 select case( trim(open_mode) )
249 inquire(file=file, exist=file_exist_flag)
250 if (.not. file_exist_flag)
then 261 select case( trim(open_mode) )
263 open(unit=unit_work, iostat=iostat, &
264 & file=file, status=
'OLD', action=
'READ')
265 if (.not. iostat == 0)
then 270 close(unit=unit_work)
277 select case( trim(open_mode) )
278 case (
'w',
'a',
'rw',
'ra')
279 open(unit=unit_work, iostat=iostat, &
280 & file=file, status=
'UNKNOWN', action=
'WRITE')
281 if (.not. iostat == 0)
then 286 close(unit=unit_work)
293 select case( trim(open_mode) )
295 open(unit=unit_work, file=file, &
296 & status=
'OLD', action=
'READ')
299 open(unit=unit_work, file=file, &
300 & status=
'REPLACE', action=
'WRITE')
303 open(unit=unit_work, file=file, &
304 & status=
'REPLACE', action=
'READWRITE')
307 open(unit=unit_work, file=file, &
308 & status=
'UNKNOWN', position=
'APPEND', action=
'WRITE')
311 open(unit=unit_work, file=file, &
312 & status=
'UNKNOWN', position=
'APPEND', action=
'READWRITE')
integer, parameter, public dc_enofilewrite
integer, parameter, public dc_enounitnum
integer, parameter, public dc_enofileexist
integer, parameter, public dc_enofileread
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
logical function, public present_and_not_empty(arg)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
character(*), parameter version
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
integer, parameter, public dc_ebadfileopmode
integer, parameter, public dc_efilenameempty
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ