2021-09-02 16:14:01 +08:00
|
|
|
//===-- runtime/iostat.cpp ------------------------------------------------===//
|
2020-02-14 06:41:56 +08:00
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2021-09-02 07:00:53 +08:00
|
|
|
#include "flang/Runtime/iostat.h"
|
2020-02-14 06:41:56 +08:00
|
|
|
|
|
|
|
namespace Fortran::runtime::io {
|
|
|
|
const char *IostatErrorString(int iostat) {
|
|
|
|
switch (iostat) {
|
2020-03-29 12:00:16 +08:00
|
|
|
case IostatOk:
|
|
|
|
return "No error";
|
|
|
|
case IostatEnd:
|
|
|
|
return "End of file during input";
|
|
|
|
case IostatEor:
|
|
|
|
return "End of record during non-advancing input";
|
|
|
|
case IostatUnflushable:
|
|
|
|
return "FLUSH not possible";
|
|
|
|
case IostatInquireInternalUnit:
|
|
|
|
return "INQUIRE on internal unit";
|
2020-02-14 06:41:56 +08:00
|
|
|
case IostatGenericError:
|
2020-03-29 12:00:16 +08:00
|
|
|
return "I/O error"; // dummy value, there's always a message
|
|
|
|
case IostatRecordWriteOverrun:
|
|
|
|
return "Excessive output to fixed-size record";
|
|
|
|
case IostatRecordReadOverrun:
|
|
|
|
return "Excessive input from fixed-size record";
|
2020-02-14 06:41:56 +08:00
|
|
|
case IostatInternalWriteOverrun:
|
|
|
|
return "Internal write overran available records";
|
2020-03-29 12:00:16 +08:00
|
|
|
case IostatErrorInFormat:
|
|
|
|
return "Invalid FORMAT";
|
|
|
|
case IostatErrorInKeyword:
|
|
|
|
return "Bad keyword argument value";
|
2022-01-29 07:34:28 +08:00
|
|
|
case IostatEndfileDirect:
|
|
|
|
return "ENDFILE on direct-access file";
|
2020-07-04 01:47:02 +08:00
|
|
|
case IostatEndfileUnwritable:
|
|
|
|
return "ENDFILE on read-only file";
|
|
|
|
case IostatOpenBadRecl:
|
|
|
|
return "OPEN with bad RECL= value";
|
|
|
|
case IostatOpenUnknownSize:
|
|
|
|
return "OPEN of file of unknown size";
|
|
|
|
case IostatOpenBadAppend:
|
|
|
|
return "OPEN(POSITION='APPEND') of unpositionable file";
|
|
|
|
case IostatWriteToReadOnly:
|
|
|
|
return "Attempted output to read-only file";
|
|
|
|
case IostatReadFromWriteOnly:
|
|
|
|
return "Attempted input from write-only file";
|
|
|
|
case IostatBackspaceNonSequential:
|
|
|
|
return "BACKSPACE on non-sequential file";
|
|
|
|
case IostatBackspaceAtFirstRecord:
|
|
|
|
return "BACKSPACE at first record";
|
|
|
|
case IostatRewindNonSequential:
|
|
|
|
return "REWIND on non-sequential file";
|
2022-01-08 02:29:23 +08:00
|
|
|
case IostatWriteAfterEndfile:
|
|
|
|
return "WRITE after ENDFILE";
|
2020-03-29 12:00:16 +08:00
|
|
|
default:
|
|
|
|
return nullptr;
|
2020-02-14 06:41:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::runtime::io
|