FLANG
iostat-consts.h
1//===-- include/flang/Runtime/iostat-consts.h -------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef FORTRAN_RUNTIME_IOSTAT_CONSTS_H_
10#define FORTRAN_RUNTIME_IOSTAT_CONSTS_H_
11
12#include "flang/Runtime/magic-numbers.h"
13
14namespace Fortran::runtime::io {
15
16// The value of IOSTAT= is zero when no error, end-of-record,
17// or end-of-file condition has arisen; errors are positive values.
18// (See 12.11.5 in Fortran 2018 for the complete requirements;
19// these constants must match the values of their corresponding
20// named constants in the predefined module ISO_FORTRAN_ENV, so
21// they're actually defined in another magic-numbers.h header file
22// so that they can be included both here and there.)
23enum Iostat {
24 IostatOk = 0, // no error, EOF, or EOR condition
25
26 // These error codes are required by Fortran (see 12.10.2.16-17) to be
27 // negative integer values
28 IostatEnd = FORTRAN_RUNTIME_IOSTAT_END, // end-of-file on input & no error
29 // End-of-record on non-advancing input, no EOF or error
30 IostatEor = FORTRAN_RUNTIME_IOSTAT_EOR,
31
32 // This value is also required to be negative (12.11.5 bullet 6).
33 // It signifies a FLUSH statement on an unflushable unit.
34 IostatUnflushable = FORTRAN_RUNTIME_IOSTAT_FLUSH,
35
36 // Other errors are positive. We use "errno" values unchanged.
37 // This error is exported in ISO_Fortran_env.
38 IostatInquireInternalUnit = FORTRAN_RUNTIME_IOSTAT_INQUIRE_INTERNAL_UNIT,
39
40 // The remaining error codes are not exported.
41 IostatGenericError = 1001, // see IOMSG= for details
42 IostatRecordWriteOverrun,
43 IostatRecordReadOverrun,
44 IostatInternalWriteOverrun,
45 IostatErrorInFormat,
46 IostatErrorInKeyword,
47 IostatEndfileDirect,
48 IostatEndfileUnwritable,
49 IostatOpenBadRecl,
50 IostatOpenUnknownSize,
51 IostatOpenBadAppend,
52 IostatWriteToReadOnly,
53 IostatReadFromWriteOnly,
54 IostatBackspaceNonSequential,
55 IostatBackspaceAtFirstRecord,
56 IostatRewindNonSequential,
57 IostatWriteAfterEndfile,
58 IostatFormattedIoOnUnformattedUnit,
59 IostatUnformattedIoOnFormattedUnit,
60 IostatListIoOnDirectAccessUnit,
61 IostatUnformattedChildOnFormattedParent,
62 IostatFormattedChildOnUnformattedParent,
63 IostatChildInputFromOutputParent,
64 IostatChildOutputToInputParent,
65 IostatShortRead,
66 IostatMissingTerminator,
67 IostatBadUnformattedRecord,
68 IostatUTF8Decoding,
69 IostatUnitOverflow,
70 IostatBadRealInput,
71 IostatBadScaleFactor,
72 IostatBadAsynchronous,
73 IostatBadWaitUnit,
74 IostatBOZInputOverflow,
75 IostatIntegerInputOverflow,
76 IostatRealInputOverflow,
77 IostatOpenAlreadyConnected,
78 IostatCannotReposition,
79 IostatBadWaitId,
80 IostatTooManyAsyncOps,
81 IostatBadBackspaceUnit,
82 IostatBadUnitNumber,
83 IostatBadFlushUnit,
84 IostatBadOpOnChildUnit,
85 IostatBadNewUnit,
86 IostatBadListDirectedInputSeparator,
87 IostatNonExternalDefinedUnformattedIo,
88};
89
90} // namespace Fortran::runtime::io
91
92#endif // FORTRAN_RUNTIME_IOSTAT_CONSTS_H_