llvm-project

Форк
0
129 строк · 4.9 Кб
1
//===-- runtime/iostat.cpp ------------------------------------------------===//
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
#include "flang/Runtime/iostat.h"
10

11
namespace Fortran::runtime::io {
12
RT_OFFLOAD_API_GROUP_BEGIN
13

14
const char *IostatErrorString(int iostat) {
15
  switch (iostat) {
16
  case IostatOk:
17
    return "No error";
18
  case IostatEnd:
19
    return "End of file during input";
20
  case IostatEor:
21
    return "End of record during non-advancing input";
22
  case IostatUnflushable:
23
    return "FLUSH not possible";
24
  case IostatInquireInternalUnit:
25
    return "INQUIRE on internal unit";
26
  case IostatGenericError:
27
    return "I/O error"; // dummy value, there's always a message
28
  case IostatRecordWriteOverrun:
29
    return "Excessive output to fixed-size record";
30
  case IostatRecordReadOverrun:
31
    return "Excessive input from fixed-size record";
32
  case IostatInternalWriteOverrun:
33
    return "Internal write overran available records";
34
  case IostatErrorInFormat:
35
    return "Bad FORMAT";
36
  case IostatErrorInKeyword:
37
    return "Bad keyword argument value";
38
  case IostatEndfileDirect:
39
    return "ENDFILE on direct-access file";
40
  case IostatEndfileUnwritable:
41
    return "ENDFILE on read-only file";
42
  case IostatOpenBadRecl:
43
    return "OPEN with bad RECL= value";
44
  case IostatOpenUnknownSize:
45
    return "OPEN of file of unknown size";
46
  case IostatOpenBadAppend:
47
    return "OPEN(POSITION='APPEND') of unpositionable file";
48
  case IostatWriteToReadOnly:
49
    return "Attempted output to read-only file";
50
  case IostatReadFromWriteOnly:
51
    return "Attempted input from write-only file";
52
  case IostatBackspaceNonSequential:
53
    return "BACKSPACE on non-sequential file";
54
  case IostatBackspaceAtFirstRecord:
55
    return "BACKSPACE at first record";
56
  case IostatRewindNonSequential:
57
    return "REWIND on non-sequential file";
58
  case IostatWriteAfterEndfile:
59
    return "WRITE after ENDFILE";
60
  case IostatFormattedIoOnUnformattedUnit:
61
    return "Formatted I/O on unformatted file";
62
  case IostatUnformattedIoOnFormattedUnit:
63
    return "Unformatted I/O on formatted file";
64
  case IostatListIoOnDirectAccessUnit:
65
    return "List-directed or NAMELIST I/O on direct-access file";
66
  case IostatUnformattedChildOnFormattedParent:
67
    return "Unformatted child I/O on formatted parent unit";
68
  case IostatFormattedChildOnUnformattedParent:
69
    return "Formatted child I/O on unformatted parent unit";
70
  case IostatChildInputFromOutputParent:
71
    return "Child input from output parent unit";
72
  case IostatChildOutputToInputParent:
73
    return "Child output to input parent unit";
74
  case IostatShortRead:
75
    return "Read from external unit returned insufficient data";
76
  case IostatMissingTerminator:
77
    return "Sequential record missing its terminator";
78
  case IostatBadUnformattedRecord:
79
    return "Erroneous unformatted sequential file record structure";
80
  case IostatUTF8Decoding:
81
    return "UTF-8 decoding error";
82
  case IostatUnitOverflow:
83
    return "UNIT number is out of range";
84
  case IostatBadRealInput:
85
    return "Bad REAL input value";
86
  case IostatBadScaleFactor:
87
    return "Bad REAL output scale factor (kP)";
88
  case IostatBadAsynchronous:
89
    return "READ/WRITE(ASYNCHRONOUS='YES') on unit without "
90
           "OPEN(ASYNCHRONOUS='YES')";
91
  case IostatBadWaitUnit:
92
    return "WAIT(UNIT=) for a bad or unconnected unit number";
93
  case IostatBOZInputOverflow:
94
    return "B/O/Z input value overflows variable";
95
  case IostatIntegerInputOverflow:
96
    return "Integer input value overflows variable";
97
  case IostatRealInputOverflow:
98
    return "Real or complex input value overflows type";
99
  case IostatCannotReposition:
100
    return "Attempt to reposition a unit which is connected to a file that can "
101
           "only be processed sequentially";
102
  case IostatOpenAlreadyConnected:
103
    return "OPEN of file already connected to another unit";
104
  case IostatBadWaitId:
105
    return "WAIT(ID=nonzero) for an ID value that is not a pending operation";
106
  case IostatTooManyAsyncOps:
107
    return "Too many asynchronous operations pending on unit";
108
  case IostatBadBackspaceUnit:
109
    return "BACKSPACE on unconnected unit";
110
  case IostatBadUnitNumber:
111
    return "Negative unit number is not allowed";
112
  case IostatBadFlushUnit:
113
    return "FLUSH attempted on a bad or unconnected unit number";
114
  case IostatBadOpOnChildUnit:
115
    return "Impermissible I/O statement on child I/O unit";
116
  case IostatBadNewUnit:
117
    return "NEWUNIT= without FILE= or STATUS='SCRATCH'";
118
  case IostatBadListDirectedInputSeparator:
119
    return "List-directed input value has trailing unused characters";
120
  case IostatNonExternalDefinedUnformattedIo:
121
    return "Defined unformatted I/O without an external unit";
122
  default:
123
    return nullptr;
124
  }
125
}
126

127
RT_OFFLOAD_API_GROUP_END
128

129
} // namespace Fortran::runtime::io
130

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.