File: io01.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (138 lines) | stat: -rw-r--r-- 4,762 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
! RUN: %python %S/test_errors.py %s %flang_fc1
  character(len=20) :: access = "direcT"
  character(len=20) :: access_(2) = (/"direcT", "streaM"/)
  character(len=20) :: action_(2) = (/"reaD ", "writE"/)
  character(len=20) :: asynchronous_(2) = (/"nO ", "yeS"/)
  character(len=20) :: blank_(2) = (/"nulL", "zerO"/)
  character(len=20) :: decimal_(2) = (/'commA', 'poinT'/)
  character(len=20) :: delim_(2) = (/"nonE ", "quotE"/)
  character(len=20) :: encoding_(2) = (/"defaulT", "utF-8  "/)
  character(len=20) :: form_(2) = (/"formatteD  ", "unformatteD"/)
  character(len=20) :: pad_(2) = (/"nO ", "yeS"/)
  character(len=20) :: position_(3) = (/"appenD", "asiS  ", "rewinD"/)
  character(len=20) :: round_(2) = (/"dowN", "zerO"/)
  character(len=20) :: sign_(2) = (/"pluS    ", "suppresS"/)
  character(len=20) :: status_(2) = (/"neW", "olD"/)
  character(len=20) :: convert_(2) = (/"big_endiaN", "nativE    "/)
  character(len=20) :: dispose_(2) = (/ "deletE", "keeP  "/)
  character(len=66) :: cc, msg

  integer :: new_unit
  integer :: unit10 = 10
  integer :: unit11 = 11
  integer :: n = 40
  integer, parameter :: const_new_unit = 66

  integer(kind=1) :: stat1
  integer(kind=2) :: stat2
  integer(kind=4) :: stat4
  integer(kind=8) :: stat8

  cc = 'scratch'

  open(unit10)
  open(blank='null', unit=unit10, pad='no')
  open(unit=unit11, err=3)
3 continue

  open(20, access='sequential')
  open(21, access=access, recl=n)
  open(22, access=access_(2), iostat=stat1, iomsg=msg)

  open(30, action='readwrite', asynchronous='n'//'o', blank='zero')
  open(31, action=action_(2), asynchronous=asynchronous_(2), blank=blank_(2))

  open(unit=40, decimal="comma", delim="apostrophe", encoding="utf-8")
  open(unit=41, decimal=decimal_(2), delim=delim_(2), encoding=encoding_(2))

  open(50, file='abc', status='unknown', form='formatted')
  open(51, file=access, status=status_(2), form=form_(2))

  open(newunit=new_unit, pad=pad_(2), status='scr'//'atch'//'')
  open(newunit=new_unit, pad=pad_(2), status=cc)

  open(unit=60, position='rewind', recl=(30+20/2), round='zero')
  open(position=position_(1), recl=n, round=round_(2), unit=61)

  open(unit=70, sign='suppress', &
      status='unknown', iostat=stat2)
  open(unit=70, sign=sign_(2), status=status_(2))

  open(80, convert='big_endian', dispose='delete')
  open(81, convert=convert_(2), dispose=dispose_(2))

  open(access='STREAM', 90) ! nonstandard
  open (unit=91, file='xfile', carriagecontrol='list') ! nonstandard

  !ERROR: OPEN statement must have a UNIT or NEWUNIT specifier
  !ERROR: If ACCESS='DIRECT' appears, RECL must also appear
  open(access='direct')

  !ERROR: If STATUS='STREAM' appears, RECL must not appear
  open(10, access='st'//'ream', recl=13)

  !ERROR: Duplicate NEWUNIT specifier
  !ERROR: If NEWUNIT appears, FILE or STATUS must also appear
  open(newunit=n, newunit=nn, iostat=stat4)

  !ERROR: NEWUNIT variable 'const_new_unit' is not definable
  !BECAUSE: '66_4' is not a variable or pointer
  open(newunit=const_new_unit, status=cc)

  !ERROR: Duplicate UNIT specifier
  open(unit=100, unit=100)

  !ERROR: Duplicate UNIT specifier
  open(101, delim=delim_(1), unit=102)

  !ERROR: Duplicate UNIT specifier
  open(unit=103, &
      unit=104, iostat=stat8)

  !ERROR: Duplicate UNIT specifier
  !ERROR: If ACCESS='DIRECT' appears, RECL must also appear
  open(access='dir'//'ect', 9, 9) ! nonstandard

  !ERROR: Duplicate ROUND specifier
  open(105, round=round_(1), pad='no', round='nearest')

  !ERROR: If NEWUNIT appears, UNIT must not appear
  !ERROR: If NEWUNIT appears, FILE or STATUS must also appear
  open(106, newunit=n)

  !ERROR: RECL value (-30) must be positive
  open(107, recl=40-70)

  !ERROR: RECL value (-36) must be positive
  open(108, recl=-  -  (-36)) ! nonstandard

  !ERROR: Invalid ACTION value 'reedwrite'
  open(109, access=Access, action='reedwrite', recl=77)

  !ERROR: Invalid ACTION value 'nonsense'
  open(110, action=''//'non'//'sense', recl=77)

  !ERROR: Invalid STATUS value 'cold'
  open(111, status='cold')

  !ERROR: Invalid STATUS value 'Keep'
  open(112, status='Keep')

  !ERROR: If STATUS='NEW' appears, FILE must also appear
  open(113, status='new')

  !ERROR: If STATUS='REPLACE' appears, FILE must also appear
  open(114, status='replace')

  !ERROR: If STATUS='SCRATCH' appears, FILE must not appear
  open(115, file='abc', status='scratch')

  !ERROR: If NEWUNIT appears, FILE or STATUS='SCRATCH' must also appear
  open(newunit=nn, status='old')

  !ERROR: Unimplemented CARRIAGECONTROL value 'fortran'
  open (unit=116, file='xfile', carriagecontrol='fortran') ! nonstandard

  !ERROR: Invalid CARRIAGECONTROL value 'nonsense'
  open (unit=116, file='xfile', carriagecontrol='nonsense') ! nonstandard
end