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