Warning: This file is not a C or C++ file. It does not have highlighting.

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

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of flang/include/flang/Runtime/iostat.h